summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuy Harris <gharris@sonic.net>2023-05-08 12:32:47 -0700
committerGitHub <noreply@github.com>2023-05-08 12:32:47 -0700
commit7e2c472b5dfb24a66372becd71588d0bd385f440 (patch)
treecb2920db5ab34e34708fa6e26e7f77e9cde45d32
parent414e3f2df4021870b8ee7f5400b88ba06ae31261 (diff)
parent1f8df3c46f296cf5c06ae4a36ac1ded966468a71 (diff)
downloadlibpcap-7e2c472b5dfb24a66372becd71588d0bd385f440.tar.gz
Merge pull request #1179 from guyharris/dont-need-that-any-more
compiler: limit some Berkeley YACC workarounds to pre-2017-07-09 releases.
-rw-r--r--grammar.y.in22
1 files changed, 16 insertions, 6 deletions
diff --git a/grammar.y.in b/grammar.y.in
index 6a97cbc0..8617f90b 100644
--- a/grammar.y.in
+++ b/grammar.y.in
@@ -110,21 +110,31 @@ struct rtentry;
#include "os-proto.h"
#endif
-#ifdef YYBYACC
+/*
+ * Work around some bugs in Berkeley YACC prior to the 2017-07-09
+ * release.
+ *
+ * The 2005-05-05 release was the first one to define YYPATCH, so
+ * we treat any release that either 1) doesn't define YYPATCH or
+ * 2) defines it to a value < 20170709 as being buggy.
+ */
+#if defined(YYBYACC) && (!defined(YYPATCH) || YYPATCH < 20170709)
/*
* Both Berkeley YACC and Bison define yydebug (under whatever name
* it has) as a global, but Bison does so only if YYDEBUG is defined.
- * Berkeley YACC define it even if YYDEBUG isn't defined; declare it
- * here to suppress a warning.
+ * Berkeley YACC, prior to the 2017-07-09 release, defines it even if
+ * YYDEBUG isn't defined; declare it here to suppress a warning. The
+ * 2017-07-09 release fixes that.
*/
#if !defined(YYDEBUG)
extern int yydebug;
#endif
/*
- * In Berkeley YACC, yynerrs (under whatever name it has) is global,
- * even if it's building a reentrant parser. In Bison, it's local
- * in reentrant parsers.
+ * In Berkeley YACC, prior to the 2017-07-09 release, yynerrs (under
+ * whatever name it has) is global, even if it's building a reentrant
+ * parser. In Bison, and in the Berkeley YACC 2017-07-09 release and
+ * later, it's local in reentrant parsers.
*
* Declare it to squelch a warning.
*/