[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: use of __STDC_VERSION__ > foo in config.h
From: |
Akim Demaille |
Subject: |
Re: use of __STDC_VERSION__ > foo in config.h |
Date: |
Fri, 11 May 2012 09:06:22 +0200 |
Le 10 mai 2012 à 18:08, Paul Eggert a écrit :
> The general idea that config.h should work with -Wundef is OK
> <http://lists.gnu.org/archive/html/bug-gnulib/2011-11/msg00308.html>
> but I see a couple of problems with the proposed patch.
> First, the logic is wrong, as it assumes that when
> __STDC_VERSION__ is not defined then the compiler supports C11,
> whereas a better heuristic (these days, anyway) is that the compiler
> does not support C11. Second, there shouldn't be a need to alter
> the code if it's an Apple compiler, since the problem has been
> reported only for GCC. So I pushed this smaller patch instead:
You are right, thanks!
> _Noreturn: port config.h to gcc -Wundef
> * m4/gnulib-common.m4 (gl_COMMON_BODY): Check that __STDC_VERSION__ is
> defined before using it, for gcc -Wundef. Reported by Akim Demaille in
> <http://lists.gnu.org/archive/html/bug-gnulib/2012-05/msg00147.html>.
> diff --git a/m4/gnulib-common.m4 b/m4/gnulib-common.m4
> index ab3c43d..d62b767 100644
> --- a/m4/gnulib-common.m4
> +++ b/m4/gnulib-common.m4
> @@ -14,7 +14,8 @@ AC_DEFUN([gl_COMMON], [
> AC_DEFUN([gl_COMMON_BODY], [
> AH_VERBATIM([_Noreturn],
> [/* The _Noreturn keyword of C11. */
> -#if !defined _Noreturn && __STDC_VERSION__ < 201112
> +#if ! (defined _Noreturn \
> + || (defined __STDC_VERSION__ && 201112 <= __STDC_VERSION__))
> # if (3 <= __GNUC__ || (__GNUC__ == 2 && 8 <= __GNUC_MINOR__) \
> || 0x5110 <= __SUNPRO_C)
> # define _Noreturn __attribute__ ((__noreturn__))