lemon is an excellent parser generator. 

Is there a way to fix the gcc warnings?  The parser code, created
from the lemon parser generator, throws a few warnings between
signed and unsigned integers.

Agreed. This is not debilitating. However, since the parser code is
often added to a larger program, it's advantageous to have rigorous
error checking turned on. 

What would be the best way to fix the following corrections? I would
be willing to submit a patched version of lemon without any license
restrictions, if that would help.

Here is an example of compiling lemon.c with the "-Wall and -W" flags.

gcc -Wall -W lemon.c
lemon.c: In function `resolve_conflict':
lemon.c:973: warning: unused parameter `errsym'
lemon.c: In function `main':
lemon.c:1342: warning: unused parameter `argc'
lemon.c: At top level:
lemon.c:2308: warning: return type defaults to `int'
lemon.c: In function `preprocess_input':
lemon.c:2334: warning: comparison between signed and unsigned
lemon.c:2352: warning: control reaches end of non-void function
lemon.c: In function `Parse':
lemon.c:2393: warning: comparison between signed and unsigned
lemon.c: In function `tplt_open':
lemon.c:2904: warning: implicit declaration of function `access'
lemon.c: In function `append_str':
lemon.c:3019: warning: comparison between signed and unsigned
lemon.c:3011: warning: unused variable `i'
lemon.c: In function `translate_code':
lemon.c:3109: warning: control reaches end of non-void function


Assuming the following "example1.y" syntax file is run through the
parser generator.

$ ./lemon example1.y

Next, if this file is compiled with all warning flags, the following
results. Again, the program will work; but, error checking could be
very valuable when all of the code for a project should be checked.

$ g++ -Wall -W example1.c
example1.c: In function `const char* ParseTokenName(int)':
example1.c:261: warning: comparison between signed and unsigned integer
   expressions
example1.c: In function `void yy_destructor(unsigned char, YYMINORTYPE*)':
example1.c:297: warning: unused parameter `YYMINORTYPE*yypminor'
example1.c: In function `int yy_find_shift_action(yyParser*, int)':
example1.c:385: warning: comparison between signed and unsigned integer
   expressions
example1.c: In function `int yy_find_reduce_action(yyParser*, int)':
example1.c:428: warning: comparison between signed and unsigned integer
   expressions
example1.c: In function `void yy_reduce(yyParser*, int)':
example1.c:510: warning: comparison between signed and unsigned integer
   expressions
example1.c: In function `void yy_syntax_error(yyParser*, int, YYMINORTYPE)':
example1.c:598: warning: unused parameter `yyParser*yypParser'
example1.c:598: warning: unused parameter `int yymajor'
example1.c:598: warning: unused parameter `YYMINORTYPE yyminor'


I'm willing to help correct the warnings with lemon  -- what should I do?

Regards,

Mike Chirico

Reply via email to