diff options
author | Akim Demaille <akim@lrde.epita.fr> | 2013-04-19 17:13:07 +0200 |
---|---|---|
committer | Akim Demaille <akim@lrde.epita.fr> | 2013-04-19 17:13:07 +0200 |
commit | 7ba01e111c878291d8677db124eb4d7aef7c9541 (patch) | |
tree | c8d8468add55e6182b0dda3beb7594beab7dd943 /tests | |
parent | 6ce4b4ff1b761a0408cf94abb308fac9b55edd3d (diff) | |
download | bison-7ba01e111c878291d8677db124eb4d7aef7c9541.tar.gz |
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.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/actions.at | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/tests/actions.at b/tests/actions.at index 88aad258..6c1ecbc1 100644 --- a/tests/actions.at +++ b/tests/actions.at @@ -605,11 +605,11 @@ static { static unsigned int counter = 0; - int c = ]AT_VAL[]m4_ifval([$6], [.ival])[ = counter++; + unsigned int c = ]AT_VAL[]m4_ifval([$6], [.ival])[ = counter++; /* As in BASIC, line numbers go from 10 to 10. */ ]AT_LOC_FIRST_LINE[ = ]AT_LOC_FIRST_COLUMN[ = 10 * c; ]AT_LOC_LAST_LINE[ = ]AT_LOC_LAST_COLUMN[ = ]AT_LOC_FIRST_LINE[ + 9; - assert (0 <= c && c <= strlen (source)); + assert (c <= strlen (source)); if (source[c]) fprintf (stderr, "sending: '%c'", source[c]); else @@ -848,13 +848,13 @@ AT_CLEANUP AT_CHECK_PRINTER_AND_DESTRUCTOR([]) -AT_CHECK_PRINTER_AND_DESTRUCTOR([], [with union]) +AT_CHECK_PRINTER_AND_DESTRUCTOR([], [ with union]) AT_CHECK_PRINTER_AND_DESTRUCTOR([%defines %skeleton "lalr1.cc"]) -AT_CHECK_PRINTER_AND_DESTRUCTOR([%defines %skeleton "lalr1.cc"], [with union]) +AT_CHECK_PRINTER_AND_DESTRUCTOR([%defines %skeleton "lalr1.cc"], [ with union]) AT_CHECK_PRINTER_AND_DESTRUCTOR([%glr-parser]) -AT_CHECK_PRINTER_AND_DESTRUCTOR([%glr-parser], [with union]) +AT_CHECK_PRINTER_AND_DESTRUCTOR([%glr-parser], [ with union]) |