]> git.saurik.com Git - bison.git/blobdiff - tests/local.at
%printer: support both yyo and yyoutput.
[bison.git] / tests / local.at
index 57c2ae6b90f12538b448247f99a2c79dbe571da8..ff39787c70b20486cf5ce3aab8b1f04daf858bb4 100644 (file)
@@ -303,14 +303,12 @@ m4_if(m4_bregexp([$4], [: warning: ]), [-1], [],
           # Build expected stderr up to and including the "warnings being
           # treated as errors" message.
           ]AT_DATA([[at-bison-check-warnings]], [$4])[
-          at_bison_check_first="` \
-            sed -n '/: warning: /=' at-bison-check-warnings \
-            | sed -n 1p \
-          `"
-          at_bison_check_first_tmp="` \
-            sed -n '/conflicts: [0-9].*reduce$/=' at-bison-check-warnings \
-            | sed -n 1p \
-          `"
+          at_bison_check_first=`sed -n \
+            '/: warning: /{=;q;}' at-bison-check-warnings`
+          : ${at_bison_check_first:=1}
+          at_bison_check_first_tmp=`sed -n \
+            '/conflicts: [0-9].*reduce$/{=;q;}' at-bison-check-warnings`
+          : ${at_bison_check_first_tmp:=1}
           if test $at_bison_check_first_tmp -lt $at_bison_check_first; then
             at_bison_check_first=$at_bison_check_first_tmp
           fi
@@ -324,11 +322,9 @@ m4_if(m4_bregexp([$4], [: warning: ]), [-1], [],
           # complaints cause bison to exit early.  Thus, with -Werror, bison
           # does not necessarily report all warnings that it does without
           # -Werror, but it at least reports one.
-          at_bison_check_last="`sed -n '$=' stderr`"
-          if test x"$at_bison_check_last" = x; then
-            at_bison_check_last=1
-          fi
-          at_bison_check_last="`expr $at_bison_check_last - 1`"
+          at_bison_check_last=`sed -n '$=' stderr`
+          : ${at_bison_check_last:=1}
+          at_bison_check_last=`expr $at_bison_check_last - 1`
           sed -n "$at_bison_check_first,$at_bison_check_last"p \
             at-bison-check-warnings >> experr
           ]AT_CHECK([[sed 's,.*/\(]AT_BISON_WERROR_MSG[\)$,\1,' \
@@ -619,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]],
@@ -638,4 +645,15 @@ m4_popdef([AT_COND_CASE])])
 
 AT_INIT
 
+# Cannot assign CC and CFLAGS here, since atlocal is loaded after
+# options are processed, so we don't know the value of CXX and
+# CXXFLAGS yet.
+#
+# Note that it also means that command line values for CXX and
+# CXXFLAGS will not be propagated to CC and CFLAGS.
+AT_ARG_OPTION([compile-c-with-cxx],
+              [compile C parsers with the C++ compiler])
+
+AT_COLOR_TESTS
+
 AT_TESTED([bison])