glr.c: fix use of _Noreturn

In C++, [[noreturn]] must not be between "static" and the rest of the
function signature, it must precede it.  C's _Noreturn does not seem
to have such a constraint, but it is therefore compatible with the C++
constraint.  Since we #define _Noreturn as [[noreturn]] is modern C++,
be sure to push the _Noreturn first.

Unfortunately this was not caught by the test suite, because it always
loads config.h first, and config.h contains another definition of
_Noreturn that does not use [[noreturn]], and hides ours.  That's
probably a sign we should avoid always loading config.h.

* data/glr.c (yyFail, yyMemoryExhausted): here.
This commit is contained in:
Akim Demaille
2018-11-14 21:23:11 +01:00
parent 8eb1d79333
commit 8474dbc09e

View File

@@ -708,7 +708,7 @@ struct yyGLRStack {
static void yyexpandGLRStack (yyGLRStack* yystackp);
#endif
static _Noreturn void
_Noreturn static void
yyFail (yyGLRStack* yystackp]b4_pure_formals[, const char* yymsg)
{
if (yymsg != YY_NULLPTR)
@@ -716,7 +716,7 @@ yyFail (yyGLRStack* yystackp]b4_pure_formals[, const char* yymsg)
YYLONGJMP (yystackp->yyexception_buffer, 1);
}
static _Noreturn void
_Noreturn static void
yyMemoryExhausted (yyGLRStack* yystackp)
{
YYLONGJMP (yystackp->yyexception_buffer, 2);