From 062e32e37233929ae5f12b4401dd589442ab118c Mon Sep 17 00:00:00 2001
From: Sascha Wildner <saw@online.de>
Date: Fri, 18 Oct 2019 15:44:19 +0200
Subject: [PATCH 2/2] byacc upgrade: local changes.

---
 bin/expr/expr.y               | 1 -
 contrib/libpcap/grammar.y     | 4 ++++
 games/atc/grammar.y           | 3 ---
 libexec/dma/aliases_parse.y   | 1 -
 libexec/ftpd/ftpcmd.y         | 3 +--
 usr.bin/localedef/Makefile    | 4 ++++
 usr.bin/localedef/localedef.c | 2 ++
 usr.bin/localedef/localedef.h | 3 ++-
 usr.bin/localedef/scanner.c   | 2 ++
 usr.bin/m4/parser.y           | 1 -
 usr.bin/mkcsmapper/ldef.h     | 1 -
 usr.bin/mkcsmapper/lex.l      | 2 --
 usr.bin/mkesdb/yacc.y         | 2 --
 usr.sbin/bthcid/parser.y      | 3 ---
 usr.sbin/config/config.y      | 4 ----
 usr.sbin/ndiscvt/inf-parse.y  | 1 -
 usr.sbin/rrenumd/parser.y     | 1 -
 17 files changed, 15 insertions(+), 23 deletions(-)

diff --git a/bin/expr/expr.y b/bin/expr/expr.y
index 684483a824..31396d835b 100644
--- a/bin/expr/expr.y
+++ b/bin/expr/expr.y
@@ -59,7 +59,6 @@ struct val	*op_times (struct val *, struct val *);
 quad_t		to_integer (struct val *);
 void		to_string (struct val *);
 int		yyerror (const char *) __dead2;
-int		yylex (void);
 
 char **av;
 %}
diff --git a/contrib/libpcap/grammar.y b/contrib/libpcap/grammar.y
index a569c8ed47..e62743ce18 100644
--- a/contrib/libpcap/grammar.y
+++ b/contrib/libpcap/grammar.y
@@ -90,6 +90,10 @@ struct rtentry;
 #include "os-proto.h"
 #endif
 
+#ifndef YYDEBUG
+#define YYDEBUG 1
+#endif
+
 #define QSET(q, p, d, a) (q).proto = (p),\
 			 (q).dir = (d),\
 			 (q).addr = (a)
diff --git a/games/atc/grammar.y b/games/atc/grammar.y
index 2ee9d0c268..626e97ee39 100644
--- a/games/atc/grammar.y
+++ b/games/atc/grammar.y
@@ -30,7 +30,6 @@
  * SUCH DAMAGE.
  *
  * @(#)grammar.y	8.1 (Berkeley) 5/31/93
- * $DragonFly: src/games/atc/grammar.y,v 1.3 2006/08/08 15:03:02 pavalos Exp $
  */
 
 /*
@@ -60,8 +59,6 @@
 %{
 #include "include.h"
 
-extern int	yylex(void);
-
 static void	check_edge(int, int);
 static void	check_point(int, int);
 static void	check_linepoint(int, int);
diff --git a/libexec/dma/aliases_parse.y b/libexec/dma/aliases_parse.y
index a5a9e7b32f..e494e454b6 100644
--- a/libexec/dma/aliases_parse.y
+++ b/libexec/dma/aliases_parse.y
@@ -8,7 +8,6 @@
 extern int yylineno;
 static void yyerror(const char *);
 int yywrap(void);
-int yylex(void);
 
 static void
 yyerror(const char *msg)
diff --git a/libexec/ftpd/ftpcmd.y b/libexec/ftpd/ftpcmd.y
index f0a5dc1c72..d1ec33dbd0 100644
--- a/libexec/ftpd/ftpcmd.y
+++ b/libexec/ftpd/ftpcmd.y
@@ -1165,7 +1165,6 @@ static void	 toolong(int);
 #ifdef INET6
 static void	 v4map_data_dest(void);
 #endif
-static int	 yylex(void);
 
 static struct tab *
 lookup(struct tab *p, char *cmd)
@@ -1287,7 +1286,7 @@ toolong(int signo)
 	dologout(1);
 }
 
-static int
+int
 yylex(void)
 {
 	static int cpos;
diff --git a/usr.bin/localedef/Makefile b/usr.bin/localedef/Makefile
index 9a888c8c50..cd3b3922bb 100644
--- a/usr.bin/localedef/Makefile
+++ b/usr.bin/localedef/Makefile
@@ -19,5 +19,9 @@ parser.h: parser.y
 CFLAGS+=	-I. -I${.CURDIR}
 CFLAGS+=	-I${.CURDIR}/../../lib/libc/locale
 CFLAGS+=	-I${.CURDIR}/../../lib/libc/stdtime
+.if defined(YACCDEBUG)
+CFLAGS+=	-DYYDEBUG
+YFLAGS+=	-t -v
+.endif
 
 .include <bsd.prog.mk>
diff --git a/usr.bin/localedef/localedef.c b/usr.bin/localedef/localedef.c
index 4264063602..3107e7fe57 100644
--- a/usr.bin/localedef/localedef.c
+++ b/usr.bin/localedef/localedef.c
@@ -254,7 +254,9 @@ main(int argc, char **argv)
 	init_numeric();
 	init_time();
 
+#ifdef YYDEBUG
 	yydebug = 0;
+#endif
 
 	(void) setlocale(LC_ALL, "");
 
diff --git a/usr.bin/localedef/localedef.h b/usr.bin/localedef/localedef.h
index 28736f8582..a018924250 100644
--- a/usr.bin/localedef/localedef.h
+++ b/usr.bin/localedef/localedef.h
@@ -44,13 +44,14 @@ extern int mb_cur_max;
 extern int mb_cur_min;
 extern int last_kw;
 extern int verbose;
+#ifdef YYDEBUG
 extern int yydebug;
+#endif
 extern int lineno;
 extern int undefok;	/* mostly ignore undefined symbols */
 extern int warnok;
 extern int warnings;
 
-int yylex(void);
 void yyerror(const char *);
 void errf(const char *, ...) __dead2;
 void warn(const char *, ...);
diff --git a/usr.bin/localedef/scanner.c b/usr.bin/localedef/scanner.c
index e731be2633..0acc29b466 100644
--- a/usr.bin/localedef/scanner.c
+++ b/usr.bin/localedef/scanner.c
@@ -44,6 +44,8 @@
 #include "localedef.h"
 #include "parser.h"
 
+int			yylex(void);
+
 int			com_char = '#';
 int			esc_char = '\\';
 int			mb_cur_min = 1;
diff --git a/usr.bin/m4/parser.y b/usr.bin/m4/parser.y
index 12cd84e543..d338535de3 100644
--- a/usr.bin/m4/parser.y
+++ b/usr.bin/m4/parser.y
@@ -29,7 +29,6 @@
 
 #define	YYSTYPE	int32_t
 
-extern int yylex(void);
 extern int yyerror(const char *);
 %}
 %token NUMBER
diff --git a/usr.bin/mkcsmapper/ldef.h b/usr.bin/mkcsmapper/ldef.h
index eef9d6a707..d348bcb040 100644
--- a/usr.bin/mkcsmapper/ldef.h
+++ b/usr.bin/mkcsmapper/ldef.h
@@ -38,4 +38,3 @@ typedef struct {
 extern int	 debug;
 extern int	 linenumber;
 extern int	 yyerror(const char *) __dead2;
-extern int	 yylex(void);
diff --git a/usr.bin/mkcsmapper/lex.l b/usr.bin/mkcsmapper/lex.l
index fa4dcbfe9c..4670ae6b81 100644
--- a/usr.bin/mkcsmapper/lex.l
+++ b/usr.bin/mkcsmapper/lex.l
@@ -41,8 +41,6 @@
 #include "ldef.h"
 #include "yacc.h"
 
-#define YY_DECL int yylex(void)
-
 int linenumber = 1;
 %}
 %option	noinput
diff --git a/usr.bin/mkesdb/yacc.y b/usr.bin/mkesdb/yacc.y
index d56013eab0..194ffc2028 100644
--- a/usr.bin/mkesdb/yacc.y
+++ b/usr.bin/mkesdb/yacc.y
@@ -61,8 +61,6 @@ static void	dump_file(void);
 static void	register_named_csid(char *, uint32_t);
 static void	set_prop_string(const char *, char **, char **);
 static void	set_invalid(uint32_t);
-
-int yylex (void);
 %}
 %union {
 	uint32_t	i_value;
diff --git a/usr.sbin/bthcid/parser.y b/usr.sbin/bthcid/parser.y
index da0aacb3da..1154ba95cc 100644
--- a/usr.sbin/bthcid/parser.y
+++ b/usr.sbin/bthcid/parser.y
@@ -28,7 +28,6 @@
  *
  * $Id: parser.y,v 1.5 2003/06/07 21:22:30 max Exp $
  * $FreeBSD: src/usr.sbin/bluetooth/hcsecd/parser.y,v 1.4 2004/09/14 20:04:33 emax Exp $
- * $DragonFly: src/usr.sbin/bthcid/parser.y,v 1.1 2008/01/30 14:10:19 hasso Exp $
  */
 
 #include <sys/fcntl.h>
@@ -44,8 +43,6 @@
 #include <unistd.h>
 #include "bthcid.h"
 
-	int	yylex    (void);
-
 static	void	free_key (link_key_p key);
 static	int	hexa2int4(char *a);
 static	int	hexa2int8(char *a);
diff --git a/usr.sbin/config/config.y b/usr.sbin/config/config.y
index fbf0971643..cfb5981486 100644
--- a/usr.sbin/config/config.y
+++ b/usr.sbin/config/config.y
@@ -77,7 +77,6 @@
  *
  *	@(#)config.y	8.1 (Berkeley) 6/6/93
  * $FreeBSD: src/usr.sbin/config/config.y,v 1.42.2.1 2001/01/23 00:09:32 peter Exp $
- * $DragonFly: src/usr.sbin/config/config.y,v 1.15 2008/05/01 09:24:42 swildner Exp $
  */
 
 #include <ctype.h>
@@ -99,9 +98,6 @@ int	maxusers;
 
 static int connect(char *, int);
 static void yyerror(const char *s);
-
-int yylex(void);
-
 %}
 %%
 Configuration:
diff --git a/usr.sbin/ndiscvt/inf-parse.y b/usr.sbin/ndiscvt/inf-parse.y
index 2507990215..76f55f1b8d 100644
--- a/usr.sbin/ndiscvt/inf-parse.y
+++ b/usr.sbin/ndiscvt/inf-parse.y
@@ -39,7 +39,6 @@
 
 #include "inf.h"
 
-extern int yylex (void);
 extern void yyerror(const char *);
 %}
 
diff --git a/usr.sbin/rrenumd/parser.y b/usr.sbin/rrenumd/parser.y
index 8f24793827..31c6695c72 100644
--- a/usr.sbin/rrenumd/parser.y
+++ b/usr.sbin/rrenumd/parser.y
@@ -65,7 +65,6 @@ char errbuf[LINE_MAX];
 
 extern int lineno;
 extern void yyerror(const char *s);
-extern int yylex(void);
 static struct payload_list * pllist_lookup(int seqnum);
 static void pllist_enqueue(struct payload_list *pl_entry);
 
-- 
2.23.0

