avrdude-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avrdude-dev] byacc warnings


From: Theodore A. Roth
Subject: Re: [avrdude-dev] byacc warnings
Date: Wed, 12 Feb 2003 10:44:18 -0800 (PST)


On Wed, 12 Feb 2003, Brian Dean wrote:

:) On Wed, Feb 12, 2003 at 09:48:20AM -0800, Theodore A. Roth wrote:
:)
:) > Just #define YY_NO_UNPUT in lexer.l. I've committed the fix.
:)
:) Doh!  I've put up with that warning for years, if only I'd known the
:) fix was so simple ...

I'm still getting these when using byacc (bison comes up clean):

make[1]: Leaving directory `/home/roth/dev/tools/avrdude-cvs'
cc -Wall -DCONFIG_DIR=\"/usr/local/etc\" -DYYSTYPE="struct token_t *"
-c -o config_gram.o config_gram.c
y.tab.c: In function `yyparse':
y.tab.c:491: warning: suggest parentheses around assignment used as
truth value
y.tab.c:508: warning: suggest parentheses around assignment used as
truth value
y.tab.c:557: warning: label `yyerrlab' defined but not used
y.tab.c:552: warning: label `yynewerror' defined but not used
y.tab.c: At top level:
config_gram.c:2: warning: `yysccsid' defined but not used


Adding -Dlint to the compile command reduces those to:


make[1]: Leaving directory `/home/roth/dev/tools/avrdude-cvs'
cc -Wall -DCONFIG_DIR=\"/usr/local/etc\" -DYYSTYPE="struct token_t *" -Dlint   
-c -o config_gram.o config_gram.c
y.tab.c: In function `yyparse':
y.tab.c:491: warning: suggest parentheses around assignment used as truth value
y.tab.c:508: warning: suggest parentheses around assignment used as truth value


This can be further reduced by adding '#define YYDEBUG 0' to the
grammar file:


make[1]: Leaving directory `/home/roth/dev/tools/avrdude-cvs'
cc -Wall -DCONFIG_DIR=\"/usr/local/etc\" -DYYSTYPE="struct token_t *" -Dlint   
-c -o config_gram.o config_gram.c
y.tab.c: In function `yyparse':
y.tab.c:508: warning: suggest parentheses around assignment used as truth value


and the code at line 508 of config_gram.c looks dubious at best:

    507 yyloop:
    508     if (yyn = yydefred[yystate]) goto yyreduce;
    509     if (yychar < 0)
    510     {
    511         if ((yychar = yylex()) < 0) yychar = 0;
    512 #if YYDEBUG

I'm not going to commit these changes since I'm not sure they are
valid right now.

I'd really like to get this to compile with -Werror and the byacc
generated config_gram.c file is the only thing stopping that.

Anyone object to adding -Werror for the normal CFLAGS and then
compiling config_gram.c with a custom rule in the Makefile?

Ted





reply via email to

[Prev in Thread] Current Thread [Next in Thread]