Skip to content

Commit 9047fa1

Browse files
committed
avutil: attributes: fix AV_HAS_STD_ATTRIBUTE checks
Attributes with the language-supported [[attr]] style are only supported since C++11 and C23 respectively, so this needs to be accounted for in these checks. This solves a huge amount of warning spam of: warning: [[]] attributes are a C23 extension [-Wc23-extensions] when using --enable-extra-warnings. (cherry picked from commit cce545a) Signed-off-by: Marvin Scholz <[email protected]>
1 parent e1a84cd commit 9047fa1

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

libavutil/attributes.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,14 @@
4646
# define AV_HAS_ATTRIBUTE(x) 0
4747
#endif
4848

49-
#if defined(__cplusplus) && defined(__has_cpp_attribute)
49+
#if defined(__cplusplus) && \
50+
defined(__has_cpp_attribute) && \
51+
__cplusplus >= 201103L
5052
# define AV_HAS_STD_ATTRIBUTE(x) __has_cpp_attribute(x)
51-
#elif !defined(__cplusplus) && defined(__has_c_attribute)
53+
#elif !defined(__cplusplus) && \
54+
defined(__has_c_attribute) && \
55+
defined(__STDC_VERSION__) && \
56+
__STDC_VERSION__ >= 202311L
5257
# define AV_HAS_STD_ATTRIBUTE(x) __has_c_attribute(x)
5358
#else
5459
# define AV_HAS_STD_ATTRIBUTE(x) 0

0 commit comments

Comments
 (0)