From bd7aebb8b002f0706bfa771f22c01f243fa7fbcf Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Tue, 30 Oct 2018 19:09:46 +0100 Subject: [PATCH] c: update the definition of _Noreturn Does not work on Solaris 11.3 x86/64: 479. c++.at:1293: testing C++ GLR parser identifier shadowing ... ======== Testing with C++ standard flags: '-std=c++17' ./c++.at:1332: $BISON_CXX_WORKS stderr: stdout: ./c++.at:1332: $CXX $CXXFLAGS $CPPFLAGS $LDFLAGS -o input input.cc $LIBS stderr: input.cc:837:8: error: '_Noreturn' does not name a type static _Noreturn void ^~~~~~~~~ input.cc:845:8: error: '_Noreturn' does not name a type static _Noreturn void ^~~~~~~~~ Reported by Kiyoshi Kanazawa. http://lists.gnu.org/archive/html/bug-bison/2018-10/msg00051.html * data/c.m4 (b4_attribute_define): Use the snippet which is currently in gnulib's m4/gnulib-common.m4 (which seems a little more advanced than lib/_Noreturn.h). --- data/c.m4 | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/data/c.m4 b/data/c.m4 index 2df76e77..04df3ffc 100644 --- a/data/c.m4 +++ b/data/c.m4 @@ -227,12 +227,16 @@ m4_define([b4_attribute_define], # define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__)) #endif -]m4_bmatch([$1], [\bnoreturn\b], [[#if !defined _Noreturn \ - && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112) -# if defined _MSC_VER && 1200 <= _MSC_VER +]m4_bmatch([$1], [\bnoreturn\b], [[/* The _Noreturn keyword of C11. */ +#if ! (defined _Noreturn \ + || (defined __STDC_VERSION__ && 201112 <= __STDC_VERSION__)) +# if (3 <= __GNUC__ || (__GNUC__ == 2 && 8 <= __GNUC_MINOR__) \ + || 0x5110 <= __SUNPRO_C) +# define _Noreturn __attribute__ ((__noreturn__)) +# elif defined _MSC_VER && 1200 <= _MSC_VER # define _Noreturn __declspec (noreturn) # else -# define _Noreturn YY_ATTRIBUTE ((__noreturn__)) +# define _Noreturn # endif #endif