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 <jon.turney@dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
This commit is contained in:
Jon TURNEY 2012-01-25 16:48:45 +00:00
parent 4231b9541c
commit 30f31b80f0
2 changed files with 4 additions and 5 deletions

View File

@ -37,14 +37,10 @@
#include <string.h>
#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; }

View File

@ -37,6 +37,7 @@
#endif
#include <stdio.h>
#include <stdlib.h>
#define _STDLIB_H 1 /* bison checks this to know if stdlib has been included */
#include <string.h>
#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);