]> git.saurik.com Git - bison.git/commitdiff
tests: beware of -pedantic on large #line numbers.
authorAkim Demaille <akim@lrde.epita.fr>
Sat, 24 Mar 2012 13:11:06 +0000 (14:11 +0100)
committerAkim Demaille <akim@lrde.epita.fr>
Sat, 24 Mar 2012 13:19:39 +0000 (14:19 +0100)
* tests/local.at (AT_TEST_TABLES_AND_PARSE): Don't pass -pedantic
when compiling large canonical-LR parsers.
Reported by Tys Lefering.
http://lists.gnu.org/archive/html/bug-bison/2012-03/msg00025.html

tests/local.at

index 2e975d0afb5b9b11a59b33ce2efdea864ae96483..ff39787c70b20486cf5ce3aab8b1f04daf858bb4 100644 (file)
@@ -615,6 +615,17 @@ m4_if(m4_index(m4_quote($3), [last-state]), -1,
 
 $9
 
+# Canonical LR generates very large tables, resulting in very long
+# files with #line directives that may overflow what the standards
+# (C90 and C++98) guarantee: 32767.  In that case, GCC's -pedantic
+# will issue an error.
+#
+# There is no "" around `wc` since some indent the result.
+m4_bmatch([$4], [%define lr.type canonical-lr],
+[if test 32767 -lt `wc -l < input.c`; then
+  CFLAGS=`echo " $CFLAGS " | sed -e 's/ -pedantic //'`
+  CXXFLAGS=`echo " $CXXFLAGS " | sed -e 's/ -pedantic //'`
+fi])
 AT_COMPILE([[input]])
 
 AT_PARSER_CHECK([[./input]],