From b55713dccb17eb947fbdc6e890723e6c1f5466b9 Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Sun, 13 May 2018 00:25:09 -0700 Subject: 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 --- ws_diag_control.h | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'ws_diag_control.h') diff --git a/ws_diag_control.h b/ws_diag_control.h index 7a84265c87..40b9831e43 100644 --- a/ws_diag_control.h +++ b/ws_diag_control.h @@ -170,26 +170,26 @@ extern "C" { #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 * 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 * shadowing the global declaration. * - * So, if this is Berkeley YACC, and we have _Pragma, and have pragmas - * to suppress diagnostics, we use it to turn off -Wshadow warnings. + * So, if we have _Pragma, and have pragmas to suppress diagnostics, + * 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 \ - DIAG_OFF(shadow) - #define DIAG_ON_BYACC \ - DIAG_ON(shadow) - #else - #define DIAG_OFF_BYACC - #define DIAG_ON_BYACC - #endif + #define DIAG_OFF_BYACC \ + DIAG_OFF(shadow) + #define DIAG_ON_BYACC \ + DIAG_ON(shadow) #endif /* -- cgit v1.2.3