]> Savannah Git Hosting - gnulib.git/commitdiff
stdint: Fix configure test result with gcc 4.7 or 4.8.
authorBruno Haible <bruno@clisp.org>
Mon, 14 Aug 2023 00:51:01 +0000 (02:51 +0200)
committerBruno Haible <bruno@clisp.org>
Wed, 16 Aug 2023 17:35:07 +0000 (19:35 +0200)
* m4/stdint.m4 (gl_STDINT_H): Don't assume that _Generic works with
GCC versions < 4.9 with -std=gnu11.

ChangeLog
m4/stdint.m4

index 5e7683c1a590985fbe55432cf6c45b27edc4fac2..3b46b05de49f6e592ba10f6308cf5c5b186640fa 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2023-08-13  Bruno Haible  <bruno@clisp.org>
+
+       stdint: Fix configure test result with gcc 4.7 or 4.8.
+       * m4/stdint.m4 (gl_STDINT_H): Don't assume that _Generic works with
+       GCC versions < 4.9 with -std=gnu11.
+
 2023-08-13  Bruno Haible  <bruno@clisp.org>
 
        Fix some test module descriptions.
index d6961b0993ec4fd5f7cf9937f7fc920d5e48d7cc..b9f764d4c1ca3700e6464bc067e38720130355c4 100644 (file)
@@ -1,4 +1,4 @@
-# stdint.m4 serial 61
+# stdint.m4 serial 62
 dnl Copyright (C) 2001-2023 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -150,7 +150,10 @@ intmax_t i = INTMAX_MAX;
 uintmax_t j = UINTMAX_MAX;
 
 /* Check that SIZE_MAX has the correct type, if possible.  */
-#if 201112 <= __STDC_VERSION__
+/* ISO C 11 mandates _Generic, but GCC versions < 4.9 lack it.  */
+#if 201112 <= __STDC_VERSION__ \
+    && (!defined __GNUC__ || 4 < __GNUC__ + (9 <= __GNUC_MINOR__) \
+        || defined __clang__)
 int k = _Generic (SIZE_MAX, size_t: 0);
 #elif (2 <= __GNUC__ || 4 <= __clang_major__ || defined __IBM__TYPEOF__ \
        || (0x5110 <= __SUNPRO_C && !__STDC__))