tests: enable -Wsign-compare and fix corresponding warnings

-Wsign-compare was disabled for bison's own code, following gnulib's
approach.  However, the generated parsers should not trigger such
warnings.

Reported by Efi Fogel.
http://lists.gnu.org/archive/html/help-bison/2013-04/msg00018.html

See also http://stackoverflow.com/questions/16101062 for the weird
"-(unsigned)i" piece of code.

* configure.ac (warn_tests): Enable -Wsign-compare.
* data/location.cc (position::add_): New.
(position::lines, position::columns): Use it.
* tests/actions.at (AT_CHECK_PRINTER_AND_DESTRUCTOR): Fix signedness issues.
This commit is contained in:
Akim Demaille
2013-04-19 17:13:07 +02:00
parent 6ce4b4ff1b
commit 7ba01e111c
4 changed files with 18 additions and 14 deletions

View File

@@ -91,7 +91,7 @@ if test "$enable_gcc_warnings" = yes; then
# -fno-color-diagnostics: Clang's use of colors in the error
# messages is confusing the tests looking at the compiler's output
# (e.g., synclines.at).
warn_tests='-Wundef -pedantic -fno-color-diagnostics'
warn_tests='-Wundef -pedantic -Wsign-compare -fno-color-diagnostics'
AC_LANG_PUSH([C])
# Clang supports many of GCC's -W options, but only issues warnings