help-bison
[Top][All Lists]
Advanced

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

Unused attribute for used variable


From: Christoph Grüninger
Subject: Unused attribute for used variable
Date: Tue, 26 Jan 2021 20:10:45 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.1

Dear Bisons!

I am still giving CMake's Bison code some love. I regenerated the code
using Bison 3.7.4. But Clang 11 with manually set
-Wused-but-marked-unused warns:

> [ 56%] Building CXX object 
> Source/CMakeFiles/CMakeLib.dir/LexerParser/cmFortranParser.cxx.o
> cmExprParser.cxx:774:54: warning: 'yysymbol_name' was marked unused but was 
> used [-Wused-but-marked-unused]
>              yykind < YYNTOKENS ? "token" : "nterm", yysymbol_name (yykind));

Having a look into the code I see at line 551ff:

> /* The user-facing name of the symbol whose (internal) number is
>    YYSYMBOL.  No bounds checking.  */
> static const char *yysymbol_name (yysymbol_kind_t yysymbol) 
> YY_ATTRIBUTE_UNUSED;

and at line 567ff:

> static const char *
> yysymbol_name (yysymbol_kind_t yysymbol)
> {
>   return yytname[yysymbol];
> }

So setting the attribute unused at line 774 does not look right. I know,
-Wused-but-marked-unused isn't even part of -Wall. Nevertheless, is this
a (tiny) bug?

Bye
Christoph

-- 
Als wär es nix, leb' ich von [IT] und mach' nur, was ich lieb'
Lebe wie im Paradies, womit hab' ich das verdient?
Die Wahrheit ist: Hab' ich nicht, ich bin nur reicher beschenkt
Als jemand in einem armen Land mit dem gleichen Talent
[frei nach Tua von Die Orsons - Oioioiropa]

Attachment: cmExprParser.cxx
Description: Text Data

Attachment: cmExprParser.y
Description: Text document


reply via email to

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