diff --git a/libavutil/attributes.h b/libavutil/attributes.h index 9e0222a691..0e49b22b9d 100644 --- a/libavutil/attributes.h +++ b/libavutil/attributes.h @@ -46,9 +46,14 @@ # define AV_HAS_ATTRIBUTE(x) 0 #endif -#if defined(__cplusplus) && defined(__has_cpp_attribute) +#if defined(__cplusplus) && \ + defined(__has_cpp_attribute) && \ + __cplusplus >= 201103L # define AV_HAS_STD_ATTRIBUTE(x) __has_cpp_attribute(x) -#elif !defined(__cplusplus) && defined(__has_c_attribute) +#elif !defined(__cplusplus) && \ + defined(__has_c_attribute) && \ + defined(__STDC_VERSION__) && \ + __STDC_VERSION__ >= 202311L # define AV_HAS_STD_ATTRIBUTE(x) __has_c_attribute(x) #else # define AV_HAS_STD_ATTRIBUTE(x) 0