From 30f31b80f0105676359105c895bc195b9f3e704c Mon Sep 17 00:00:00 2001 From: Jon TURNEY Date: Wed, 25 Jan 2012 16:48:45 +0000 Subject: [PATCH] hw/xwin: Fix various warnings in code generated by lex/yacc Remove various redundant declarations. Instruct lex not to generate code which isn't going to be used, thus avoiding some unused function warnings. Note that bison <2.5 expects stdlib.h to define _STDLIB_H if it's been included, and avoids prototyping free/malloc in that case. Some stdlib.h (e.g. newlib) may not match precisely (e.g. defining _STDLIB_H_), so we define it after including stdlib.h to be sure, and avoid a redudant declaration warning for those symbols. Signed-off-by: Jon TURNEY Reviewed-by: Colin Harrison --- hw/xwin/winprefslex.l | 7 +++---- hw/xwin/winprefsyacc.y | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/hw/xwin/winprefslex.l b/hw/xwin/winprefslex.l index ba8aea696..15f707766 100644 --- a/hw/xwin/winprefslex.l +++ b/hw/xwin/winprefslex.l @@ -37,14 +37,10 @@ #include #include "winprefsyacc.h" -extern YYSTYPE yylval; -extern char *yytext; extern int yyparse(void); extern void ErrorF (const char* /*f*/, ...); -int yylineno; - /* Copy the parsed string, must be free()d in yacc parser */ static char *makestr(char *str) { @@ -62,6 +58,9 @@ static char *makestr(char *str) %} %option yylineno +%option nounput +%option noinput +%option never-interactive %% \#.*[\r\n] { /* comment */ return NEWLINE; } diff --git a/hw/xwin/winprefsyacc.y b/hw/xwin/winprefsyacc.y index 0acf160e4..19c2f4067 100644 --- a/hw/xwin/winprefsyacc.y +++ b/hw/xwin/winprefsyacc.y @@ -37,6 +37,7 @@ #endif #include #include +#define _STDLIB_H 1 /* bison checks this to know if stdlib has been included */ #include #include "winprefs.h" @@ -80,7 +81,6 @@ static void CloseSysMenu(void); static int yyerror (char *s); -extern void ErrorF (const char* /*f*/, ...); extern char *yytext; extern int yylex(void);