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:
Akim Demaille
2015-01-22 19:03:41 +01:00
parent 658b189348
commit a2c525b34c
17 changed files with 33 additions and 22 deletions

View File

@@ -633,7 +633,7 @@ main (int argc, const char *argv[])
{
int status;
yydebug = !!getenv ("YYDEBUG");
assert (argc == 2);
assert (argc == 2); (void) argc;
source = argv[1];
status = yyparse ();
switch (status)

View File

@@ -94,8 +94,8 @@ main (int argc, const char **argv)
status = ]AT_NAME_PREFIX[parse (]AT_PARAM_IF([[&result, &count]])[);
if (fclose (input))
perror ("fclose");
assert (global_result == result);
assert (global_count == count);
assert (global_result == result); (void) result;
assert (global_count == count); (void) count;
return status;
}
]])

View File

@@ -127,7 +127,7 @@ declarator : ID
int
main (int argc, char **argv)
{
assert (argc == 2);
assert (argc == 2); (void) argc;
if (!freopen (argv[1], "r", stdin))
return 3;
return yyparse ();

View File

@@ -72,7 +72,7 @@ const char *input = YY_NULLPTR;
int
main (int argc, const char* argv[])
{
assert (argc == 2);
assert (argc == 2); (void) argc;
input = argv[1];
return yyparse ();
}

View File

@@ -162,8 +162,8 @@ int main (int argc, const char **argv)
}
status = yyparse ();
fclose (input);
assert (global_result == result);
assert (global_count == count);
assert (global_result == result); (void) global_result; (void) result;
assert (global_count == count); (void) global_count; (void) count;
return status;
}
]])

View File

@@ -403,7 +403,7 @@ get_args (int argc, const char **argv)
{
int res;
char *endp;
assert (argc == 2);
assert (argc == 2); (void) argc;
res = strtol (argv[1], &endp, 10);
assert (argv[1] != endp);
assert (0 <= res);