[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

glr.c: fix use of _Noreturn

From: Akim Demaille
Subject: glr.c: fix use of _Noreturn
Date: Fri, 16 Nov 2018 17:40:33 +0100

Hi Paul,

This is something worth noting.

commit 8474dbc09e1d8046e257a7c1204d72e5e8845b0a
Author: Akim Demaille <address@hidden>
Date:   Wed Nov 14 21:23:11 2018 +0100

    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.

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);
-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* 
   YYLONGJMP (yystackp->yyexception_buffer, 1);
-static _Noreturn void
+_Noreturn static void
 yyMemoryExhausted (yyGLRStack* yystackp)
   YYLONGJMP (yystackp->yyexception_buffer, 2);

reply via email to

[Prev in Thread] Current Thread [Next in Thread]