From 8474dbc09e1d8046e257a7c1204d72e5e8845b0a Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Wed, 14 Nov 2018 21:23:11 +0100 Subject: [PATCH] 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. --- data/glr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/data/glr.c b/data/glr.c index ed79cab6..8f71c527 100644 --- a/data/glr.c +++ b/data/glr.c @@ -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);