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).
This commit is contained in:
Akim Demaille
2018-10-30 19:09:46 +01:00
parent ca8039e612
commit bd7aebb8b0

View File

@@ -227,12 +227,16 @@ m4_define([b4_attribute_define],
# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__)) # define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
#endif #endif
]m4_bmatch([$1], [\bnoreturn\b], [[#if !defined _Noreturn \ ]m4_bmatch([$1], [\bnoreturn\b], [[/* The _Noreturn keyword of C11. */
&& (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112) #if ! (defined _Noreturn \
# if defined _MSC_VER && 1200 <= _MSC_VER || (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) # define _Noreturn __declspec (noreturn)
# else # else
# define _Noreturn YY_ATTRIBUTE ((__noreturn__)) # define _Noreturn
# endif # endif
#endif #endif