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:
parent
4231b9541c
commit
30f31b80f0
|
@ -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; }
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user