aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2018-05-13 00:25:09 -0700
committerGuy Harris <guy@alum.mit.edu>2018-05-13 07:25:54 +0000
commitb55713dccb17eb947fbdc6e890723e6c1f5466b9 (patch)
tree1b9ca79751d6167762b4a46c9f12be3cb7a35928
parentfb877ef5dac9ad3116021eaa2605ef29ba2d1a7c (diff)
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>
-rw-r--r--ws_diag_control.h26
1 files changed, 13 insertions, 13 deletions
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
/*