From: John Marino Date: Thu, 17 Jan 2013 13:33:50 +0000 (+0100) Subject: flex cleanup, silence errors X-Git-Tag: v3.4.0rc~479 X-Git-Url: https://gitweb.dragonflybsd.org/dragonfly.git/commitdiff_plain/eb74dec6d3e149ba4664e0a003391abf9854b088 flex cleanup, silence errors On the poudriere jail build, it was impossible to build world due to flex errors. I don't know what is different about the environments -- perhaps one has -Werror and the other doesn't. In any case, the new flex makes a lot of complaints due to internally generated functions, etc, and this cleans them all up at once. --- diff --git a/contrib/libpcap/scanner.l b/contrib/libpcap/scanner.l index 064e9c885f..f5c23a45a6 100644 --- a/contrib/libpcap/scanner.l +++ b/contrib/libpcap/scanner.l @@ -77,8 +77,6 @@ static int stoi(char *); static inline int xdtoi(int); #ifdef FLEX_SCANNER -#define YY_NO_INPUT -#define YY_NO_UNPUT static YY_BUFFER_STATE in_buffer; #else static const char *in_buffer; @@ -185,6 +183,8 @@ V6 ({V680}|{V670}|{V671}|{V672}|{V673}|{V674}|{V675}|{V676}|{V677}|{V660}|{V661 MAC ({B}:{B}:{B}:{B}:{B}:{B}|{B}\-{B}\-{B}\-{B}\-{B}\-{B}|{B}\.{B}\.{B}\.{B}\.{B}\.{B}|{B2}\.{B2}\.{B2}|{B2}{3}) +%option nounput +%option noinput %% dst return DST; diff --git a/libexec/dma/aliases_scan.l b/libexec/dma/aliases_scan.l index 809d1e1687..b8dc6821f8 100644 --- a/libexec/dma/aliases_scan.l +++ b/libexec/dma/aliases_scan.l @@ -1,14 +1,13 @@ %{ +#pragma GCC diagnostic ignored "-Wsign-compare" #include #include "aliases_parse.h" -#define YY_NO_INPUT - -int yylex(void); %} %option yylineno +%option noinput %option nounput %% diff --git a/sbin/devd/token.l b/sbin/devd/token.l index 5a2e237d57..074f92f37d 100644 --- a/sbin/devd/token.l +++ b/sbin/devd/token.l @@ -29,6 +29,7 @@ * $FreeBSD: src/sbin/devd/token.l,v 1.7 2008/03/21 20:38:28 imp Exp $ */ +#pragma GCC diagnostic ignored "-Wsign-compare" #include #include #include @@ -37,8 +38,6 @@ #include "y.tab.h" int lineno = 1; -#define YY_NO_INPUT -#define YY_NO_UNPUT static void update_lineno(const char *cp) @@ -50,6 +49,9 @@ update_lineno(const char *cp) %} +%option nounput +%option noinput + %% [ \t]+ ; diff --git a/usr.bin/bc/scan.l b/usr.bin/bc/scan.l index 15c84e0763..9c59a52cf0 100644 --- a/usr.bin/bc/scan.l +++ b/usr.bin/bc/scan.l @@ -19,6 +19,7 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#pragma GCC diagnostic ignored "-Wsign-compare" #include #include #include @@ -31,8 +32,6 @@ #include "pathnames.h" #include "y.tab.h" -#define YY_NO_INPUT - int lineno; bool interactive; @@ -55,6 +54,7 @@ static int bc_yyinput(char *, int); %} %option always-interactive +%option noinput DIGIT [0-9A-F] ALPHA [a-z_] diff --git a/usr.bin/colldef/Makefile b/usr.bin/colldef/Makefile index 291a0aceaf..cc70a0fddb 100644 --- a/usr.bin/colldef/Makefile +++ b/usr.bin/colldef/Makefile @@ -1,11 +1,10 @@ # $FreeBSD: src/usr.bin/colldef/Makefile,v 1.16.2.1 2002/08/17 18:57:10 ache Exp $ -# $DragonFly: src/usr.bin/colldef/Makefile,v 1.4 2007/08/27 16:50:52 pavalos Exp $ PROG= colldef SRCS= parse.y scan.l y.tab.h LFLAGS= -8 -i CFLAGS+=-I. -I${.CURDIR} -CFLAGS+=-DCOLLATE_DEBUG -DYY_NO_UNPUT +CFLAGS+=-DCOLLATE_DEBUG LDADD= -ll DPADD= ${LIBL} diff --git a/usr.bin/colldef/scan.l b/usr.bin/colldef/scan.l index a12e56b782..51926afb9d 100644 --- a/usr.bin/colldef/scan.l +++ b/usr.bin/colldef/scan.l @@ -27,7 +27,6 @@ * SUCH DAMAGE. * * $FreeBSD: src/usr.bin/colldef/scan.l,v 1.11.2.2 2002/10/11 10:43:45 ache Exp $ - * $DragonFly: src/usr.bin/colldef/scan.l,v 1.4 2008/10/16 01:52:32 swildner Exp $ */ #include @@ -39,7 +38,7 @@ #include "common.h" #include "y.tab.h" -#define YY_NO_INPUT +#pragma GCC diagnostic ignored "-Wsign-compare" int line_no = 1, save_no, fromsubs; static u_char buffer[BUFSIZE], *buf_ptr; @@ -48,9 +47,10 @@ YY_BUFFER_STATE main_buf, map_buf; #ifdef FLEX_DEBUG YYSTYPE yylval; #endif /* FLEX_DEBUG */ -int yylex(void); %} +%option noinput +%option nounput %% [ \t]+ ; \" { buf_ptr = buffer; BEGIN(string); } diff --git a/usr.bin/flex/Makefile b/usr.bin/flex/Makefile index a4211bf338..0dacb85277 100644 --- a/usr.bin/flex/Makefile +++ b/usr.bin/flex/Makefile @@ -24,7 +24,7 @@ SUBDIR= lib CFLAGS+= -I${CONTRIBDIR} -I${.OBJDIR} -I${.CURDIR} CFLAGS+= -DHAVE_CONFIG_H -WARNS?= 2 +WARNS?= 1 # verbatim from vendor makefile flex_SOURCES = \ diff --git a/usr.bin/m4/tokenizer.l b/usr.bin/m4/tokenizer.l index 034d1f7f6b..a32cfca73d 100644 --- a/usr.bin/m4/tokenizer.l +++ b/usr.bin/m4/tokenizer.l @@ -18,6 +18,7 @@ * * $FreeBSD: src/usr.bin/m4/tokenizer.l,v 1.3 2012/11/17 01:54:24 svnexp Exp $ */ +#pragma GCC diagnostic ignored "-Wsign-compare" #include "parser.h" #include #include @@ -30,7 +31,6 @@ extern int32_t yylval; int32_t number(void); int32_t parse_radix(void); -extern int yylex(void); %} delim [ \t\n] diff --git a/usr.bin/mkcsmapper/ldef.h b/usr.bin/mkcsmapper/ldef.h index cfec373a60..efe1ad154c 100644 --- a/usr.bin/mkcsmapper/ldef.h +++ b/usr.bin/mkcsmapper/ldef.h @@ -1,5 +1,4 @@ /* $NetBSD: ldef.h,v 1.2 2006/09/09 14:35:17 tnozaki Exp $ */ -/* $DragonFly: src/usr.bin/mkcsmapper/ldef.h,v 1.2 2008/04/10 10:21:13 hasso Exp $ */ /*- * Copyright (c)2003, 2006 Citrus Project, @@ -33,9 +32,8 @@ typedef struct { uint32_t width; } linear_zone_t; -extern int line_number; +extern int aline_number; extern int debug; int yyparse(void); -int yylex(void); int yyerror(const char *); diff --git a/usr.bin/mkcsmapper/lex.l b/usr.bin/mkcsmapper/lex.l index 958a9c3e8a..d508e327f3 100644 --- a/usr.bin/mkcsmapper/lex.l +++ b/usr.bin/mkcsmapper/lex.l @@ -27,6 +27,7 @@ * SUCH DAMAGE. */ +#pragma GCC diagnostic ignored "-Wsign-compare" #include #include #include @@ -38,22 +39,22 @@ #include "ldef.h" #include "yacc.h" -#define YY_NO_INPUT -#define YY_NO_UNPUT - -int line_number = 1; +int aline_number = 1; %} +%option noinput +%option nounput + %x COMMENT %% [ \t]+ { } -#.*[\n]|"//".*[\n]|[\n] { line_number++; return (R_LN); } +#.*[\n]|"//".*[\n]|[\n] { aline_number++; return (R_LN); } "/*" { BEGIN COMMENT; } "*/" { BEGIN 0; } -[\n] { line_number++; } +[\n] { aline_number++; } . { } <> { yyerror("unexpected file end (unterminate comment)\n"); diff --git a/usr.bin/mkcsmapper/yacc.y b/usr.bin/mkcsmapper/yacc.y index 53bf356811..cb6718edef 100644 --- a/usr.bin/mkcsmapper/yacc.y +++ b/usr.bin/mkcsmapper/yacc.y @@ -1,5 +1,4 @@ /* $NetBSD: yacc.y,v 1.7 2006/09/09 14:35:17 tnozaki Exp $ */ -/* $DragonFly: src/usr.bin/mkcsmapper/yacc.y,v 1.3 2008/07/10 18:29:51 swildner Exp $ */ %{ /*- @@ -93,6 +92,8 @@ static void put16(void *, size_t, u_int32_t); static void put32(void *, size_t, u_int32_t); static void set_range(u_int32_t, u_int32_t); static void set_src(linear_zone_t *, u_int32_t, u_int32_t); + +int yylex (void); %} %union { @@ -198,7 +199,7 @@ lns : R_LN static void warning(const char *s) { - fprintf(stderr, "%s in %d\n", s, line_number); + fprintf(stderr, "%s in %d\n", s, aline_number); } int diff --git a/usr.bin/mkesdb/ldef.h b/usr.bin/mkesdb/ldef.h index 96f30a6d27..fa53277f81 100644 --- a/usr.bin/mkesdb/ldef.h +++ b/usr.bin/mkesdb/ldef.h @@ -1,5 +1,4 @@ /* $NetBSD: src/usr.bin/mkesdb/ldef.h,v 1.1 2003/06/26 06:30:17 tshiozak Exp $ */ -/* $DragonFly: src/usr.bin/mkesdb/ldef.h,v 1.2 2005/05/06 13:16:08 corecode Exp $ */ /*- * Copyright (c)2003 Citrus Project, @@ -27,10 +26,9 @@ * SUCH DAMAGE. */ -extern int line_number; +extern int aline_number; int yyparse(void); -int yylex(void); int yyerror(const char *); struct named_csid { diff --git a/usr.bin/mkesdb/lex.l b/usr.bin/mkesdb/lex.l index 49892a257e..f2e54b38ef 100644 --- a/usr.bin/mkesdb/lex.l +++ b/usr.bin/mkesdb/lex.l @@ -27,6 +27,7 @@ * SUCH DAMAGE. */ +#pragma GCC diagnostic ignored "-Wsign-compare" #include #include #include @@ -39,22 +40,22 @@ #include "ldef.h" #include "yacc.h" -#define YY_NO_INPUT -#define YY_NO_UNPUT - -int line_number = 1; +int aline_number = 1; %} +%option noinput +%option nounput + %x COMMENT %% [ \t]+ { } -#.*[\n]|"//".*[\n]|[\n] { line_number++; return (R_LN); } +#.*[\n]|"//".*[\n]|[\n] { aline_number++; return (R_LN); } "/*" { BEGIN COMMENT; } "*/" { BEGIN 0; } -[\n] { line_number++; } +[\n] { aline_number++; } . { } <> { yyerror("unexpected file end (unterminate comment)\n"); diff --git a/usr.bin/mkesdb/yacc.y b/usr.bin/mkesdb/yacc.y index 8d85ab5045..5af12dca5e 100644 --- a/usr.bin/mkesdb/yacc.y +++ b/usr.bin/mkesdb/yacc.y @@ -1,5 +1,4 @@ /* $NetBSD: src/usr.bin/mkesdb/yacc.y,v 1.3 2004/01/02 12:09:48 itojun Exp $ */ -/* $DragonFly: src/usr.bin/mkesdb/yacc.y,v 1.2 2008/07/10 18:29:51 swildner Exp $ */ %{ /*- @@ -62,6 +61,8 @@ 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; @@ -113,7 +114,7 @@ invalid : R_INVALID L_IMM int yyerror(const char *s) { - fprintf(stderr, "%s in %d\n", s, line_number); + fprintf(stderr, "%s in %d\n", s, aline_number); return (0); } diff --git a/usr.bin/mklocale/lex.l b/usr.bin/mklocale/lex.l index c535eb84de..403bccceef 100644 --- a/usr.bin/mklocale/lex.l +++ b/usr.bin/mklocale/lex.l @@ -1,5 +1,4 @@ /* $NetBSD: src/usr.bin/mklocale/lex.l,v 1.13 2003/10/27 00:12:43 lukem Exp $ */ -/* $DragonFly: src/usr.bin/mklocale/lex.l,v 1.7 2008/06/21 20:01:14 swildner Exp $ */ %{ /*- @@ -34,6 +33,7 @@ * SUCH DAMAGE. */ +#pragma GCC diagnostic ignored "-Wsign-compare" #include #include #include @@ -42,7 +42,6 @@ #include "ldef.h" #include "yacc.h" -int yylex(void); %} ODIGIT [0-7] diff --git a/usr.sbin/apmd/apmdlex.l b/usr.sbin/apmd/apmdlex.l index ff2031758b..050f3e9411 100644 --- a/usr.sbin/apmd/apmdlex.l +++ b/usr.sbin/apmd/apmdlex.l @@ -30,20 +30,20 @@ * $FreeBSD: src/usr.sbin/apmd/apmdlex.l,v 1.2.2.1 2001/08/13 17:30:30 nsayer Exp $ */ +#pragma GCC diagnostic ignored "-Wsign-compare" #include #include #include #include "apmd.h" #include "y.tab.h" -/* We don't need them, avoid the warnings. */ -#define YY_NO_INPUT -#define YY_NO_UNPUT - int lineno; int first_time; %} +%option noinput +%option nounput + %s TOP %% diff --git a/usr.sbin/bthcid/lexer.l b/usr.sbin/bthcid/lexer.l index 9001f17a23..73d6b7deb7 100644 --- a/usr.sbin/bthcid/lexer.l +++ b/usr.sbin/bthcid/lexer.l @@ -30,15 +30,14 @@ * $FreeBSD: src/usr.sbin/bluetooth/hcsecd/lexer.l,v 1.1 2003/05/10 21:50:35 julian Exp $ */ +#pragma GCC diagnostic ignored "-Wsign-compare" #include #include "parser.h" -#define YY_NO_INPUT - -int yylex(void); %} %option yylineno noyywrap nounput +%option noinput delim [ \t\n] ws {delim}+ diff --git a/usr.sbin/config/config.h b/usr.sbin/config/config.h index defe52a25b..aaab9ea32f 100644 --- a/usr.sbin/config/config.h +++ b/usr.sbin/config/config.h @@ -151,7 +151,6 @@ void moveifchanged(const char *, const char *); void init_dev(struct device *); void newbus_ioconf(void); int yyparse(void); -int yylex(void); void options(void); void makefile(void); void headers(void); diff --git a/usr.sbin/config/config.y b/usr.sbin/config/config.y index 4f950bd943..4146375a69 100644 --- a/usr.sbin/config/config.y +++ b/usr.sbin/config/config.y @@ -104,6 +104,7 @@ int maxusers; static int connect(char *, int); static void yyerror(const char *s); +int yylex(void); %} %% diff --git a/usr.sbin/config/lang.l b/usr.sbin/config/lang.l index baf01894f2..f9c4424c61 100644 --- a/usr.sbin/config/lang.l +++ b/usr.sbin/config/lang.l @@ -33,17 +33,14 @@ * * @(#)lang.l 8.1 (Berkeley) 6/6/93 * $FreeBSD: src/usr.sbin/config/lang.l,v 1.27 1999/11/09 07:20:22 peter Exp $ - * $DragonFly: src/usr.sbin/config/lang.l,v 1.14 2008/05/01 09:24:42 swildner Exp $ */ +#pragma GCC diagnostic ignored "-Wsign-compare" #include #include #include "y.tab.h" #include "config.h" -#define YY_NO_INPUT -#define YY_NO_UNPUT - /* * Key word table */ @@ -89,6 +86,8 @@ int hex(char *); WORD [A-Za-z_][-A-Za-z_]* ID [A-Za-z_][-A-Za-z_0-9]* %START NONUM TOEOL +%option noinput +%option nounput %% {WORD} { int i; diff --git a/usr.sbin/kbdcontrol/kbdcontrol.c b/usr.sbin/kbdcontrol/kbdcontrol.c index e25c45e463..536cc3c583 100644 --- a/usr.sbin/kbdcontrol/kbdcontrol.c +++ b/usr.sbin/kbdcontrol/kbdcontrol.c @@ -40,6 +40,8 @@ #include "path.h" #include "lex.h" +int yylex(void); + char ctrl_names[32][4] = { "nul", "soh", "stx", "etx", "eot", "enq", "ack", "bel", "bs ", "ht ", "nl ", "vt ", "ff ", "cr ", "so ", "si ", diff --git a/usr.sbin/kbdcontrol/lex.h b/usr.sbin/kbdcontrol/lex.h index d3f95fbec9..5fc737ca08 100644 --- a/usr.sbin/kbdcontrol/lex.h +++ b/usr.sbin/kbdcontrol/lex.h @@ -66,5 +66,3 @@ extern int number; extern char letter; - -extern int yylex(void); diff --git a/usr.sbin/kbdcontrol/lex.l b/usr.sbin/kbdcontrol/lex.l index 73db95346f..07b6f666d6 100644 --- a/usr.sbin/kbdcontrol/lex.l +++ b/usr.sbin/kbdcontrol/lex.l @@ -29,12 +29,13 @@ */ %{ +#pragma GCC diagnostic ignored "-Wsign-compare" #include "lex.h" - -#define YY_NO_INPUT -#define YY_NO_UNPUT %} +%option noinput +%option nounput + D [0-9] X [0-9a-fA-F] A . diff --git a/usr.sbin/ndiscvt/inf-token.l b/usr.sbin/ndiscvt/inf-token.l index 522678ca2a..115eabbdda 100644 --- a/usr.sbin/ndiscvt/inf-token.l +++ b/usr.sbin/ndiscvt/inf-token.l @@ -33,6 +33,7 @@ * $FreeBSD: src/usr.sbin/ndiscvt/inf-token.l,v 1.3 2004/01/11 21:10:35 mdodd Exp $ */ +#pragma GCC diagnostic ignored "-Wsign-compare" #include #include #include @@ -42,10 +43,7 @@ #include "y.tab.h" int lineno = 1; -#define YY_NO_INPUT -#define YY_NO_UNPUT -int yylex(void); void yyerror(const char *); static void @@ -58,6 +56,9 @@ update_lineno(const char *cp) %} +%option noinput +%option nounput + %% [ \t]+ ; diff --git a/usr.sbin/rrenumd/lexer.l b/usr.sbin/rrenumd/lexer.l index 307b1f6080..1df5493c22 100644 --- a/usr.sbin/rrenumd/lexer.l +++ b/usr.sbin/rrenumd/lexer.l @@ -33,9 +33,8 @@ */ %{ -#define YY_NO_INPUT -#define YY_NO_UNPUT +#pragma GCC diagnostic ignored "-Wsign-compare" #include #include #include @@ -63,9 +62,11 @@ char linebuf[LINEBUF_SIZE]; int parse(FILE **); void yyerror(const char *); -int yylex(void); %} +%option noinput +%option nounput + /* common section */ nl \n ws [ \t]+ diff --git a/usr.sbin/setkey/Makefile b/usr.sbin/setkey/Makefile index af350b58f9..6ff22fd811 100644 --- a/usr.sbin/setkey/Makefile +++ b/usr.sbin/setkey/Makefile @@ -25,7 +25,6 @@ # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. # $FreeBSD: src/usr.sbin/setkey/Makefile,v 1.1.2.5 2001/04/25 14:05:11 ru Exp $ -# $DragonFly: src/usr.sbin/setkey/Makefile,v 1.6 2004/11/16 22:04:37 joerg Exp $ PROG= setkey SRCS= setkey.c parse.y token.l @@ -44,7 +43,7 @@ CFLAGS+=-I${.CURDIR}/../../lib/libipsec -I${.CURDIR}/../../sys/netkey SRCS+=y.tab.h y.tab.h: parse.y -CFLAGS+=-DIPSEC_DEBUG -DINET6 -DYY_NO_UNPUT -I. +CFLAGS+=-DIPSEC_DEBUG -DINET6 -I. DPADD+= ${LIBIPSEC} LDADD+= -lipsec CLEANFILES+= scriptdump y.tab.h diff --git a/usr.sbin/setkey/token.l b/usr.sbin/setkey/token.l index 3fbdaa7ea0..c3ce0eaf23 100644 --- a/usr.sbin/setkey/token.l +++ b/usr.sbin/setkey/token.l @@ -31,6 +31,7 @@ */ %{ +#pragma GCC diagnostic ignored "-Wsign-compare" #include #include #include @@ -68,8 +69,6 @@ #define PREPROC DECHO CMDARG -#define YY_NO_INPUT - int lineno = 1; char cmdarg[8192]; /* XXX: BUFSIZ is the better ? */ @@ -77,7 +76,6 @@ extern u_char m_buf[BUFSIZ]; extern u_int m_len; extern int f_debug; -int yylex(void); void yyfatal(const char *s); void yyerror(const char *s); extern void parse_init(void); @@ -86,6 +84,9 @@ int yyparse(void); %} +%option noinput +%option nounput + /* common section */ nl \n ws [ \t]+