From 794ffdc8238fcf2a28d87bf5c1bf1b249eeb1402 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20Michaj=C5=82ow?= Date: Sat, 22 Aug 2026 17:41:08 +0200 Subject: [PATCH] avutil: remove always-true GCC version checks in internal headers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Every GCC able to pass the C11 configure check provides these builtins, attributes and pragmas. Public headers are left untouched since they must keep working with C99 compilers. Signed-off-by: Kacper Michajłow --- libavutil/attributes_internal.h | 2 +- libavutil/internal.h | 2 +- libavutil/intmath.h | 12 ++++++------ 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/libavutil/attributes_internal.h b/libavutil/attributes_internal.h index 15d89120ad..b946d0c5d4 100644 --- a/libavutil/attributes_internal.h +++ b/libavutil/attributes_internal.h @@ -21,7 +21,7 @@ #include "attributes.h" -#if (AV_GCC_VERSION_AT_LEAST(4,0) || defined(__clang__)) && (defined(__ELF__) || defined(__MACH__)) +#if (defined(__GNUC__) || defined(__clang__)) && (defined(__ELF__) || defined(__MACH__)) # define attribute_visibility_hidden __attribute__((visibility("hidden"))) # define FF_VISIBILITY_PUSH_HIDDEN _Pragma("GCC visibility push(hidden)") # define FF_VISIBILITY_POP_HIDDEN _Pragma("GCC visibility pop") diff --git a/libavutil/internal.h b/libavutil/internal.h index 2040937bfb..88a4d29f2c 100644 --- a/libavutil/internal.h +++ b/libavutil/internal.h @@ -44,7 +44,7 @@ #include "macros.h" #ifndef attribute_align_arg -#if ARCH_X86_32 && AV_GCC_VERSION_AT_LEAST(4,2) +#if ARCH_X86_32 && defined(__GNUC__) # define attribute_align_arg __attribute__((force_align_arg_pointer)) #else # define attribute_align_arg diff --git a/libavutil/intmath.h b/libavutil/intmath.h index b177a848c6..a32e225895 100644 --- a/libavutil/intmath.h +++ b/libavutil/intmath.h @@ -35,14 +35,14 @@ #endif #if HAVE_FAST_CLZ -#if AV_GCC_VERSION_AT_LEAST(3,4) || AV_HAS_BUILTIN(__builtin_clz) +#if defined(__GNUC__) || AV_HAS_BUILTIN(__builtin_clz) #ifndef ff_log2 # define ff_log2(x) (31 - __builtin_clz((x)|1)) # ifndef ff_log2_16bit # define ff_log2_16bit av_log2 # endif #endif /* ff_log2 */ -#endif /* AV_GCC_VERSION_AT_LEAST(3,4) */ +#endif /* defined(__GNUC__) || AV_HAS_BUILTIN(__builtin_clz) */ #endif extern const uint8_t ff_log2_tab[256]; @@ -90,13 +90,13 @@ static av_always_inline av_const int ff_log2_16bit_c(unsigned int v) */ #if HAVE_FAST_CLZ -#if !defined(ff_ctz) && (AV_GCC_VERSION_AT_LEAST(3,4) || AV_HAS_BUILTIN(__builtin_ctz)) +#if !defined(ff_ctz) && (defined(__GNUC__) || AV_HAS_BUILTIN(__builtin_ctz)) #define ff_ctz(v) __builtin_ctz(v) #endif -#if !defined(ff_ctzll) && (AV_GCC_VERSION_AT_LEAST(3,4) || AV_HAS_BUILTIN(__builtin_ctzll)) +#if !defined(ff_ctzll) && (defined(__GNUC__) || AV_HAS_BUILTIN(__builtin_ctzll)) #define ff_ctzll(v) __builtin_ctzll(v) #endif -#if !defined(ff_clz) && (AV_GCC_VERSION_AT_LEAST(3,4) || AV_HAS_BUILTIN(__builtin_clz)) +#if !defined(ff_clz) && (defined(__GNUC__) || AV_HAS_BUILTIN(__builtin_clz)) #define ff_clz(v) __builtin_clz(v) #endif #endif @@ -152,7 +152,7 @@ static av_always_inline av_const unsigned ff_clz_c(unsigned x) } #endif -#if AV_GCC_VERSION_AT_LEAST(3,4) || AV_HAS_BUILTIN(__builtin_parity) +#if defined(__GNUC__) || AV_HAS_BUILTIN(__builtin_parity) #ifndef av_parity #define av_parity __builtin_parity #endif