bug-bison
[Top][All Lists]
Advanced

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

two -Werror issues


From: Alexandre Duret-Lutz
Subject: two -Werror issues
Date: Mon, 30 Sep 2013 11:42:27 +0200

Hi,

Context: I'm trying to fix a project so it can compile with both
bison-2.7 and bison-3.0.

% bison-3.0 -Wall -Werror --report=all ltlparse.yy -o ltlparse.cc
ltlparse.yy:323.17: error: empty rule without %empty [-Werror=empty-rule]
 OP_SQBKT_SEP_opt: | OP_SQBKT_SEP_unbounded
                 ^
ltlparse.yy:324.10: error: empty rule without %empty [-Werror=empty-rule]
 error_opt: | error
          ^
ltlparse.yy:31.9-25: error: %define variable 'api.location.type'
requires '{...}' values [-Werror=deprecated]
 %define api.location.type "spot::location"
         ^^^^^^^^^^^^^^^^^

Since fixing these would break compatibility with 2.7, I attempted to
turn these errors back
into warnings as follows:

% bison -Wall -Werror --report=all
-Wno-error=empty-rule,no-error=deprecated ltlparse.yy -o ltlparse.cc
ltlparse.yy:323.17: error: empty rule without %empty [-Werror=empty-rule]
 OP_SQBKT_SEP_opt: | OP_SQBKT_SEP_unbounded
                 ^
ltlparse.yy:324.10: error: empty rule without %empty [-Werror=empty-rule]
 error_opt: | error
          ^
ltlparse.yy:31.9-25: error: %define variable 'api.location.type'
requires '{...}' values [-Werror=deprecated]
 %define api.location.type "spot::location"
         ^^^^^^^^^^^^^^^^^

But these warnings are still reported as errors.
(-Wno-empty-rule,no-deprecated will work by simply
silencing the warning, but this is less satisfactory.)



Second problem: when "bison -Werror" turns a warning into an error, it
still outputs a parser.
In a makefile, this causes the following scenario:

% make
[bison signals an error and build stops]
% make
[build continue without running bison again]

I'm unhappy with that, because unless I touch the parser again or
clean my project,
I will have no chance to realize I still have some error to fix.

I'm not sure what the correct behaviour should be here.  Should Bison be changed
to not create the output file on error (like gcc), or should Makefiles always do
    bison -Wall -Werror parse.yy -o parser.tmp && mv parser.tmp parser.cc
?


Finally I'd suggest to augment the "Invoking Bison" section of the documentation
with an explanation of what is the difference between a warning and an
error, and
a documentation of the exit status of Bison.

-- 
Alexandre Duret-Lutz



reply via email to

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