Fix warnings in scanner and parser

Signed-off-by: Ran Benita <ran234@gmail.com>
master
Ran Benita 2012-02-25 11:53:01 +02:00
parent 1d969c5cf6
commit eff72fab5d
3 changed files with 12 additions and 15 deletions

View File

@ -177,17 +177,11 @@ extern XkbFile *CreateXKBFile(int /* type */ ,
unsigned /* flags */ unsigned /* flags */
); );
extern void yyerror(const char * /* s */ extern void yyerror(const char * /* msg */
); );
extern int yylex(void);
extern int yyparse(void);
extern void setScanState(const char * /* file */ , extern void setScanState(const char * /* file */ ,
int /* line */ int /* line */
); );
extern FILE *yyin;
extern const char *yystring;
#endif /* XKBPARSE_H */ #endif /* XKBPARSE_H */

View File

@ -98,6 +98,8 @@
#include <X11/keysym.h> #include <X11/keysym.h>
#include <stdlib.h> #include <stdlib.h>
extern int yylex(void);
extern FILE *yyin;
%} %}
%right EQUALS %right EQUALS
%left PLUS MINUS %left PLUS MINUS

View File

@ -34,7 +34,6 @@
#include "utils.h" #include "utils.h"
#include "parseutils.h" #include "parseutils.h"
const char *yystring;
char *scanFile = NULL; char *scanFile = NULL;
int lineNum = 0; int lineNum = 0;
@ -44,13 +43,16 @@ unsigned long scanULong;
static char *s; static char *s;
char scanBuf[1024]; char scanBuf[1024];
#define BUFSIZE 4096 extern int yyparse(void);
%} %}
%option case-insensitive %option case-insensitive
%option yylineno %option yylineno
%option noyywrap %option noyywrap
%option never-interactive
%option noinput
%option nounput
%x S_STR S_KEY %x S_STR S_KEY
@ -183,13 +185,13 @@ alternate_group return ALTERNATE_GROUP;
%% %%
void void
yyerror(const char *s) yyerror(const char *msg)
{ {
if (warningLevel>0) { if (warningLevel>0) {
(void)fprintf(stderr,"%s: line %d of %s\n",s,yylineno, fprintf(stderr,"%s: line %d of %s\n",msg,yylineno,
(scanFile?scanFile:"(unknown)")); (scanFile?scanFile:"(unknown)"));
if ((warningLevel>3)) if (warningLevel>3)
(void)fprintf(stderr,"last scanned symbol is: %s\n",scanBuf); fprintf(stderr,"last scanned symbol is: %s\n",scanBuf);
} }
return; return;
} }
@ -231,7 +233,6 @@ XKBParseFile(FILE * file, XkbFile ** pRtrn)
if (file) if (file)
{ {
yyin = file; yyin = file;
yystring = NULL;
rtrnValue = NULL; rtrnValue = NULL;
if (yyparse() == 0) if (yyparse() == 0)
{ {