From 0293280d1c3c2eeb1e0d7022eb11e24a96e87b99 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Mon, 14 Aug 2023 02:51:01 +0200 Subject: [PATCH] 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. --- ChangeLog | 6 ++++++ m4/stdint.m4 | 7 +++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5e7683c1a5..3b46b05de4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2023-08-13 Bruno Haible + + 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 Fix some test module descriptions. diff --git a/m4/stdint.m4 b/m4/stdint.m4 index d6961b0993..b9f764d4c1 100644 --- a/m4/stdint.m4 +++ b/m4/stdint.m4 @@ -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__)) -- 2.39.5