help-bison
[Top][All Lists]
Advanced

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

new pacification suggestion?


From: Uxio Prego
Subject: new pacification suggestion?
Date: Thu, 15 Nov 2018 21:35:34 +0100

Hi, my usage is yielding me a block like this:

---------


/*---------------------------------------------------.
| yyerrorlab -- error raised explicitly by YYERROR.  |
`---------------------------------------------------*/
yyerrorlab:

  /* Pacify compilers like GCC when the user code never invokes
     YYERROR and the label yyerrorlab therefore never appears in user
     code.  */
  if (/*CONSTCOND*/ 0)
     goto yyerrorlab;

  /* Do not reclaim the symbols of the rule whose action triggered
     this YYERROR.  */
  YYPOPSTACK (yylen);
  yylen = 0;
  YY_STACK_PRINT (yyss, yyssp);
  yystate = *yyssp;
  goto yyerrlab1;


---------

There, the `goto yyerrorlab;` line is annotated by this Xcode
message: "Semantic Issue: Code will never be executed: _____.tab.c:
Silence by adding parentheses to mark code as explicitly dead".

The comment is really clear and I think I know what is happening and
what I might be doing wrong.

However, just to let you know that Xcode proposes some fix. If
chosen, then the line:

  if (/*CONSTCOND*/ 0)

turns to:

    if (/*CONSTCOND*/ /* DISABLES CODE */ (0))

So telling you, in case you wanted to change the line permanently in
your sources. I don’t normally code C/C++, so please forgive me if I
overlooked something!


reply via email to

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