|Removing GCC warnings from flex- and bison- generated C code email@example.com (Charlie Zender) (2004-01-09)|
|Re: Removing GCC warnings from flex- and bison- generated C code firstname.lastname@example.org (Paul Eggert) (2004-01-12)|
|Re: Removing GCC warnings from flex- and bison- generated C code email@example.com (Fergus Henderson) (2004-01-12)|
|Re: Removing GCC warnings from flex- and bison- generated C code firstname.lastname@example.org (Charlie Zender) (2004-01-16)|
|From:||Charlie Zender <email@example.com>|
|Date:||16 Jan 2004 22:38:52 -0500|
|Organization:||University of California at Irvine|
|Posted-Date:||16 Jan 2004 22:38:52 EST|
First, thanks to everyone who responded.
>>ncap_yacc.c: In function `yyparse':
>>ncap_yacc.c:1216: warning: implicit declaration of function `yylex'
> You can avoid that one by explicitly declaring yylex() in the declaration
> section at the start of your .y file:
Yes, I'm now using YY_DECL in three places (my lexer gets called by
two different routines)
>>ncap_lex.l: In function `yylex':
>>ncap_lex.l:670: warning: implicit declaration of function `yy_flex_realloc'
> You can avoid that one by declaring yy_flex_realloc().
I tried that and yy_flex_realloc() is tricky. Adding
int yy_flex_realloc(void *,size_t);
works on GNU/Linux but causes failures on IBM AIX xlC and
SGI IRIX cc. So prototyping these functions becomes platform/compiler
specific and, I think, would best be handled by flex itself.
>>ncap_lex.c: In function `yy_init_buffer':
>>ncap_lex.c:2595: warning: implicit declaration of function `fileno'
> That one can be fixed by compiling with -D_POSIX_SOURCE or including
> `#define _POSIX_SOURCE 1' in the declaration section of your .l file.
Thanks for the pointer, didn't know about POSIX_SOURCE, I'll try that.
The remaining functions are as yy_flex_realloc(). They either do or do
not get referenced by flex depending on the compiler/OS. So I'm
unable to include a prototyping hack in ncap_lex.l without many
compiler-specific tests which is extremely non-portable.
My guess is that if the flex maintainers would compile their test
lexers with -Werror -Wall -Wmissing-prototypes they would find the
same problems and could easily solve them.
Return to the
Search the comp.compilers archives again.