bison-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: gnulib: update, and use the attribute module


From: Akim Demaille
Subject: Re: gnulib: update, and use the attribute module
Date: Sun, 10 May 2020 10:47:46 +0200

Hi Paul,

> Le 9 mai 2020 à 22:32, Paul Eggert <address@hidden> a écrit :
> 
> On 5/9/20 12:04 AM, Akim Demaille wrote:
> 
>> +#include <stdnoreturn.h>
> 
> This shouldn't be needed, since you're '_Noreturn' not 'noreturn' (and there's
> good reason to avoid 'noreturn').

Thanks!  I'm installing this.

commit b61bf2f0e8bdc1e522ae8e97d57d5625163b42ea
Author: Akim Demaille <address@hidden>
Date:   Sun May 10 10:42:35 2020 +0200

    don't use stdnoreturn
    
    Reported by Paul Eggert.
    
    * src/getargs.c: We don't need it anyway, since we use _Noreturn.
    * data/skeletons/c.m4: While at it, update the definition of _Noreturn
    stolen from gnulib.

diff --git a/data/skeletons/c.m4 b/data/skeletons/c.m4
index 3c6daef2..f2d7b32f 100644
--- a/data/skeletons/c.m4
+++ b/data/skeletons/c.m4
@@ -359,11 +359,21 @@ m4_define([b4_attribute_define],
 [#ifndef _Noreturn
 # if (defined __cplusplus \
       && ((201103 <= __cplusplus && !(__GNUC__ == 4 && __GNUC_MINOR__ == 7)) \
-          || (defined _MSC_VER && 1900 <= _MSC_VER)))
+          || (defined _MSC_VER && 1900 <= _MSC_VER)) \
+      && 0)
+    /* [[noreturn]] is not practically usable, because with it the syntax
+         extern _Noreturn void func (...);
+       would not be valid; such a declaration would only be valid with 'extern'
+       and '_Noreturn' swapped, or without the 'extern' keyword.  However, some
+       AIX system header files and several gnulib header files use precisely
+       this syntax with 'extern'.  */
 #  define _Noreturn [[noreturn]]
-# elif ((!defined __cplusplus || defined __clang__) \
+# elif ((!defined __cplusplus || defined __clang__)                     \
         && (201112 <= (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0)  \
-            || 4 < __GNUC__ + (7 <= __GNUC_MINOR__)))
+            || 4 < __GNUC__ + (7 <= __GNUC_MINOR__) \
+            || (defined __apple_build_version__ \
+                ? 6000000 <= __apple_build_version__ \
+                : 3 < __clang_major__ + (5 <= __clang_minor__))))
    /* _Noreturn works as-is.  */
 # elif 2 < __GNUC__ + (8 <= __GNUC_MINOR__) || 0x5110 <= __SUNPRO_C
 #  define _Noreturn __attribute__ ((__noreturn__))
diff --git a/src/getargs.c b/src/getargs.c
index 74474704..4815eaa2 100644
--- a/src/getargs.c
+++ b/src/getargs.c
@@ -30,7 +30,6 @@
 #include <getopt.h>
 #include <progname.h>
 #include <quote.h>
-#include <stdnoreturn.h>
 #include <textstyle.h>
 
 #include "complain.h"




reply via email to

[Prev in Thread] Current Thread [Next in Thread]