summaryrefslogtreecommitdiffstats
path: root/freebsd/contrib/libpcap/grammar.y
diff options
context:
space:
mode:
Diffstat (limited to 'freebsd/contrib/libpcap/grammar.y')
-rw-r--r--freebsd/contrib/libpcap/grammar.y66
1 files changed, 40 insertions, 26 deletions
diff --git a/freebsd/contrib/libpcap/grammar.y b/freebsd/contrib/libpcap/grammar.y
index ef6a7abb..be80e2bf 100644
--- a/freebsd/contrib/libpcap/grammar.y
+++ b/freebsd/contrib/libpcap/grammar.y
@@ -21,7 +21,7 @@
/*
* And we need to pass the compiler state to the scanner.
*/
-%parse-param {compiler_state_t *cstate}
+%parse-param { compiler_state_t *cstate }
%{
/*
@@ -44,23 +44,18 @@
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * $FreeBSD$
*/
#ifdef HAVE_CONFIG_H
-#include "config.h"
+#include <config.h>
#endif
-#ifdef _WIN32
-#include <pcap-stdinc.h>
-#else /* _WIN32 */
-#include <sys/types.h>
-#include <sys/socket.h>
-#endif /* _WIN32 */
-
#include <stdlib.h>
#ifndef _WIN32
+#include <sys/types.h>
+#include <sys/socket.h>
+
#if __STDC__
struct mbuf;
struct rtentry;
@@ -72,6 +67,8 @@ struct rtentry;
#include <stdio.h>
+#include "diag-control.h"
+
#include "pcap-int.h"
#include "gencode.h"
@@ -80,7 +77,7 @@ struct rtentry;
#ifdef HAVE_NET_PFVAR_H
#include <net/if.h>
-#include <netpfil/pf/pf.h>
+#include <net/pfvar.h>
#include <net/if_pflog.h>
#endif
#include "llc.h"
@@ -91,9 +88,30 @@ struct rtentry;
#include "os-proto.h"
#endif
-#define QSET(q, p, d, a) (q).proto = (p),\
- (q).dir = (d),\
- (q).addr = (a)
+#ifdef YYBYACC
+/*
+ * 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.
+ */
+#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.
+ *
+ * Declare it to squelch a warning.
+ */
+extern int yynerrs;
+#endif
+
+#define QSET(q, p, d, a) (q).proto = (unsigned char)(p),\
+ (q).dir = (unsigned char)(d),\
+ (q).addr = (unsigned char)(a)
struct tok {
int v; /* value */
@@ -200,8 +218,8 @@ str2tok(const char *str, const struct tok *toks)
static struct qual qerr = { Q_UNDEF, Q_UNDEF, Q_UNDEF, Q_UNDEF };
-static void
-yyerror(void *yyscanner, compiler_state_t *cstate, const char *msg)
+static PCAP_NORETURN_DEF void
+yyerror(void *yyscanner _U_, compiler_state_t *cstate, const char *msg)
{
bpf_syntax_error(cstate, msg);
/* NOTREACHED */
@@ -247,26 +265,22 @@ pfaction_to_num(compiler_state_t *cstate, const char *action)
}
}
#else /* !HAVE_NET_PFVAR_H */
-static int
-pfreason_to_num(compiler_state_t *cstate, const char *reason)
+static PCAP_NORETURN_DEF int
+pfreason_to_num(compiler_state_t *cstate, const char *reason _U_)
{
bpf_error(cstate, "libpcap was compiled on a machine without pf support");
/*NOTREACHED*/
-
- /* this is to make the VC compiler happy */
- return -1;
}
-static int
-pfaction_to_num(compiler_state_t *cstate, const char *action)
+static PCAP_NORETURN_DEF int
+pfaction_to_num(compiler_state_t *cstate, const char *action _U_)
{
bpf_error(cstate, "libpcap was compiled on a machine without pf support");
/*NOTREACHED*/
-
- /* this is to make the VC compiler happy */
- return -1;
}
#endif /* HAVE_NET_PFVAR_H */
+
+DIAG_OFF_BISON_BYACC
%}
%union {