bison-patches
[Top][All Lists]
Advanced

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

Re: [PATCH] warnings: used but undeclared symbols are warnings


From: Akim Demaille
Subject: Re: [PATCH] warnings: used but undeclared symbols are warnings
Date: Wed, 20 Jun 2012 11:09:27 +0200

Le 19 juin 2012 à 16:14, Victor Santet a écrit :

Hi Victor,

Victor is an EPITA student who want to spend some time in our
lab.  He was proposed to address some issues in Bison.  His
FSF papers have been signed, and were sent last week.  He already
has several patches waiting to be applied, so I am moving forward,
and installing them (in master).

> We used to raise an error if a symbol specified in a printer or destructor.
> Make it warning.

Indeed, when "toying" with a grammar, making this is an error
is a nuisance and hinders the experimentation.  Since we do have
-Werror available, since the generated parser is fully functional,
I don't see any valid reason for this to be an error.

> * src/symtab.h (status): New enum.
> * src/symlist.c (symbol_list_destructor_set): Set symbol status to 'used'
> when associated to destructors or printers.
> * input.at (Undeclared symbols used for a printer or destructor): New.

Thanks.  Slightly modified and installed as follows.  Please, be
sure to have more accurate commit messages.

Note however that this change also introduces new warnings that we
do not want to see:

$ cat /tmp/foo.y
%printer {} foo;
%%
exp: 'a';

$ LC_ALL=C bison /tmp/foo.y
/tmp/foo.y:1.13-15: symbol foo is used, but is not defined as a token and has 
no rules

$ LC_ALL=C ./_build/debug7/tests/bison /tmp/foo.y
/tmp/foo.y:1.13-15: warning: symbol foo is used, but is not defined as a token 
and has no rules
/tmp/foo.y: warning: 1 nonterminal useless in grammar
/tmp/foo.y:1.13-15: warning: nonterminal useless in grammar: foo

Also, and much worse, your patches "degrades" serious errors into
simple warnings.  This is not acceptable, and unfortunately, this
is not caught by the test suite.  Please, take the following example,
and make it a test.

$ cat /tmp/foo.y
%printer {} foo;
%%
exp: 'a';

$ LC_ALL=C bison /tmp/foo.y
/tmp/foo.y:1.13-15: symbol foo is used, but is not defined as a token and has 
no rules

$ LC_ALL=C ./_build/debug7/tests/bison /tmp/foo.y
/tmp/foo.y:1.13-15: warning: symbol foo is used, but is not defined as a token 
and has no rules
/tmp/foo.y: warning: 3 nonterminals useless in grammar
/tmp/foo.y: warning: 2 rules useless in grammar
/tmp/foo.y:3.1-3: fatal error: start symbol exp does not derive any sentence

I should have tested more thoroughly before pushing, sorry.  Waiting
for your fix.



Attachment: 0001-warnings-used-but-undeclared-symbols-are-warnings.patch
Description: Binary data


reply via email to

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