]> git.saurik.com Git - bison.git/blobdiff - tests/input.at
Don't let -Wnone disable -Werror.
[bison.git] / tests / input.at
index f223a33220dd570242ad813c0fba461671342171..8d1e80d1161255a60feebadb71caf0a67ad1ca71 100644 (file)
@@ -653,17 +653,20 @@ AT_BISON_CHECK([-o input.c input.y])
 AT_COMPILE([input.o], [-c input.c])
 
 
-# Periods and dashes are genuine letters, they can start identifiers.
-# Digits cannot.
+# Periods are genuine letters, they can start identifiers.
+# Digits and dashes cannot.
 AT_DATA_GRAMMAR([input.y],
 [[%token .GOOD
          -GOOD
          1NV4L1D
+         -123
 %%
-start: .GOOD -GOOD
+start: .GOOD GOOD
 ]])
 AT_BISON_CHECK([-o input.c input.y], [1], [],
-[[input.y:11.10-16: invalid identifier: `1NV4L1D'
+[[input.y:10.10: invalid character: `-'
+input.y:11.10-16: invalid identifier: `1NV4L1D'
+input.y:12.10: invalid character: `-'
 ]])
 
 AT_CLEANUP
@@ -1026,7 +1029,7 @@ start: ;
 ]])
 AT_BISON_CHECK([[input.y]], [[1]], [[]],
 [[input.y:1.9-29: invalid value for %define variable `lr.default-reductions': `bogus'
-input.y:1.9-29: accepted value: `all'
+input.y:1.9-29: accepted value: `most'
 input.y:1.9-29: accepted value: `consistent'
 input.y:1.9-29: accepted value: `accepting'
 ]])
@@ -1311,3 +1314,36 @@ AT_BISON_CHECK([[-Dparse.lac.memory-trace=full input.y]],
 ]])
 
 AT_CLEANUP
+
+## --------------------------------------------- ##
+## -Werror is not affected by -Wnone and -Wall.  ##
+## --------------------------------------------- ##
+
+AT_SETUP([[-Werror is not affected by -Wnone and -Wall]])
+
+AT_DATA([[input.y]],
+[[%%
+foo-bar: ;
+]])
+
+# -Werror is not enabled by -Wall or equivalent.
+AT_BISON_CHECK([[-Wall input.y]], [[0]], [[]],
+[[input.y:2.1-7: warning: POSIX Yacc forbids dashes in symbol names: foo-bar
+]])
+AT_BISON_CHECK([[-W input.y]], [[0]], [[]],
+[[input.y:2.1-7: warning: POSIX Yacc forbids dashes in symbol names: foo-bar
+]])
+AT_BISON_CHECK([[-Wno-none input.y]], [[0]], [[]],
+[[input.y:2.1-7: warning: POSIX Yacc forbids dashes in symbol names: foo-bar
+]])
+
+# -Werror is not disabled by -Wnone or equivalent.
+AT_BISON_CHECK([[-Werror,none,yacc input.y]], [[1]], [[]], [[stderr]])
+AT_CHECK([[sed 's/^.*bison:/bison:/' stderr]], [[0]],
+[[bison: warnings being treated as errors
+input.y:2.1-7: warning: POSIX Yacc forbids dashes in symbol names: foo-bar
+]])
+[mv stderr experr]
+AT_BISON_CHECK([[-Werror,no-all,yacc input.y]], [[1]], [[]], [[experr]])
+
+AT_CLEANUP