Explicitly exclude clang when we test for a GCC version >= 4.3.
authorBruno Haible <bruno@clisp.org>
Tue, 27 Aug 2024 14:20:16 +0000 (16:20 +0200)
committerBruno Haible <bruno@clisp.org>
Tue, 17 Sep 2024 13:19:08 +0000 (15:19 +0200)
Rationale: clang can disguise as any possible GCC version.

* m4/gnulib-common.m4 (gl_CC_GNULIB_WARNINGS): When testing __GNUC__,
exclude clang.
* lib/_Noreturn.h (_Noreturn): Likewise.
* lib/aligned-malloc.h (aligned_free, aligned_malloc): Likewise.
* lib/base32.h: Likewise.
* lib/base64.h: Likewise.
* lib/dfa.c (FALLTHROUGH): Likewise.
* lib/dirent.in.h (_GL_ATTRIBUTE_DEALLOC, opendir, fdopendir): Likewise.
* lib/intprops-internal.h: Likewise.
* lib/jit/cache.h (clear_cache): Likewise.
* lib/malloc.in.h (memalign): Likewise.
* lib/mcel.h: Likewise.
* lib/regex.h: Likewise.
* lib/stddef.in.h (_GL_HAS_BUILTIN_UNREACHABLE): Likewise.
* lib/stdio.in.h (_GL_ATTRIBUTE_DEALLOC, fdopen, fopen, popen, tmpfile):
Likewise.
* lib/stdlib.in.h (_GL_ATTRIBUTE_DEALLOC, aligned_alloc, calloc,
canonicalize_file_name, malloc, realloc): Likewise.
* lib/string.in.h (_GL_ATTRIBUTE_DEALLOC, strdup, strndup): Likewise.
* lib/verify.h: Likewise.
* lib/wchar.in.h (_GL_ATTRIBUTE_DEALLOC, wcsdup): Likewise.
* lib/xalloc-oversized.h (xalloc_oversized): Likewise.
* lib/fenv-private.h (_FPU_GETCW, _FPU_SETCW, _FPU_GETFPSR,
_FPU_SETFPSR): When testing __GNUC__, exclude clang. Use different
builtins for clang.
* lib/hamt.h (GL_HAMT_THREAD_SAFE): When testing __GNUC__, exclude
clang. Enable for clang >= 4.
* lib/astrxfrm.c: Use _GL_GNUC_PREREQ.
* lib/readutmp.c: Likewise.
* lib/strftime.c: Likewise.
* tests/test-asyncsafe-linked_list-strong.c: Likewise.
* tests/test-asyncsafe-linked_list-weak.c: Likewise.
* tests/test-c-strtod-mt.c: Likewise.
* tests/test-c-strtof-mt.c: Likewise.
* tests/test-c-strtold-mt.c: Likewise.
* tests/test-gmtime_r-mt.c: Likewise.
* tests/test-intprops.c: Likewise.
* tests/test-limits-h.c: Likewise.
* tests/test-localtime_r-mt.c: Likewise.
* tests/test-memrchr.c: Likewise.
* tests/test-nl_langinfo-mt.c: Likewise.
* tests/test-setlocale_null-mt-all.c: Likewise.
* tests/test-setlocale_null-mt-one.c: Likewise.
* tests/test-statat.c: Likewise.
* tests/test-xvasprintf.c: Likewise.

35 files changed:
ChangeLog
lib/_Noreturn.h
lib/aligned-malloc.h
lib/astrxfrm.c
lib/base32.h
lib/base64.h
lib/dfa.c
lib/dirent.in.h
lib/fenv-private.h
lib/hamt.h
lib/intprops-internal.h
lib/jit/cache.h
lib/malloc.in.h
lib/mcel.h
lib/nstrftime.c
lib/readutmp.c
lib/regex.h
lib/stddef.in.h
lib/stdio.in.h
lib/stdlib.in.h
lib/string.in.h
lib/verify.h
lib/wchar.in.h
lib/xalloc-oversized.h
m4/gnulib-common.m4
tests/test-asyncsafe-linked_list-strong.c
tests/test-asyncsafe-linked_list-weak.c
tests/test-intprops.c
tests/test-limits-h.c
tests/test-memrchr.c
tests/test-nl_langinfo-mt.c
tests/test-setlocale_null-mt-all.c
tests/test-setlocale_null-mt-one.c
tests/test-statat.c
tests/test-xvasprintf.c

index 80c0f0ed6b93c29e55e4e52b7f364e4a19a0dac1..0c322997e274dffadd0589c3b34903b7331862ea 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,48 @@
+2024-08-27  Bruno Haible  <bruno@clisp.org>
+
+       Explicitly exclude clang when we test for a GCC version >= 4.3.
+       Rationale: clang can disguise as any possible GCC version.
+       * m4/gnulib-common.m4 (gl_CC_GNULIB_WARNINGS): When testing __GNUC__,
+       exclude clang.
+       * lib/_Noreturn.h (_Noreturn): Likewise.
+       * lib/aligned-malloc.h (aligned_free, aligned_malloc): Likewise.
+       * lib/base32.h: Likewise.
+       * lib/base64.h: Likewise.
+       * lib/dfa.c (FALLTHROUGH): Likewise.
+       * lib/dirent.in.h (_GL_ATTRIBUTE_DEALLOC, opendir, fdopendir): Likewise.
+       * lib/intprops-internal.h: Likewise.
+       * lib/jit/cache.h (clear_cache): Likewise.
+       * lib/malloc.in.h (memalign): Likewise.
+       * lib/mcel.h: Likewise.
+       * lib/regex.h: Likewise.
+       * lib/stddef.in.h (_GL_HAS_BUILTIN_UNREACHABLE): Likewise.
+       * lib/stdio.in.h (_GL_ATTRIBUTE_DEALLOC, fdopen, fopen, popen, tmpfile):
+       Likewise.
+       * lib/stdlib.in.h (_GL_ATTRIBUTE_DEALLOC, aligned_alloc, calloc,
+       canonicalize_file_name, malloc, realloc): Likewise.
+       * lib/string.in.h (_GL_ATTRIBUTE_DEALLOC, strdup, strndup): Likewise.
+       * lib/verify.h: Likewise.
+       * lib/wchar.in.h (_GL_ATTRIBUTE_DEALLOC, wcsdup): Likewise.
+       * lib/xalloc-oversized.h (xalloc_oversized): Likewise.
+       * lib/fenv-private.h (_FPU_GETCW, _FPU_SETCW, _FPU_GETFPSR,
+       _FPU_SETFPSR): When testing __GNUC__, exclude clang. Use different
+       builtins for clang.
+       * lib/hamt.h (GL_HAMT_THREAD_SAFE): When testing __GNUC__, exclude
+       clang. Enable for clang >= 4.
+       * lib/astrxfrm.c: Use _GL_GNUC_PREREQ.
+       * lib/nstrftime.c: Likewise.
+       * lib/readutmp.c: Likewise.
+       * tests/test-asyncsafe-linked_list-strong.c: Likewise.
+       * tests/test-asyncsafe-linked_list-weak.c: Likewise.
+       * tests/test-intprops.c: Likewise.
+       * tests/test-limits-h.c: Likewise.
+       * tests/test-memrchr.c: Likewise.
+       * tests/test-nl_langinfo-mt.c: Likewise.
+       * tests/test-setlocale_null-mt-all.c: Likewise.
+       * tests/test-setlocale_null-mt-one.c: Likewise.
+       * tests/test-statat.c: Likewise.
+       * tests/test-xvasprintf.c: Likewise.
+
 2024-08-27  Bruno Haible  <bruno@clisp.org>
 
        readutmp: In systemd mode, show sessions of type "web".
index 7326bd477331b4acbe93a119f3cc86b5ea3148b8..9806f2b1a092ef857a8c7a0b3f3dfd0948ab402c 100644 (file)
@@ -34,7 +34,7 @@
 # elif ((!defined __cplusplus || defined __clang__) \
         && (201112 <= (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) \
             || (!defined __STRICT_ANSI__ \
-                && (4 < __GNUC__ + (7 <= __GNUC_MINOR__) \
+                && (4 < __GNUC__ + (7 <= __GNUC_MINOR__) && !defined __clang__ \
                     || (defined __apple_build_version__ \
                         ? 6000000 <= __apple_build_version__ \
                         : 3 < __clang_major__ + (5 <= __clang_minor__))))))
index a432512c76bcac6c30a06d598bdbe5c56dd21c11..27d03eae405c1ed1244585ce2a4bdbfe40516ed3 100644 (file)
@@ -59,7 +59,7 @@
 #endif
 #if ((ALIGNMENT) <= MALLOC_ALIGNMENT) || HAVE_POSIX_MEMALIGN || HAVE_ALIGNED_ALLOC || HAVE_MEMALIGN
 
-# if defined aligned_free || __GNUC__ >= 11
+# if defined aligned_free || (__GNUC__ >= 11 && !defined __clang__)
    /* The caller wants an inline function, not a macro,
       or we can use GCC's -Wmismatched-dealloc warning.  */
 static inline void
@@ -74,7 +74,7 @@ aligned_free (void *q)
 # if (ALIGNMENT) <= MALLOC_ALIGNMENT
 /* Simply use malloc.  */
 
-#  if defined aligned_malloc || __GNUC__ >= 11
+#  if defined aligned_malloc || (__GNUC__ >= 11 && !defined __clang__)
    /* The caller wants an inline function, not a macro,
       or GCC's -Wmismatched-dealloc warning might be in effect.  */
 static inline
index eaedff0a8314c6121cf2835a18070fe7902be6d2..f25cf7d4932149cf06dae213885a8271c60a023f 100644 (file)
@@ -26,7 +26,7 @@
 
 /* Avoid false GCC warning "function may return address of local variable"
    regarding result and tmpbuf.  */
-#if __GNUC__ + (__GNUC_MINOR__ >= 8) > 4
+#if _GL_GNUC_PREREQ (4, 8)
 # pragma GCC diagnostic ignored "-Wreturn-local-addr"
 #endif
 
index eadbeae56c1d5aa1d9ff278982f833d8fc957b25..8c10948c3764d8e6b605f427a77f0bccf89b3b12 100644 (file)
@@ -27,7 +27,7 @@
 #include <idx.h>
 
 /* Pacify GCC in isubase32.  */
-#if defined __GNUC__ && 4 < __GNUC__ + (3 <= __GNUC_MINOR__)
+#if 4 < __GNUC__ + (3 <= __GNUC_MINOR__) && !defined __clang__
 # pragma GCC diagnostic ignored "-Wtype-limits"
 #endif
 
index 7691f6c4ade67e1fd60ccf1fb6b72cb2fa3917b4..562ba97302f6e1a74aab60b188884a99f0a17a33 100644 (file)
@@ -27,7 +27,7 @@
 #include <idx.h>
 
 /* Pacify GCC in isubase64.  */
-#if defined __GNUC__ && 4 < __GNUC__ + (3 <= __GNUC_MINOR__)
+#if 4 < __GNUC__ + (3 <= __GNUC_MINOR__) && !defined __clang__
 # pragma GCC diagnostic ignored "-Wtype-limits"
 #endif
 
index c79afddcd9189b20bb3f209af7cdcd78d3540da0..744109050251c4f22b4c57315223f6092e6ac81c 100644 (file)
--- a/lib/dfa.c
+++ b/lib/dfa.c
@@ -80,7 +80,7 @@ c_isdigit (char c)
 #ifndef FALLTHROUGH
 # if 201710L < __STDC_VERSION__
 #  define FALLTHROUGH [[__fallthrough__]]
-# elif ((__GNUC__ >= 7) \
+# elif ((__GNUC__ >= 7 && !defined __clang__) \
         || (defined __apple_build_version__ \
             ? __apple_build_version__ >= 12000000 \
             : __clang_major__ >= 10))
index f05b880077f619401a51076a00ca69a8c2ec8519..3fe46f2336f22f15cc29ecb56d4dd833dac93f99 100644 (file)
@@ -78,7 +78,7 @@ typedef struct gl_directory DIR;
    that can be freed by passing them as the Ith argument to the
    function F.  */
 #ifndef _GL_ATTRIBUTE_DEALLOC
-# if __GNUC__ >= 11
+# if __GNUC__ >= 11 && !defined __clang__
 #  define _GL_ATTRIBUTE_DEALLOC(f, i) __attribute__ ((__malloc__ (f, i)))
 # else
 #  define _GL_ATTRIBUTE_DEALLOC(f, i)
@@ -152,7 +152,7 @@ _GL_FUNCDECL_RPL (opendir, DIR *,
                   _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC (closedir, 1));
 _GL_CXXALIAS_RPL (opendir, DIR *, (const char *dir_name));
 # else
-#  if !@HAVE_OPENDIR@ || __GNUC__ >= 11
+#  if !@HAVE_OPENDIR@ || (__GNUC__ >= 11 && !defined __clang__)
 _GL_FUNCDECL_SYS (opendir, DIR *,
                   (const char *dir_name)
                   _GL_ARG_NONNULL ((1))
@@ -162,7 +162,8 @@ _GL_CXXALIAS_SYS (opendir, DIR *, (const char *dir_name));
 # endif
 _GL_CXXALIASWARN (opendir);
 #else
-# if @GNULIB_CLOSEDIR@ && !GNULIB_defined_DIR && __GNUC__ >= 11 && !defined opendir
+# if @GNULIB_CLOSEDIR@ && !GNULIB_defined_DIR \
+     && (__GNUC__ >= 11 && !defined __clang__) && !defined opendir
 /* For -Wmismatched-dealloc: Associate opendir with closedir or
    rpl_closedir.  */
 _GL_FUNCDECL_SYS (opendir, DIR *,
@@ -274,7 +275,8 @@ _GL_FUNCDECL_RPL (fdopendir, DIR *,
                   _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC (closedir, 1));
 _GL_CXXALIAS_RPL (fdopendir, DIR *, (int fd));
 # else
-#  if !@HAVE_FDOPENDIR@ || !@HAVE_DECL_FDOPENDIR@ || __GNUC__ >= 11
+#  if !@HAVE_FDOPENDIR@ || !@HAVE_DECL_FDOPENDIR@ \
+      || (__GNUC__ >= 11 && !defined __clang__)
 _GL_FUNCDECL_SYS (fdopendir, DIR *,
                   (int fd)
                   _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC (closedir, 1));
@@ -283,7 +285,8 @@ _GL_CXXALIAS_SYS (fdopendir, DIR *, (int fd));
 # endif
 _GL_CXXALIASWARN (fdopendir);
 #else
-# if @GNULIB_CLOSEDIR@ && __GNUC__ >= 11 && !defined fdopendir
+# if @GNULIB_CLOSEDIR@ \
+     && (__GNUC__ >= 11 && !defined __clang__) && !defined fdopendir
 /* For -Wmismatched-dealloc: Associate fdopendir with closedir or
    rpl_closedir.  */
 _GL_FUNCDECL_SYS (fdopendir, DIR *,
index e92c9de22877019967e01f5cae1c8ffa8f86ce20..9571b7b93d6719928ad3cedc050ac35936fc4245 100644 (file)
@@ -133,9 +133,12 @@ x86_387_fenv_t;
    occurring, trigger a trap rather than merely set the corresponding bit
    in the fpsr register.  */
 
-# if __GNUC__ >= 6
+# if __GNUC__ >= 6 && !defined __clang__
 #  define _FPU_GETCW(fpcr) (fpcr = __builtin_aarch64_get_fpcr ())
 #  define _FPU_SETCW(fpcr) __builtin_aarch64_set_fpcr (fpcr)
+# elif __clang_major__ >= 4
+#  define _FPU_GETCW(fpcr) (fpcr = __builtin_arm_rsr ("fpcr"))
+#  define _FPU_SETCW(fpcr) __builtin_arm_wsr ("fpcr", fpcr)
 # else
 #  define _FPU_GETCW(fpcr) \
    __asm__ __volatile__ ("mrs %0, fpcr" : "=r" (fpcr))
@@ -143,9 +146,12 @@ x86_387_fenv_t;
    __asm__ __volatile__ ("msr fpcr, %0" : : "r" (fpcr))
 # endif
 
-# if __GNUC__ >= 6
+# if __GNUC__ >= 6 && !defined __clang__
 #  define _FPU_GETFPSR(fpsr) (fpsr = __builtin_aarch64_get_fpsr ())
 #  define _FPU_SETFPSR(fpsr) __builtin_aarch64_set_fpsr (fpsr)
+# elif __clang_major__ >= 4
+#  define _FPU_GETFPSR(fpsr) (fpsr = __builtin_arm_rsr ("fpsr"))
+#  define _FPU_SETFPSR(fpsr) __builtin_arm_wsr ("fpsr", fpsr)
 # else
 #  define _FPU_GETFPSR(fpsr) \
    __asm__ __volatile__ ("mrs %0, fpsr" : "=r" (fpsr))
index 91d2f15e571213874ffba76ba66b7cefb246b0f1..b69e3ec78847c7bed9c71541bc08e68b83004ba7 100644 (file)
@@ -61,9 +61,10 @@ _GL_INLINE_HEADER_BEGIN
    the same hamt.  This is non-trivial as different hamts may share
    some structure.
    We can define it only when the compiler supports _Atomic.  For GCC,
-   it is supported starting with GCC 4.9.  */
+   it is supported starting with GCC 4.9.  For clang, with clang 4.  */
 
-#if (__GNUC__ + (__GNUC_MINOR__ >= 9) > 4) \
+#if (__GNUC__ + (__GNUC_MINOR__ >= 9) > 4 && !defined __clang \
+     || __clang_major__ >= 4) \
     && __STDC_VERSION__ >= 201112L && !defined __STD_NO_ATOMICS__ \
     && !defined __cplusplus
 # define GL_HAMT_THREAD_SAFE 1
index b5ba8d7cbd25f4c9a40b8b979b859d54ca26ba25..2f13fc8dc148b67142f98751bc1d18f051cb6cb8 100644 (file)
@@ -21,7 +21,7 @@
 #include <limits.h>
 
 /* Pacify GCC 13.2 in some calls to _GL_EXPR_SIGNED.  */
-#if defined __GNUC__ && 4 < __GNUC__ + (3 <= __GNUC_MINOR__)
+#if 4 < __GNUC__ + (3 <= __GNUC_MINOR__) && !defined __clang__
 # pragma GCC diagnostic ignored "-Wtype-limits"
 #endif
 
 #if _GL_HAS_BUILTIN_MUL_OVERFLOW
 # if ((9 < __GNUC__ + (3 <= __GNUC_MINOR__) \
        || (__GNUC__ == 8 && 4 <= __GNUC_MINOR__)) \
-      && !defined __EDG__)
+      && !defined __clang__ && !defined __EDG__)
 #  define _GL_INT_MULTIPLY_WRAPV(a, b, r) __builtin_mul_overflow (a, b, r)
 # else
    /* Work around GCC bug 91450.  */
index db00627ee32a3c4d0797efbcef0722535de379ea..c2edef4e442462a4d629aed49ca5117b58c83d60 100644 (file)
@@ -162,7 +162,7 @@ clear_cache (void *start, void *end)
     : "d" (addr), "d" (len)
     : "%d0", "%d2", "%d3"
     );
-#elif (__GNUC__ + (__GNUC_MINOR__ >= 3) > 4) \
+#elif (__GNUC__ + (__GNUC_MINOR__ >= 3) > 4 && !defined __clang__) \
       || ((__clang_major__ + (__clang_minor__ >= 4) > 3) \
           && (defined __aarch64__ /* arm64 */ || defined __arm__))
   /* GCC >= 4.3 has a GCC built-in.
index a08f21fb84f1a6c7868b81792169c0a1022550ed..59e9c7b2e4bccecb3cdcd1e19bf8e5c2baf317ae 100644 (file)
@@ -147,7 +147,7 @@ _GL_FUNCDECL_RPL (memalign, void *,
 _GL_CXXALIAS_RPL (memalign, void *, (size_t alignment, size_t size));
 # else
 #  if @HAVE_MEMALIGN@
-#   if __GNUC__ >= 11
+#   if __GNUC__ >= 11 && !defined __clang__
 /* For -Wmismatched-dealloc: Associate memalign with free or rpl_free.  */
 #    if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2
 _GL_FUNCDECL_SYS (memalign, void *,
@@ -167,7 +167,7 @@ _GL_CXXALIAS_SYS (memalign, void *, (size_t alignment, size_t size));
 _GL_CXXALIASWARN (memalign);
 # endif
 #else
-# if __GNUC__ >= 11 && !defined memalign
+# if (__GNUC__ >= 11 && !defined __clang__) && !defined memalign
 /* For -Wmismatched-dealloc: Associate memalign with free or rpl_free.  */
 #  if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2
 _GL_FUNCDECL_SYS (memalign, void *,
index a4eea22b997c3306d0db819397f216ab7beab7c8..aec5ecb0a9e0ed415385d51698d009db1dc87ad3 100644 (file)
@@ -99,7 +99,7 @@
 #include <uchar.h>
 
 /* Pacify GCC re type limits.  */
-#if defined __GNUC__ && 4 < __GNUC__ + (3 <= __GNUC_MINOR__)
+#if 4 < __GNUC__ + (3 <= __GNUC_MINOR__) && !defined __clang__
 # pragma GCC diagnostic ignored "-Wtype-limits"
 #endif
 
index f3c537aa443e4c139dbea0bafbacc9c8d8085396..0ab778f6706a895bcce68866feabc96e52c2635e 100644 (file)
    maximum object size 9223372036854775807", caused by insufficient data flow
    analysis and value propagation of the 'width_add' expansion when GCC is not
    optimizing.  Cf. <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88443>.  */
-#if __GNUC__ >= 7 && !__OPTIMIZE__
+#if _GL_GNUC_PREREQ (7, 0) && !__OPTIMIZE__
 # pragma GCC diagnostic ignored "-Wstringop-overflow"
 #endif
 
index 3c4f97b146fa79f6aae9b3fa298b0e13eb69d34b..0938a094cb4c63c05c8288f4a38f32f0af7cfc8d 100644 (file)
 /* Size of the ut->ut_host member.  */
 #define UT_HOST_SIZE  sizeof (((struct UTMP_STRUCT_NAME *) 0)->ut_host)
 
-#if 8 <= __GNUC__
+#if _GL_GNUC_PREREQ (8, 0)
 # pragma GCC diagnostic ignored "-Wsizeof-pointer-memaccess"
 #endif
 
index 9ef0252ffff2c63684ba4b9af2b3d328c04f4bae..56a15e3551594c184b0811591f5ed9c1536cce13 100644 (file)
@@ -531,7 +531,8 @@ typedef struct
 # endif
 #endif
 
-#if defined __GNUC__ && 4 < __GNUC__ + (6 <= __GNUC_MINOR__)
+#if (defined __GNUC__ && 4 < __GNUC__ + (6 <= __GNUC_MINOR__) \
+     && !defined __clang__)
 # pragma GCC diagnostic push
 # pragma GCC diagnostic ignored "-Wvla"
 #endif
@@ -539,7 +540,7 @@ typedef struct
 #ifndef _Attr_access_
 # ifdef __attr_access
 #  define _Attr_access_(arg) __attr_access (arg)
-# elif defined __GNUC__ && 10 <= __GNUC__
+# elif defined __GNUC__ && 10 <= __GNUC__ && !defined __clang__
 #  define _Attr_access_(x) __attribute__ ((__access__ x))
 # else
 #  define _Attr_access_(x)
@@ -688,7 +689,8 @@ extern size_t regerror (int __errcode, const regex_t *_Restrict_ __preg,
 
 extern void regfree (regex_t *__preg);
 
-#if defined __GNUC__ && 4 < __GNUC__ + (6 <= __GNUC_MINOR__)
+#if (defined __GNUC__ && 4 < __GNUC__ + (6 <= __GNUC_MINOR__) \
+     && !defined __clang__)
 # pragma GCC diagnostic pop
 #endif
 
index 31906e6d57ad8069f8cabf8dba803df54c198534..2b49966562af61ea8787137d21fd08fc04391105 100644 (file)
@@ -195,7 +195,7 @@ typedef union
 # ifndef _GL_HAS_BUILTIN_UNREACHABLE
 #  if defined __clang_major__ && __clang_major__ < 5
 #   define _GL_HAS_BUILTIN_UNREACHABLE 0
-#  elif 4 < __GNUC__ + (5 <= __GNUC_MINOR__)
+#  elif 4 < __GNUC__ + (5 <= __GNUC_MINOR__) && !defined __clang__
 #   define _GL_HAS_BUILTIN_UNREACHABLE 1
 #  elif defined __has_builtin
 #   define _GL_HAS_BUILTIN_UNREACHABLE __has_builtin (__builtin_unreachable)
index 55bcb41d0ff1ea9289926f9280540a8ecc51a653..fc7b47f434aec9d9b259ec564a43e3e36738c355 100644 (file)
    that can be freed by passing them as the Ith argument to the
    function F.  */
 #ifndef _GL_ATTRIBUTE_DEALLOC
-# if __GNUC__ >= 11
+# if __GNUC__ >= 11 && !defined __clang__
 #  define _GL_ATTRIBUTE_DEALLOC(f, i) __attribute__ ((__malloc__ (f, i)))
 # else
 #  define _GL_ATTRIBUTE_DEALLOC(f, i)
@@ -371,7 +371,7 @@ _GL_CXXALIAS_RPL (fdopen, FILE *, (int fd, const char *mode));
 #  endif
 _GL_CXXALIAS_MDA (fdopen, FILE *, (int fd, const char *mode));
 # else
-#  if __GNUC__ >= 11
+#  if __GNUC__ >= 11 && !defined __clang__
 /* For -Wmismatched-dealloc: Associate fdopen with fclose or rpl_fclose.  */
 #   if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
 _GL_FUNCDECL_SYS (fdopen, FILE *,
@@ -390,7 +390,7 @@ _GL_CXXALIAS_SYS (fdopen, FILE *, (int fd, const char *mode));
 # endif
 _GL_CXXALIASWARN (fdopen);
 #else
-# if @GNULIB_FCLOSE@ && __GNUC__ >= 11 && !defined fdopen
+# if @GNULIB_FCLOSE@ && (__GNUC__ >= 11 && !defined __clang__) && !defined fdopen
 /* For -Wmismatched-dealloc: Associate fdopen with fclose or rpl_fclose.  */
 #  if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
 _GL_FUNCDECL_SYS (fdopen, FILE *,
@@ -519,7 +519,7 @@ _GL_FUNCDECL_RPL (fopen, FILE *,
 _GL_CXXALIAS_RPL (fopen, FILE *,
                   (const char *restrict filename, const char *restrict mode));
 # else
-#  if __GNUC__ >= 11
+#  if __GNUC__ >= 11 && !defined __clang__
 /* For -Wmismatched-dealloc: Associate fopen with fclose or rpl_fclose.  */
 _GL_FUNCDECL_SYS (fopen, FILE *,
                   (const char *restrict filename, const char *restrict mode)
@@ -532,7 +532,7 @@ _GL_CXXALIAS_SYS (fopen, FILE *,
 _GL_CXXALIASWARN (fopen);
 # endif
 #else
-# if @GNULIB_FCLOSE@ && __GNUC__ >= 11 && !defined fopen
+# if @GNULIB_FCLOSE@ && (__GNUC__ >= 11 && !defined __clang__) && !defined fopen
 /* For -Wmismatched-dealloc: Associate fopen with fclose or rpl_fclose.  */
 _GL_FUNCDECL_SYS (fopen, FILE *,
                   (const char *restrict filename, const char *restrict mode)
@@ -1176,7 +1176,7 @@ _GL_FUNCDECL_RPL (popen, FILE *,
                   _GL_ATTRIBUTE_MALLOC);
 _GL_CXXALIAS_RPL (popen, FILE *, (const char *cmd, const char *mode));
 # else
-#  if !@HAVE_POPEN@ || __GNUC__ >= 11
+#  if !@HAVE_POPEN@ || (__GNUC__ >= 11 && !defined __clang__)
 _GL_FUNCDECL_SYS (popen, FILE *,
                   (const char *cmd, const char *mode)
                   _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (pclose, 1)
@@ -1186,7 +1186,8 @@ _GL_CXXALIAS_SYS (popen, FILE *, (const char *cmd, const char *mode));
 # endif
 _GL_CXXALIASWARN (popen);
 #else
-# if @GNULIB_PCLOSE@ && __GNUC__ >= 11 && !defined popen
+# if @GNULIB_PCLOSE@ \
+     && (__GNUC__ >= 11 && !defined __clang__) && !defined popen
 /* For -Wmismatched-dealloc: Associate popen with pclose or rpl_pclose.  */
 _GL_FUNCDECL_SYS (popen, FILE *,
                   (const char *cmd, const char *mode)
@@ -1533,7 +1534,7 @@ _GL_FUNCDECL_RPL (tmpfile, FILE *, (void)
                                    _GL_ATTRIBUTE_MALLOC);
 _GL_CXXALIAS_RPL (tmpfile, FILE *, (void));
 # else
-#  if __GNUC__ >= 11
+#  if __GNUC__ >= 11 && !defined __clang__
 /* For -Wmismatched-dealloc: Associate tmpfile with fclose or rpl_fclose.  */
 _GL_FUNCDECL_SYS (tmpfile, FILE *, (void)
                                    _GL_ATTRIBUTE_DEALLOC (fclose, 1)
@@ -1545,7 +1546,8 @@ _GL_CXXALIAS_SYS (tmpfile, FILE *, (void));
 _GL_CXXALIASWARN (tmpfile);
 # endif
 #else
-# if @GNULIB_FCLOSE@ && __GNUC__ >= 11 && !defined tmpfile
+# if @GNULIB_FCLOSE@ \
+     && (__GNUC__ >= 11 && !defined __clang__) && !defined tmpfile
 /* For -Wmismatched-dealloc: Associate tmpfile with fclose or rpl_fclose.  */
 _GL_FUNCDECL_SYS (tmpfile, FILE *, (void)
                                    _GL_ATTRIBUTE_DEALLOC (fclose, 1)
index cbdbbd3472106348a6c78f708ab9f7396a021eb2..637da4e32c04dbbb1749819a8d9d7cc2debe127d 100644 (file)
@@ -132,7 +132,7 @@ struct random_data
    that can be freed by passing them as the Ith argument to the
    function F.  */
 #ifndef _GL_ATTRIBUTE_DEALLOC
-# if __GNUC__ >= 11
+# if __GNUC__ >= 11 && !defined __clang__
 #  define _GL_ATTRIBUTE_DEALLOC(f, i) __attribute__ ((__malloc__ (f, i)))
 # else
 #  define _GL_ATTRIBUTE_DEALLOC(f, i)
@@ -279,7 +279,7 @@ _GL_FUNCDECL_RPL (aligned_alloc, void *,
 _GL_CXXALIAS_RPL (aligned_alloc, void *, (size_t alignment, size_t size));
 # else
 #  if @HAVE_ALIGNED_ALLOC@
-#   if __GNUC__ >= 11
+#   if __GNUC__ >= 11 && !defined __clang__
 /* For -Wmismatched-dealloc: Associate aligned_alloc with free or rpl_free.  */
 #    if __GLIBC__ + (__GLIBC_MINOR__ >= 16) > 2
 _GL_FUNCDECL_SYS (aligned_alloc, void *,
@@ -299,7 +299,8 @@ _GL_CXXALIAS_SYS (aligned_alloc, void *, (size_t alignment, size_t size));
 _GL_CXXALIASWARN (aligned_alloc);
 # endif
 #else
-# if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined aligned_alloc
+# if @GNULIB_FREE_POSIX@ \
+     && (__GNUC__ >= 11 && !defined __clang__) && !defined aligned_alloc
 /* For -Wmismatched-dealloc: Associate aligned_alloc with free or rpl_free.  */
 #  if __GLIBC__ + (__GLIBC_MINOR__ >= 16) > 2
 _GL_FUNCDECL_SYS (aligned_alloc, void *,
@@ -351,7 +352,7 @@ _GL_FUNCDECL_RPL (calloc, void *,
                   _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
 _GL_CXXALIAS_RPL (calloc, void *, (size_t nmemb, size_t size));
 # else
-#  if __GNUC__ >= 11
+#  if __GNUC__ >= 11 && !defined __clang__
 /* For -Wmismatched-dealloc: Associate calloc with free or rpl_free.  */
 #   if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2
 _GL_FUNCDECL_SYS (calloc, void *,
@@ -370,7 +371,8 @@ _GL_CXXALIAS_SYS (calloc, void *, (size_t nmemb, size_t size));
 _GL_CXXALIASWARN (calloc);
 # endif
 #else
-# if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined calloc
+# if @GNULIB_FREE_POSIX@ \
+     && (__GNUC__ >= 11 && !defined __clang__) && !defined calloc
 /* For -Wmismatched-dealloc: Associate calloc with free or rpl_free.  */
 #  if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2
 _GL_FUNCDECL_SYS (calloc, void *,
@@ -402,7 +404,7 @@ _GL_FUNCDECL_RPL (canonicalize_file_name, char *,
                   _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
 _GL_CXXALIAS_RPL (canonicalize_file_name, char *, (const char *name));
 # else
-#  if !@HAVE_CANONICALIZE_FILE_NAME@ || __GNUC__ >= 11
+#  if !@HAVE_CANONICALIZE_FILE_NAME@ || (__GNUC__ >= 11 && !defined __clang__)
 #   if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
 _GL_FUNCDECL_SYS (canonicalize_file_name, char *,
                   (const char *name)
@@ -424,7 +426,8 @@ _GL_CXXALIAS_SYS (canonicalize_file_name, char *, (const char *name));
 # endif
 _GL_CXXALIASWARN (canonicalize_file_name);
 #else
-# if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined canonicalize_file_name
+# if @GNULIB_FREE_POSIX@ \
+     && (__GNUC__ >= 11 && !defined __clang__) && !defined canonicalize_file_name
 /* For -Wmismatched-dealloc: Associate canonicalize_file_name with free or
    rpl_free.  */
 #  if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
@@ -658,7 +661,7 @@ _GL_FUNCDECL_RPL (malloc, void *,
                   _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
 _GL_CXXALIAS_RPL (malloc, void *, (size_t size));
 # else
-#  if __GNUC__ >= 11
+#  if __GNUC__ >= 11 && !defined __clang__
 /* For -Wmismatched-dealloc: Associate malloc with free or rpl_free.  */
 #   if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2
 _GL_FUNCDECL_SYS (malloc, void *,
@@ -677,7 +680,8 @@ _GL_CXXALIAS_SYS (malloc, void *, (size_t size));
 _GL_CXXALIASWARN (malloc);
 # endif
 #else
-# if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined malloc
+# if @GNULIB_FREE_POSIX@ \
+     && (__GNUC__ >= 11 && !defined __clang__) && !defined malloc
 /* For -Wmismatched-dealloc: Associate malloc with free or rpl_free.  */
 #  if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2
 _GL_FUNCDECL_SYS (malloc, void *,
@@ -1420,7 +1424,7 @@ _GL_FUNCDECL_RPL (realloc, void *, (void *ptr, size_t size)
                                    _GL_ATTRIBUTE_DEALLOC_FREE);
 _GL_CXXALIAS_RPL (realloc, void *, (void *ptr, size_t size));
 # else
-#  if __GNUC__ >= 11
+#  if __GNUC__ >= 11 && !defined __clang__
 /* For -Wmismatched-dealloc: Associate realloc with free or rpl_free.  */
 #   if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2
 _GL_FUNCDECL_SYS (realloc, void *,
@@ -1439,7 +1443,8 @@ _GL_CXXALIAS_SYS (realloc, void *, (void *ptr, size_t size));
 _GL_CXXALIASWARN (realloc);
 # endif
 #else
-# if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined realloc
+# if @GNULIB_FREE_POSIX@ \
+     && (__GNUC__ >= 11 && !defined __clang__) && !defined realloc
 /* For -Wmismatched-dealloc: Associate realloc with free or rpl_free.  */
 #  if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2
 _GL_FUNCDECL_SYS (realloc, void *,
index 613d0337d5f58c7866082a1705930d4e16aa3768..903ba6e76e807c7ea62fbeba00b691942148b72f 100644 (file)
@@ -79,7 +79,7 @@
    that can be freed by passing them as the Ith argument to the
    function F.  */
 #ifndef _GL_ATTRIBUTE_DEALLOC
-# if __GNUC__ >= 11
+# if __GNUC__ >= 11 && !defined __clang__
 #  define _GL_ATTRIBUTE_DEALLOC(f, i) __attribute__ ((__malloc__ (f, i)))
 # else
 #  define _GL_ATTRIBUTE_DEALLOC(f, i)
@@ -621,7 +621,8 @@ _GL_CXXALIAS_MDA (strdup, char *, (char const *__s));
     /* strdup exists as a function and as a macro.  Get rid of the macro.  */
 #   undef strdup
 #  endif
-#  if (!@HAVE_DECL_STRDUP@ || __GNUC__ >= 11) && !defined strdup
+#  if (!@HAVE_DECL_STRDUP@ || (__GNUC__ >= 11 && !defined __clang__)) \
+      && !defined strdup
 #   if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
 _GL_FUNCDECL_SYS (strdup, char *,
                   (char const *__s)
@@ -639,7 +640,7 @@ _GL_CXXALIAS_SYS (strdup, char *, (char const *__s));
 # endif
 _GL_CXXALIASWARN (strdup);
 #else
-# if __GNUC__ >= 11 && !defined strdup
+# if (__GNUC__ >= 11 && !defined __clang__) && !defined strdup
 /* For -Wmismatched-dealloc: Associate strdup with free or rpl_free.  */
 #  if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
 _GL_FUNCDECL_SYS (strdup, char *,
@@ -720,7 +721,8 @@ _GL_FUNCDECL_RPL (strndup, char *,
                   _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
 _GL_CXXALIAS_RPL (strndup, char *, (char const *__s, size_t __n));
 # else
-#  if !@HAVE_DECL_STRNDUP@ || (__GNUC__ >= 11 && !defined strndup)
+#  if !@HAVE_DECL_STRNDUP@ \
+      || ((__GNUC__ >= 11 && !defined __clang__) && !defined strndup)
 #   if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
 _GL_FUNCDECL_SYS (strndup, char *,
                   (char const *__s, size_t __n)
@@ -738,7 +740,7 @@ _GL_CXXALIAS_SYS (strndup, char *, (char const *__s, size_t __n));
 # endif
 _GL_CXXALIASWARN (strndup);
 #else
-# if __GNUC__ >= 11 && !defined strndup
+# if (__GNUC__ >= 11 && !defined __clang__) && !defined strndup
 /* For -Wmismatched-dealloc: Associate strndup with free or rpl_free.  */
 #  if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
 _GL_FUNCDECL_SYS (strndup, char *,
index 978926a4918a39293184eb5423f1101af1368bcd..49a73c050888146a67ec4d4d1c04882555283a76 100644 (file)
 #ifndef __cplusplus
 # if (201112 <= __STDC_VERSION__ \
       || (!defined __STRICT_ANSI__ \
-          && (4 < __GNUC__ + (6 <= __GNUC_MINOR__) || 5 <= __clang_major__)))
+          && ((4 < __GNUC__ + (6 <= __GNUC_MINOR__) && !defined __clang__) \
+              || 5 <= __clang_major__)))
 #  define _GL_HAVE__STATIC_ASSERT 1
 # endif
 # if (202311 <= __STDC_VERSION__ \
-      || (!defined __STRICT_ANSI__ && 9 <= __GNUC__))
+      || (!defined __STRICT_ANSI__ && 9 <= __GNUC__ && !defined __clang__))
 #  define _GL_HAVE__STATIC_ASSERT1 1
 # endif
 #endif
@@ -215,7 +216,7 @@ template <int w>
 # define _GL_VERIFY(R, DIAGNOSTIC, ...) \
     extern int (*_GL_GENSYM (_gl_verify_function) (void)) \
       [_GL_VERIFY_TRUE (R, DIAGNOSTIC)]
-# if 4 < __GNUC__ + (6 <= __GNUC_MINOR__)
+# if 4 < __GNUC__ + (6 <= __GNUC_MINOR__) && !defined __clang__
 #  pragma GCC diagnostic ignored "-Wnested-externs"
 # endif
 #endif
@@ -305,7 +306,7 @@ template <int w>
 #ifndef _GL_HAS_BUILTIN_UNREACHABLE
 # if defined __clang_major__ && __clang_major__ < 5
 #  define _GL_HAS_BUILTIN_UNREACHABLE 0
-# elif 4 < __GNUC__ + (5 <= __GNUC_MINOR__)
+# elif 4 < __GNUC__ + (5 <= __GNUC_MINOR__) && !defined __clang__
 #  define _GL_HAS_BUILTIN_UNREACHABLE 1
 # elif defined __has_builtin
 #  define _GL_HAS_BUILTIN_UNREACHABLE __has_builtin (__builtin_unreachable)
index 4dcc422a926be5031c412b28dd7979964304896d..6bbc31da8847f8583b4d032cd9889952f6008de2 100644 (file)
@@ -95,7 +95,7 @@
    that can be freed by passing them as the Ith argument to the
    function F.  */
 #ifndef _GL_ATTRIBUTE_DEALLOC
-# if __GNUC__ >= 11
+# if __GNUC__ >= 11 && !defined __clang__
 #  define _GL_ATTRIBUTE_DEALLOC(f, i) __attribute__ ((__malloc__ (f, i)))
 # else
 #  define _GL_ATTRIBUTE_DEALLOC(f, i)
@@ -1326,7 +1326,8 @@ _GL_CXXALIAS_MDA (wcsdup, wchar_t *, (const wchar_t *s));
 /* On Solaris 11.3, the header files declare the function in the std::
    namespace, not in the global namespace.  So, force a declaration in
    the global namespace.  */
-#  if !@HAVE_WCSDUP@ || (defined __sun && defined __cplusplus) || __GNUC__ >= 11
+#  if !@HAVE_WCSDUP@ || (defined __sun && defined __cplusplus) \
+      || (__GNUC__ >= 11 && !defined __clang__)
 #   if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
 _GL_FUNCDECL_SYS (wcsdup, wchar_t *,
                   (const wchar_t *s)
@@ -1342,7 +1343,7 @@ _GL_CXXALIAS_SYS (wcsdup, wchar_t *, (const wchar_t *s));
 # endif
 _GL_CXXALIASWARN (wcsdup);
 #else
-# if __GNUC__ >= 11 && !defined wcsdup
+# if (__GNUC__ >= 11 && !defined __clang__) && !defined wcsdup
 /* For -Wmismatched-dealloc: Associate wcsdup with free or rpl_free.  */
 #  if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
 _GL_FUNCDECL_SYS (wcsdup, wchar_t *,
index 0b7bb2cee85ae0845b413598f4b33ffd70bfab16..50272ec084c1739e69ff7114fa511678ed3e8818 100644 (file)
@@ -48,7 +48,8 @@
 #if 7 <= __GNUC__ && !defined __clang__ && PTRDIFF_MAX < SIZE_MAX
 # define xalloc_oversized(n, s) \
    __builtin_mul_overflow_p (n, s, (ptrdiff_t) 1)
-#elif 5 <= __GNUC__ && !defined __ICC && PTRDIFF_MAX < SIZE_MAX
+#elif 5 <= __GNUC__ && !defined __clang__ && !defined __ICC \
+      && PTRDIFF_MAX < SIZE_MAX
 # define xalloc_oversized(n, s) \
    (__builtin_constant_p (n) && __builtin_constant_p (s) \
     ? __xalloc_oversized (n, s) \
index 10d6bcf5c42cf1b326e660c226ba7d285e67a35d..1d5da0f801c4d626c64053400f44850575e083ae 100644 (file)
@@ -1,4 +1,4 @@
-# gnulib-common.m4 serial 89.5
+# gnulib-common.m4 serial 89.6
 dnl Copyright (C) 2007-2024 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -1102,7 +1102,7 @@ AC_DEFUN([gl_CC_GNULIB_WARNINGS],
     dnl -Wno-unused-parameter                 >= 3            >= 3.9
     dnl
     cat > conftest.c <<\EOF
-      #if __GNUC__ >= 3 || (__clang_major__ + (__clang_minor__ >= 9) > 3)
+      #if (__GNUC__ >= 3 && !defined __clang__) || (__clang_major__ + (__clang_minor__ >= 9) > 3)
       -Wno-cast-qual
       -Wno-conversion
       -Wno-float-equal
@@ -1111,23 +1111,23 @@ AC_DEFUN([gl_CC_GNULIB_WARNINGS],
       -Wno-unused-function
       -Wno-unused-parameter
       #endif
-      #if __GNUC__ + (__GNUC_MINOR__ >= 9) > 4 || (__clang_major__ + (__clang_minor__ >= 9) > 3)
+      #if (__GNUC__ + (__GNUC_MINOR__ >= 9) > 4 && !defined __clang__) || (__clang_major__ + (__clang_minor__ >= 9) > 3)
       -Wno-float-conversion
       #endif
-      #if __GNUC__ >= 7 || (__clang_major__ + (__clang_minor__ >= 9) > 3)
+      #if (__GNUC__ >= 7 && !defined __clang__) || (__clang_major__ + (__clang_minor__ >= 9) > 3)
       -Wimplicit-fallthrough
       #endif
-      #if __GNUC__ + (__GNUC_MINOR__ >= 8) > 4 || (__clang_major__ + (__clang_minor__ >= 9) > 3)
+      #if (__GNUC__ + (__GNUC_MINOR__ >= 8) > 4 && !defined __clang__) || (__clang_major__ + (__clang_minor__ >= 9) > 3)
       -Wno-pedantic
       #endif
       #if 3 < __clang_major__ + (9 <= __clang_minor__)
       -Wno-tautological-constant-out-of-range-compare
       #endif
-      #if __GNUC__ + (__GNUC_MINOR__ >= 3) > 4 || (__clang_major__ + (__clang_minor__ >= 9) > 3)
+      #if (__GNUC__ + (__GNUC_MINOR__ >= 3) > 4 && !defined __clang__) || (__clang_major__ + (__clang_minor__ >= 9) > 3)
       -Wno-sign-conversion
       -Wno-type-limits
       #endif
-      #if __GNUC__ + (__GNUC_MINOR__ >= 5) > 4
+      #if (__GNUC__ + (__GNUC_MINOR__ >= 5) > 4 && !defined __clang__)
       -Wno-unsuffixed-float-constants
       #endif
 EOF
index e0c5d88ad4f17cb16201e4ba073a893afbbb0b9d..5da77fba58fb63a660887f157a366acf2cb6e89b 100644 (file)
@@ -44,7 +44,7 @@
 #include <config.h>
 
 /* Work around GCC bug 44511.  */
-#if 4 < __GNUC__ + (3 <= __GNUC_MINOR__)
+#if _GL_GNUC_PREREQ (4, 3)
 # pragma GCC diagnostic ignored "-Wreturn-type"
 #endif
 
index 6532d16238f70ac5158d0189e44dee1c42b76068..6be1aead1ef14ec72f87a4c94dc4a51dd1c978ac 100644 (file)
@@ -44,7 +44,7 @@
 #include <config.h>
 
 /* Work around GCC bug 44511.  */
-#if 4 < __GNUC__ + (3 <= __GNUC_MINOR__)
+#if _GL_GNUC_PREREQ (4, 3)
 # pragma GCC diagnostic ignored "-Wreturn-type"
 #endif
 
index e0d63d474134b9f995a8912a5c564820c9c82561..faf219264b3644d3ac2910a4bd056bbaf9e617f4 100644 (file)
 
 /* Written by Paul Eggert.  */
 
+#include <config.h>
+
+#if _GL_GNUC_PREREQ (4, 3)
+
 /* Tell gcc not to warn about the long expressions that the overflow
    macros expand to, or about the (X < 0) expressions.  */
-#if 4 < __GNUC__ + (3 <= __GNUC_MINOR__)
 # pragma GCC diagnostic ignored "-Woverlength-strings"
 # pragma GCC diagnostic ignored "-Wtype-limits"
 
@@ -28,8 +31,6 @@
 
 #endif
 
-#include <config.h>
-
 #ifdef TEST_STDCKDINT
 # include <stdckdint.h>
 #else
index 6f574c88a01c26ecfead837740590f3e3e76780e..885fe1f017c60fb3d2603ac0a5c85509bf107841 100644 (file)
@@ -20,7 +20,7 @@
 
 #include <limits.h>
 
-#if 4 < __GNUC__ + (3 <= __GNUC_MINOR__)
+#if _GL_GNUC_PREREQ (4, 3)
 # pragma GCC diagnostic ignored "-Woverlength-strings"
 #endif
 
index 0dde27ddf67a8ec23740a20b7012a476139241e9..d2b5517f14eb7878c2cfdff93272ecd1573d2fe5 100644 (file)
@@ -28,7 +28,7 @@ SIGNATURE_CHECK (memrchr, void *, (void const *, int, size_t));
 #include "macros.h"
 
 /* Work around GCC bug 101494.  */
-#if 4 < __GNUC__ + (7 <= __GNUC_MINOR__) && __GNUC__ < 12
+#if _GL_GNUC_PREREQ (4, 7) && __GNUC__ < 12
 # pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
 #endif
 
index b7e16fccceeec6ccc3e1ff36684b7ab6ee25a853..2325ee91d65a64cd777c651fbda1a466e95add4d 100644 (file)
@@ -19,7 +19,7 @@
 #include <config.h>
 
 /* Work around GCC bug 44511.  */
-#if 4 < __GNUC__ + (3 <= __GNUC_MINOR__)
+#if _GL_GNUC_PREREQ (4, 3)
 # pragma GCC diagnostic ignored "-Wreturn-type"
 #endif
 
index d565aa03827b3514fd1a190301f81f10e79ff5de..567a289fa9c345e171883ada083cc67f131ac59d 100644 (file)
@@ -19,7 +19,7 @@
 #include <config.h>
 
 /* Work around GCC bug 44511.  */
-#if 4 < __GNUC__ + (3 <= __GNUC_MINOR__)
+#if _GL_GNUC_PREREQ (4, 3)
 # pragma GCC diagnostic ignored "-Wreturn-type"
 #endif
 
index cbd057f94f6d080e8334713b3ec4106155b4b179..cc504812d627acea168ccecf6a371ca53b43da41 100644 (file)
@@ -19,7 +19,7 @@
 #include <config.h>
 
 /* Work around GCC bug 44511.  */
-#if 4 < __GNUC__ + (3 <= __GNUC_MINOR__)
+#if _GL_GNUC_PREREQ (4, 3)
 # pragma GCC diagnostic ignored "-Wreturn-type"
 #endif
 
index a093caeeb31fad6f19633f5ad22c85407ca166a2..0576f8f20487fa0ba0b5d8f22202db3c0cfa47e6 100644 (file)
@@ -18,7 +18,7 @@
 
 #include "openat.h"
 
-#if 4 < __GNUC__ + (3 <= __GNUC_MINOR__)
+#if _GL_GNUC_PREREQ (4, 3)
 # pragma GCC diagnostic ignored "-Wdeprecated-declarations"
 #endif
 
index 8202bd31d6035fcb5f695d168d90f1f9355f7424..b30b35ddc22a70716c529cb9927f0d1c8bc62e9b 100644 (file)
 
 /* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
 
+#include <config.h>
+
 /* Tell GCC not to warn about the specific edge cases tested here.  */
-#if (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) || 4 < __GNUC__
+#if _GL_GNUC_PREREQ (4, 3)
 # pragma GCC diagnostic ignored "-Wformat-zero-length"
 # pragma GCC diagnostic ignored "-Wformat-nonliteral"
 # pragma GCC diagnostic ignored "-Wformat-security"
 #endif
 
-#include <config.h>
-
 #include "xvasprintf.h"
 
 #include <stdarg.h>