mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-13 14:23:04 +00:00
build: re-enable compiler warnings, and fix them
There are warnings (-Wextra) in generated C++ code:
ltlparse.cc: In member function 'ltlyy::parser::symbol_number_type
ltlyy::parser::by_state::type_get() const':
ltlparse.cc:452:33: warning: enumeral and non-enumeral type in
conditional expression
return state == empty_state ? empty_symbol : yystos_[state];
Reported by Alexandre Duret-Lutz.
It turns out that -Wall and -Wextra were disabled because of a stupid
typo.
* configure.ac: Fix the stupid typo.
* data/lalr1.cc, src/AnnotationList.c, src/InadequacyList.c,
* src/ielr.c, src/print.c, src/scan-code.l, src/symlist.c,
* src/symlist.h, src/symtab.c, src/tables.c, tests/actions.at,
* tests/calc.at, tests/cxx-type.at, tests/glr-regression.at,
* tests/named-refs.at, tests/torture.at:
Fix warnings, mostly issues about variables used only with assertions,
which are disabled with -DNDEBUG.
This commit is contained in:
@@ -149,10 +149,11 @@ b4_variant_if([m4_include(b4_pkgdatadir/[variant.hh])])
|
||||
m4_define([b4_shared_declarations],
|
||||
[b4_percent_code_get([[requires]])[
|
||||
]b4_parse_assert_if([# include <cassert>])[
|
||||
# include <vector>
|
||||
# include <cstdlib> // std::abort
|
||||
# include <iostream>
|
||||
# include <stdexcept>
|
||||
# include <string>]b4_defines_if([[
|
||||
# include <string>
|
||||
# include <vector>]b4_defines_if([[
|
||||
# include "stack.hh"
|
||||
]b4_bison_locations_if([[# include "location.hh"]])])[
|
||||
]b4_variant_if([b4_variant_includes])[
|
||||
@@ -569,7 +570,10 @@ m4_if(b4_prefix, [yy], [],
|
||||
]b4_parser_class_name[::symbol_number_type
|
||||
]b4_parser_class_name[::by_state::type_get () const
|
||||
{
|
||||
return state == empty_state ? empty_symbol : yystos_[state];
|
||||
if (state == empty_state)
|
||||
return empty_symbol;
|
||||
else
|
||||
return yystos_[state];
|
||||
}
|
||||
|
||||
inline
|
||||
@@ -622,6 +626,10 @@ m4_if(b4_prefix, [yy], [],
|
||||
std::ostream& yyoutput = yyo;
|
||||
YYUSE (yyoutput);
|
||||
symbol_number_type yytype = yysym.type_get ();
|
||||
// Avoid a (spurious) G++ 4.8 warning about "array subscript is
|
||||
// below array bounds".
|
||||
if (yysym.empty ())
|
||||
std::abort ();
|
||||
yyo << (yytype < yyntokens_ ? "token" : "nterm")
|
||||
<< ' ' << yytname_[yytype] << " ("]b4_locations_if([
|
||||
<< yysym.location << ": "])[;
|
||||
|
||||
Reference in New Issue
Block a user