[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: GLR causing warning about _Noreturn in C99
From: |
Akim Demaille |
Subject: |
Re: GLR causing warning about _Noreturn in C99 |
Date: |
Tue, 12 Jan 2021 14:15:09 +0100 |
Hi Joe,
> Le 12 janv. 2021 à 00:59, Joe Nelson <joe@begriffs.com> a écrit :
>
> Joe Nelson wrote:
>> Ah, in that case I'll report the bug upstream in gnulib. When they fix
>> it we can copy their updated code.
>
> OK, they fixed the bug in gnulib:
>
> https://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=commit;h=077ffc1e416a6be980dd45979547201e572962f6
>
> Here's the updated _Noreturn.h (notice how they now check
> __STRICT_ANSI__):
>
> https://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=blob;f=lib/_Noreturn.h;h=cb72f2620604406c9552d7bb5f8ffe578a3aadef;hb=077ffc1e416a6be980dd45979547201e572962f6
I adjusted this patch for Bison. Could you please try this tarball before I
install the appended patch into master? Thanks in advance.
Cheers!
https://www.lrde.epita.fr/~akim/private/bison/bison-3.7.4.256-1c00e.tar.gz
https://www.lrde.epita.fr/~akim/private/bison/bison-3.7.4.256-1c00e.tar.lz
https://www.lrde.epita.fr/~akim/private/bison/bison-3.7.4.256-1c00e.tar.xz
commit e70df34a35e2548d76ee0ab3f548ccb45fcc3253
Author: Akim Demaille <akim.demaille@gmail.com>
Date: Tue Jan 12 06:28:13 2021 +0100
c: adjust _Noreturn to pedantic clang
Reported by Joe Nelson <joe@begriffs.com>.
https://lists.gnu.org/r/help-bison/2021-01/msg00004.html
Fixed by Paul Eggert in gnulib.
https://lists.gnu.org/r/bug-gnulib/2021-01/msg00156.html
* data/skeletons/c.m4 (b4_attribute_define): Adjust _Noreturn to
pedantic clang.
diff --git a/data/skeletons/c.m4 b/data/skeletons/c.m4
index ed2c762c..4391dbc2 100644
--- a/data/skeletons/c.m4
+++ b/data/skeletons/c.m4
@@ -378,14 +378,16 @@ dnl use C' _Noreturn in C++, to avoid -Wc11-extensions
warnings.
&& ((201103 <= __cplusplus && !(__GNUC__ == 4 && __GNUC_MINOR__ == 7)) \
|| (defined _MSC_VER && 1900 <= _MSC_VER)))
# define _Noreturn [[noreturn]]
-# elif (!defined __cplusplus \
- && (201112 <= (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) \
- || 4 < __GNUC__ + (7 <= __GNUC_MINOR__) \
- || (defined __apple_build_version__ \
- ? 6000000 <= __apple_build_version__ \
- : 3 < __clang_major__ + (5 <= __clang_minor__))))
+# elif ((!defined __cplusplus || defined __clang__) \
+ && (201112 <= (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) \
+ || (!defined __STRICT_ANSI__ \
+ && (__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
+# elif (2 < __GNUC__ + (8 <= __GNUC_MINOR__) || defined __clang__ \
+ || 0x5110 <= __SUNPRO_C)
# define _Noreturn __attribute__ ((__noreturn__))
# elif 1200 <= (defined _MSC_VER ? _MSC_VER : 0)
# define _Noreturn __declspec (noreturn)