forked from osmocom/wireshark
Suppress -Wshadow warnings in Bison-generated code.
Apparently, some versions of Bison also generate global generations of yylval, or its appropriately-prefixed equivalent, in pure parsers. Suppress -Wshadow in Bison-generated code as well as Berkeley YACC-generated code. Change-Id: I7b3e6260d338cd8f0c9eea9d7cf248f1ac65c755 Reviewed-on: https://code.wireshark.org/review/27484 Reviewed-by: Guy Harris <guy@alum.mit.edu>
This commit is contained in:
parent
fb877ef5da
commit
b55713dccb
|
@ -170,26 +170,26 @@ extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Berkeley YACC generates a global declaration of yylval, or the
|
* Berkeley YACC and, apparently, some versions of Bison, such as the
|
||||||
|
* one in Fedora 21, generate a global declaration of yylval, or the
|
||||||
* appropriately prefixed version of yylval, in grammar.h, *even
|
* appropriately prefixed version of yylval, in grammar.h, *even
|
||||||
* though it's been told to generate a pure parser, meaning it
|
* though it's been told to generate a pure parser, meaning it
|
||||||
* doesn't have any global variables*. Bison doesn't do this.
|
* doesn't have any global variables*. Other versions of Bison, such
|
||||||
|
* as the one in macOS Sierra don't do that.
|
||||||
*
|
*
|
||||||
* That causes a warning due to the local declaration in the parser
|
* That causes a warning due to the local declaration in the parser
|
||||||
* shadowing the global declaration.
|
* shadowing the global declaration.
|
||||||
*
|
*
|
||||||
* So, if this is Berkeley YACC, and we have _Pragma, and have pragmas
|
* So, if we have _Pragma, and have pragmas to suppress diagnostics,
|
||||||
* to suppress diagnostics, we use it to turn off -Wshadow warnings.
|
* we use it to turn off -Wshadow warnings.
|
||||||
|
*
|
||||||
|
* XXX - do this for Bison only in versions of Bison with this
|
||||||
|
* problem?
|
||||||
*/
|
*/
|
||||||
#ifdef YYBYACC
|
#define DIAG_OFF_BYACC \
|
||||||
#define DIAG_OFF_BYACC \
|
DIAG_OFF(shadow)
|
||||||
DIAG_OFF(shadow)
|
#define DIAG_ON_BYACC \
|
||||||
#define DIAG_ON_BYACC \
|
DIAG_ON(shadow)
|
||||||
DIAG_ON(shadow)
|
|
||||||
#else
|
|
||||||
#define DIAG_OFF_BYACC
|
|
||||||
#define DIAG_ON_BYACC
|
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in New Issue