[PATCH libxkbcommon 10/11] Fix warnings in scanner and parser

Ran Benita ran234 at gmail.com
Sat Feb 25 02:13:35 PST 2012


Signed-off-by: Ran Benita <ran234 at gmail.com>
---
 src/xkbcomp/parseutils.h |    8 +-------
 src/xkbcomp/xkbparse.y   |    2 ++
 src/xkbcomp/xkbscan.l    |   17 +++++++++--------
 3 files changed, 12 insertions(+), 15 deletions(-)

diff --git a/src/xkbcomp/parseutils.h b/src/xkbcomp/parseutils.h
index c646494..00d198c 100644
--- a/src/xkbcomp/parseutils.h
+++ b/src/xkbcomp/parseutils.h
@@ -177,17 +177,11 @@ extern XkbFile *CreateXKBFile(int /* type */ ,
                               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 */ ,
                          int     /* line */
     );
 
-extern FILE *yyin;
-extern const char *yystring;
-
 #endif /* XKBPARSE_H */
diff --git a/src/xkbcomp/xkbparse.y b/src/xkbcomp/xkbparse.y
index 60c445b..cf3db91 100644
--- a/src/xkbcomp/xkbparse.y
+++ b/src/xkbcomp/xkbparse.y
@@ -98,6 +98,8 @@
 #include <X11/keysym.h>
 #include <stdlib.h>
 
+extern int yylex(void);
+extern FILE *yyin;
 %}
 %right	EQUALS
 %left	PLUS MINUS
diff --git a/src/xkbcomp/xkbscan.l b/src/xkbcomp/xkbscan.l
index 83f0db0..84fc200 100644
--- a/src/xkbcomp/xkbscan.l
+++ b/src/xkbcomp/xkbscan.l
@@ -34,7 +34,6 @@
 #include "utils.h"
 #include "parseutils.h"
 
-const char *yystring;
 char *scanFile = NULL;
 int lineNum = 0;
 
@@ -44,13 +43,16 @@ unsigned long scanULong;
 static char *s;
 char scanBuf[1024];
 
-#define	BUFSIZE	4096
+extern int yyparse(void);
 
 %}
 
 %option case-insensitive
 %option yylineno
 %option noyywrap
+%option never-interactive
+%option noinput
+%option nounput
 
 %x S_STR S_KEY
 
@@ -183,13 +185,13 @@ alternate_group		return ALTERNATE_GROUP;
 %%
 
 void
-yyerror(const char *s)
+yyerror(const char *msg)
 {
     if (warningLevel>0) {
-	(void)fprintf(stderr,"%s: line %d of %s\n",s,yylineno,
-					(scanFile?scanFile:"(unknown)"));
-	if ((warningLevel>3))
-	    (void)fprintf(stderr,"last scanned symbol is: %s\n",scanBuf);
+        fprintf(stderr,"%s: line %d of %s\n",msg,yylineno,
+                                        (scanFile?scanFile:"(unknown)"));
+        if (warningLevel>3)
+            fprintf(stderr,"last scanned symbol is: %s\n",scanBuf);
     }
     return;
 }
@@ -231,7 +233,6 @@ XKBParseFile(FILE * file, XkbFile ** pRtrn)
     if (file)
     {
         yyin = file;
-	yystring = NULL;
         rtrnValue = NULL;
         if (yyparse() == 0)
         {
-- 
1.7.9.2



More information about the xorg-devel mailing list