X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/8bb3a2e7dfd705ff7cb78fb12028557a92b4feaf..c39014ae2b8cfb2b38690633633b62800b270a17:/tests/input.at diff --git a/tests/input.at b/tests/input.at index 6f0d70c3..8d1e80d1 100644 --- a/tests/input.at +++ b/tests/input.at @@ -1,6 +1,6 @@ # Checking the Bison scanner. -*- Autotest -*- -# Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 -# Free Software Foundation, Inc. + +# Copyright (C) 2002-2011 Free Software Foundation, Inc. # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -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' ]]) @@ -1288,3 +1291,59 @@ input.y:5.19: invalid character after \-escape: \001 ]]) AT_CLEANUP + +## ------------------------- ## +## LAC: Errors for %define. ## +## ------------------------- ## + +AT_SETUP([[LAC: Errors for %define]]) + +AT_DATA([[input.y]], +[[%% +start: ; +]]) + +# parse.lac.* options are useless if LAC isn't actually activated. +AT_BISON_CHECK([[-Dparse.lac.es-capacity-initial=1 input.y]], + [[1]], [], +[[:2: %define variable `parse.lac.es-capacity-initial' is not used +]]) +AT_BISON_CHECK([[-Dparse.lac.memory-trace=full input.y]], + [[1]], [], +[[:2: %define variable `parse.lac.memory-trace' is not used +]]) + +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