1 # Checking the Bison scanner. -*- Autotest -*-
3 # Copyright (C) 2002-2012 Free Software Foundation, Inc.
5 # This program is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation, either version 3 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program. If not, see <http://www.gnu.org/licenses/>.
18 AT_BANNER([[Input Processing.]])
20 # Mostly test that we are robust to mistakes.
23 ## ---------------- ##
25 ## ---------------- ##
27 AT_SETUP([Invalid inputs])
39 AT_CHECK([[$PERL -pi -e 's/\\(\d{3})/chr(oct($1))/ge' input.y || exit 77]])
41 AT_BISON_CHECK([input.y], [1], [],
42 [[input.y:1.1-2: error: invalid characters: '\0\001\002\377?'
43 input.y:3.1: error: invalid character: '?'
44 input.y:4.14: error: invalid character: '}'
45 input.y:5.1: error: invalid character: '%'
46 input.y:5.2: error: invalid character: '&'
47 input.y:6.1-17: error: invalid directive: '%a-does-not-exist'
48 input.y:7.1: error: invalid character: '%'
49 input.y:7.2: error: invalid character: '-'
50 input.y:8.1-9.0: error: missing '%}' at end of file
51 input.y:8.1-9.0: error: syntax error, unexpected %{...%}
57 AT_SETUP([Invalid inputs with {}])
59 # We used to SEGV here. See
60 # http://lists.gnu.org/archive/html/bug-bison/2005-07/msg00053.html
72 AT_BISON_CHECK([input.y], [1], [],
73 [[input.y:3.1-15: error: syntax error, unexpected %initial-action, expecting {...}
84 AT_SETUP([Invalid $n and @n])
92 AT_BISON_CHECK([input.y], [1], [],
93 [[input.y:2.13-14: error: integer out of range: '$1'
94 input.y:3.13-14: error: integer out of range: '@1'
104 AT_SETUP([Type Clashes])
107 [[%union { int bar; }
111 exp: foo { $$; } foo { $2; } foo
117 AT_BISON_CHECK([input.y], [1], [],
118 [[input.y:5.12-13: error: $$ for the midrule at $2 of 'exp' has no declared type
119 input.y:5.24-25: error: $2 of 'exp' has no declared type
120 input.y:5.6-32: warning: type clash on default action: <bar> != <> [-Wother]
121 input.y:6.6-8: warning: type clash on default action: <bar> != <> [-Wother]
122 input.y:7.5: warning: empty rule for typed nonterminal, and no action [-Wother]
128 # _AT_UNUSED_VALUES_DECLARATIONS()
129 # --------------------------------
130 # Generate the token, type, and destructor
131 # declarations for the unused values tests.
132 m4_define([_AT_UNUSED_VALUES_DECLARATIONS],
133 [[[%token <integer> INT;
134 %type <integer> a b c d e f g h i j k l;
135 %destructor { destroy ($$); } INT a b c d e f g h i j k l;]]])
138 # AT_CHECK_UNUSED_VALUES(DECLARATIONS_AFTER, CHECK_MIDRULE_VALUES)
139 # ----------------------------------------------------------------
140 # Generate a grammar to test unused values, compile it, run it. If
141 # DECLARATIONS_AFTER is set, then the token, type, and destructor
142 # declarations are generated after the rules rather than before. If
143 # CHECK_MIDRULE_VALUES is set, then --warnings=midrule-values is set.
144 m4_define([AT_CHECK_UNUSED_VALUES],
149 ], [_AT_UNUSED_VALUES_DECLARATIONS
152 'a' a { $]2[; } | 'b' b { $]2[; } | 'c' c { $]2[; } | 'd' d { $]2[; }
153 | 'e' e { $]2[; } | 'f' f { $]2[; } | 'g' g { $]2[; } | 'h' h { $]2[; }
154 | 'i' i { $]2[; } | 'j' j { $]2[; } | 'k' k { $]2[; } | 'l' l { $]2[; }
157 a: INT | INT { } INT { } INT { };
158 b: INT | /* empty */;
159 c: INT | INT { $]1[; } INT { $<integer>2; } INT { $<integer>4; };
160 d: INT | INT { } INT { $]1[; } INT { $<integer>2; };
161 e: INT | INT { } INT { } INT { $]1[; };
162 f: INT | INT { } INT { } INT { $]$[ = $]1[ + $]3[ + $]5[; };
163 g: INT | INT { $<integer>$; } INT { $<integer>$; } INT { };
164 h: INT | INT { $<integer>$; } INT { $<integer>$ = $<integer>2; } INT { };
165 i: INT | INT INT { } { $]$[ = $]1[ + $]2[; };
166 j: INT | INT INT { $<integer>$ = 1; } { $]$[ = $]1[ + $]2[; };
167 k: INT | INT INT { $<integer>$; } { $<integer>$ = $<integer>3; } { };
168 l: INT | INT { $<integer>$ = $<integer>1; } INT { $<integer>$ = $<integer>2 + $<integer>3; } INT { $<integer>$ = $<integer>4 + $<integer>5; };]]m4_ifval($1, [
169 _AT_UNUSED_VALUES_DECLARATIONS])
172 AT_BISON_CHECK(m4_ifval($2, [ --warnings=midrule-values ])[ input.y], [0], [],
173 [[input.y:11.10-32: warning: unset value: $]$[ [-Wother]
174 input.y:11.10-32: warning: unused value: $]1[ [-Wother]
175 input.y:11.10-32: warning: unused value: $]3[ [-Wother]
176 input.y:11.10-32: warning: unused value: $]5[ [-Wother]
177 input.y:12.9: warning: empty rule for typed nonterminal, and no action [-Wother]
178 ]]m4_ifval($2, [[[input.y:13.14-20: warning: unset value: $$ [-Wmidrule-values]
179 input.y:13.26-41: warning: unset value: $$ [-Wmidrule-values]
180 ]]])[[input.y:13.10-62: warning: unset value: $]$[ [-Wother]
181 input.y:13.10-62: warning: unused value: $]3[ [-Wother]
182 input.y:13.10-62: warning: unused value: $]5[ [-Wother]
183 ]]m4_ifval($2, [[[input.y:14.14-16: warning: unset value: $$ [-Wmidrule-values]
184 ]]])[[input.y:14.10-49: warning: unset value: $]$[ [-Wother]
185 input.y:14.10-49: warning: unused value: $]3[ [-Wother]
186 input.y:14.10-49: warning: unused value: $]5[ [-Wother]
187 input.y:15.10-37: warning: unset value: $]$[ [-Wother]
188 input.y:15.10-37: warning: unused value: $]3[ [-Wother]
189 input.y:15.10-37: warning: unused value: $]5[ [-Wother]
190 input.y:17.10-58: warning: unset value: $]$[ [-Wother]
191 input.y:17.10-58: warning: unused value: $]1[ [-Wother]
192 ]]m4_ifval($2, [[[input.y:17.10-58: warning: unused value: $]2[ [-Wmidrule-values]
193 ]]])[[input.y:17.10-58: warning: unused value: $]3[ [-Wother]
194 ]]m4_ifval($2, [[[input.y:17.10-58: warning: unused value: $]4[ [-Wmidrule-values]
195 ]]])[[input.y:17.10-58: warning: unused value: $]5[ [-Wother]
196 input.y:18.10-72: warning: unset value: $]$[ [-Wother]
197 input.y:18.10-72: warning: unused value: $]1[ [-Wother]
198 input.y:18.10-72: warning: unused value: $]3[ [-Wother]
199 ]]m4_ifval($2, [[[input.y:18.10-72: warning: unused value: $]4[ [-Wmidrule-values]
200 ]]])[[input.y:18.10-72: warning: unused value: $]5[ [-Wother]
201 ]]m4_ifval($2, [[[input.y:20.10-55: warning: unused value: $]3[ [-Wmidrule-values]
202 ]]])[[input.y:21.10-68: warning: unset value: $]$[ [-Wother]
203 input.y:21.10-68: warning: unused value: $]1[ [-Wother]
204 input.y:21.10-68: warning: unused value: $]2[ [-Wother]
205 ]]m4_ifval($2, [[[input.y:21.10-68: warning: unused value: $]4[ [-Wmidrule-values]
209 ## --------------- ##
211 ## --------------- ##
213 AT_SETUP([Unused values])
214 AT_CHECK_UNUSED_VALUES
215 AT_CHECK_UNUSED_VALUES(, [1])
219 ## ------------------------------------------ ##
220 ## Unused values before symbol declarations. ##
221 ## ------------------------------------------ ##
223 AT_SETUP([Unused values before symbol declarations])
224 AT_CHECK_UNUSED_VALUES([1])
225 AT_CHECK_UNUSED_VALUES([1], [1])
229 ## --------------------------------------------- ##
230 ## Default %printer and %destructor redeclared. ##
231 ## --------------------------------------------- ##
233 AT_SETUP([Default %printer and %destructor redeclared])
236 [[%destructor { destroy ($$); } <*> <*>
237 %printer { print ($$); } <*> <*>
239 %destructor { destroy ($$); } <*>
240 %printer { print ($$); } <*>
242 %destructor { destroy ($$); } <> <>
243 %printer { print ($$); } <> <>
245 %destructor { destroy ($$); } <>
246 %printer { print ($$); } <>
252 %destructor { destroy ($$); } <*>;
253 %printer { print ($$); } <*>;
255 %destructor { destroy ($$); } <>;
256 %printer { print ($$); } <>;
259 AT_BISON_CHECK([input.y], [1], [],
260 [[input.y:1.13-29: error: %destructor redeclaration for <*>
261 input.y:1.13-29: previous declaration
262 input.y:2.10-24: error: %printer redeclaration for <*>
263 input.y:2.10-24: previous declaration
264 input.y:4.13-29: error: %destructor redeclaration for <*>
265 input.y:1.13-29: previous declaration
266 input.y:5.10-24: error: %printer redeclaration for <*>
267 input.y:2.10-24: previous declaration
268 input.y:7.13-29: error: %destructor redeclaration for <>
269 input.y:7.13-29: previous declaration
270 input.y:8.10-24: error: %printer redeclaration for <>
271 input.y:8.10-24: previous declaration
272 input.y:10.13-29: error: %destructor redeclaration for <>
273 input.y:7.13-29: previous declaration
274 input.y:11.10-24: error: %printer redeclaration for <>
275 input.y:8.10-24: previous declaration
276 input.y:17.13-29: error: %destructor redeclaration for <*>
277 input.y:4.13-29: previous declaration
278 input.y:18.10-24: error: %printer redeclaration for <*>
279 input.y:5.10-24: previous declaration
280 input.y:20.13-29: error: %destructor redeclaration for <>
281 input.y:10.13-29: previous declaration
282 input.y:21.10-24: error: %printer redeclaration for <>
283 input.y:11.10-24: previous declaration
289 ## ---------------------------------------------- ##
290 ## Per-type %printer and %destructor redeclared. ##
291 ## ---------------------------------------------- ##
293 AT_SETUP([Per-type %printer and %destructor redeclared])
296 [[%destructor { destroy ($$); } <field1> <field2>
297 %printer { print ($$); } <field1> <field2>
299 %destructor { destroy ($$); } <field1> <field1>
300 %printer { print ($$); } <field2> <field2>
306 %destructor { destroy ($$); } <field2> <field1>;
307 %printer { print ($$); } <field2> <field1>;
310 AT_BISON_CHECK([input.y], [1], [],
311 [[input.y:4.13-29: error: %destructor redeclaration for <field1>
312 input.y:1.13-29: previous declaration
313 input.y:4.13-29: error: %destructor redeclaration for <field1>
314 input.y:4.13-29: previous declaration
315 input.y:5.10-24: error: %printer redeclaration for <field2>
316 input.y:2.10-24: previous declaration
317 input.y:5.10-24: error: %printer redeclaration for <field2>
318 input.y:5.10-24: previous declaration
319 input.y:11.13-29: error: %destructor redeclaration for <field1>
320 input.y:4.13-29: previous declaration
321 input.y:11.13-29: error: %destructor redeclaration for <field2>
322 input.y:1.13-29: previous declaration
323 input.y:12.10-24: error: %printer redeclaration for <field1>
324 input.y:2.10-24: previous declaration
325 input.y:12.10-24: error: %printer redeclaration for <field2>
326 input.y:5.10-24: previous declaration
331 ## ------------------- ##
332 ## Undefined symbols. ##
333 ## ------------------- ##
335 AT_SETUP([Undefined symbols])
338 [[%printer {} foo baz
345 AT_BISON_CHECK([input.y], [1], [],
346 [[input.y:2.16-18: error: symbol bar is used, but is not defined as a token and has no rules
347 input.y:1.17-19: warning: symbol baz is used, but is not defined as a token and has no rules [-Wother]
348 input.y:1.13-15: warning: symbol foo is used, but is not defined as a token and has no rules [-Wother]
349 input.y:3.13-15: warning: symbol qux is used, but is not defined as a token and has no rules [-Wother]
355 ## ----------------------------------------------------- ##
356 ## Unassociated types used for a printer or destructor. ##
357 ## ----------------------------------------------------- ##
359 AT_SETUP([Unassociated types used for a printer or destructor])
362 [[%token <type1> tag1
365 %printer { } <type1> <type3>
366 %destructor { } <type2> <type4>
376 AT_BISON_CHECK([input.y], [0], [],
377 [[input.y:4.22-28: warning: type <type3> is used, but is not associated to any symbol [-Wother]
378 input.y:5.25-31: warning: type <type4> is used, but is not associated to any symbol [-Wother]
384 ## --------------------------------- ##
385 ## Useless printers or destructors. ##
386 ## --------------------------------- ##
388 AT_SETUP([Useless printers or destructors])
390 # AT_TEST([INPUT], [STDERR])
391 # --------------------------
392 m4_pushdef([AT_TEST],
393 [AT_DATA([[input.y]],
396 AT_BISON_CHECK([input.y], [0], [], [$2
399 AT_TEST([[%token <type1> token1
400 %token <type2> token2
401 %token <type3> token3
402 %token <type4> token4
403 %token <type5> token51 token52
404 %token <type6> token61 token62
405 %token <type7> token7
408 %destructor {} token2
410 %destructor {} token61
415 %destructor {} <type2>
417 %destructor {} <type4>
420 %destructor {} <type6>
422 %destructor {} <type7>
426 [[input.y:16.13-19: warning: useless %printer for type <type1> [-Wother]
427 input.y:17.16-22: warning: useless %destructor for type <type2> [-Wother]]])
429 # If everybody is typed, <> is useless.
430 AT_TEST([[%type <type> exp
435 [[input.y:3.13-14: warning: useless %printer for type <> [-Wother]]])
437 # If nobody is typed, <*> is useless.
442 [[input.y:2.16-18: warning: useless %printer for type <*> [-Wother]]])
449 ## ---------------------------------------- ##
450 ## Unused values with default %destructor. ##
451 ## ---------------------------------------- ##
453 AT_SETUP([Unused values with default %destructor])
456 [[%destructor { destroy ($$); } <>
461 start: end end tagged tagged { $<tag>1; $3; } ;
466 AT_BISON_CHECK([input.y], [0], [],
467 [[input.y:6.8-45: warning: unset value: $$ [-Wother]
468 input.y:6.8-45: warning: unused value: $2 [-Wother]
469 input.y:7.6-8: warning: unset value: $$ [-Wother]
473 [[%destructor { destroy ($$); } <*>
478 start: end end tagged tagged { $<tag>1; $3; } ;
483 AT_BISON_CHECK([input.y], [0], [],
484 [[input.y:6.8-45: warning: unused value: $4 [-Wother]
485 input.y:8.9-11: warning: unset value: $$ [-Wother]
491 ## ----------------------------------------- ##
492 ## Unused values with per-type %destructor. ##
493 ## ----------------------------------------- ##
495 AT_SETUP([Unused values with per-type %destructor])
498 [[%destructor { destroy ($$); } <field1>
499 %type <field1> start end
503 start: end end { $1; } ;
507 AT_BISON_CHECK([input.y], [0], [],
508 [[input.y:6.8-22: warning: unset value: $$ [-Wother]
509 input.y:6.8-22: warning: unused value: $2 [-Wother]
510 input.y:7.6-8: warning: unset value: $$ [-Wother]
516 ## ---------------------- ##
517 ## Incompatible Aliases. ##
518 ## ---------------------- ##
520 AT_SETUP([Incompatible Aliases])
527 %destructor {bar} foo
532 %destructor {baz} "foo"
539 AT_BISON_CHECK([input.y], [1], [],
540 [[input.y:8.7-11: error: %type redeclaration for foo
541 input.y:3.7-11: previous declaration
542 input.y:10.13-17: error: %destructor redeclaration for foo
543 input.y:5.13-17: previous declaration
544 input.y:9.10-14: error: %printer redeclaration for foo
545 input.y:4.10-14: previous declaration
546 input.y:11.1-5: error: %left redeclaration for foo
547 input.y:6.1-5: previous declaration
554 ## ----------------------- ##
555 ## Torturing the Scanner. ##
556 ## ----------------------- ##
558 # Be sure to compile and run, so that the C compiler checks what
561 AT_SETUP([Torturing the Scanner])
563 AT_BISON_OPTION_PUSHDEFS
564 AT_DATA([input.y], [])
565 AT_BISON_CHECK([input.y], [1], [],
566 [[input.y:1.1: error: syntax error, unexpected end of file
573 AT_BISON_CHECK([input.y], [1], [],
574 [[input.y:1.1-2: error: syntax error, unexpected {...}
578 AT_DATA_GRAMMAR([input.y],
580 /* This is seen in GCC: a %{ and %} in middle of a comment. */
581 const char *foo = "So %{ and %} can be here too.";
584 /* These examples test Bison while not stressing C compilers too much.
585 Many C compilers mishandle backslash-newlines, so this part of the
586 test is inside "#if 0". The comment and string are written so that
587 the "#endif" will be seen regardless of the C compiler bugs that we
590 HP C (as of late 2002) mishandles *\[newline]\[newline]/ within a
593 The Apple Darwin compiler (as of late 2002) mishandles
594 \\[newline]' within a character constant.
599 * A comment with backslash-newlines in it. %} *\
602 /* { Close the above comment, if the C compiler mishandled it. */
605 " A string with backslash-newlines in it %{ %} \\
609 char apostrophe = '\'';
616 /* %{ and %} can be here too. */
619 /* Exercise pre-prologue dependency to %union. */
623 /* Exercise M4 quoting: '@:>@@:>@', 0. */
625 /* Also exercise %union. */
628 value ival; /* A comment to exercise an old bug. */
632 /* Exercise post-prologue dependency to %union. */
634 static YYSTYPE value_as_yystype (value val);
636 /* Exercise quotes in declarations. */
637 char quote[] = "@:>@@:>@,";
647 /* Exercise quotes in strings. */
648 %token FAKE "fake @<:@@:>@ \a\b\f\n\r\t\v\"\'\?\\\u005B\U0000005c ??!??'??(??)??-??/??<??=??> \x1\1"
651 /* Exercise M4 quoting: '@:>@@:>@', @<:@, 1. */
652 exp: '@<:@' '\1' two '$' '@' '{' oline output.or.oline.opt
654 /* Exercise quotes in braces. */
655 char tmp[] = "@<:@%c@:>@,\n";
660 two: '\x000000000000000000000000000000000000000000000000000000000000000000002';
661 oline: '@' 'o' 'l' 'i' 'n' 'e' '@' '_' '_' 'o' 'l' 'i' 'n' 'e' '_' '_';
662 output.or.oline.opt: ;|oline;;|output;;;
663 output: '#' 'o' 'u' 't' 'p' 'u' 't' ' ';
665 /* Exercise M4 quoting: '@:>@@:>@', @<:@, 2. */
668 value_as_yystype (value val)
678 static char const input[] = "@<:@\1\2$@{@oline@__@&t@oline__\
681 static size_t toknum;
682 assert (toknum < sizeof input);
683 yylval = value_as_yystype (input[toknum]);
684 return input[toknum++];
688 # Pacify Emacs'font-lock-mode: "
702 AT_BISON_OPTION_POPDEFS
704 AT_BISON_CHECK([-d -v -o input.c input.y])
705 AT_COMPILE([input.o])
707 AT_COMPILE([input], [input.o main.o])
708 AT_PARSER_CHECK([./input], 0,
715 ## ---------------------- ##
716 ## Typed symbol aliases. ##
717 ## ---------------------- ##
719 AT_SETUP([Typed symbol aliases])
721 # Bison 2.0 broke typed symbol aliases - ensure they work.
723 AT_DATA_GRAMMAR([input.y],
728 %token <val> MY_TOKEN "MY TOKEN"
735 AT_BISON_CHECK([-o input.c input.y])
744 m4_define([AT_CHECK_REQUIRE],
745 [AT_SETUP([Require $1])
746 AT_DATA_GRAMMAR([input.y],
751 AT_BISON_CHECK([-o input.c input.y], $2, [], ignore)
755 AT_CHECK_REQUIRE(1.0, 0)
756 AT_CHECK_REQUIRE(AT_PACKAGE_VERSION, 0)
757 ## FIXME: Some day augment this version number.
758 AT_CHECK_REQUIRE(100.0, 63)
761 ## ------------------------------------- ##
762 ## String aliases for character tokens. ##
763 ## ------------------------------------- ##
765 AT_SETUP([String aliases for character tokens])
767 # Bison once thought a character token and its alias were different
768 # symbols with the same user token number.
770 AT_DATA_GRAMMAR([input.y],
777 AT_BISON_CHECK([-o input.c input.y])
788 AT_BISON_OPTION_PUSHDEFS
789 AT_DATA_GRAMMAR([input.y],
791 %token WITHOUT_DASH "WITHOUT-DASH"
793 %token WITHOUT_PERIOD "WITHOUT.PERIOD"
799 start: with-dash without_dash with.period without_period;
800 with-dash: WITH-DASH;
801 without_dash: "WITHOUT-DASH";
802 with.period: WITH.PERIOD;
803 without_period: "WITHOUT.PERIOD";
808 AT_BISON_OPTION_POPDEFS
810 # POSIX Yacc accept periods, but not dashes.
811 AT_BISON_CHECK([--yacc -Wno-error input.y], [], [],
812 [[input.y:9.8-16: warning: POSIX Yacc forbids dashes in symbol names: WITH-DASH [-Wyacc]
813 input.y:18.8-16: warning: POSIX Yacc forbids dashes in symbol names: with-dash [-Wyacc]
816 # So warn about them.
817 AT_BISON_CHECK([-Wyacc input.y], [], [],
818 [[input.y:9.8-16: warning: POSIX Yacc forbids dashes in symbol names: WITH-DASH [-Wyacc]
819 input.y:18.8-16: warning: POSIX Yacc forbids dashes in symbol names: with-dash [-Wyacc]
822 # Dashes are fine for GNU Bison.
823 AT_BISON_CHECK([-o input.c input.y])
825 # Make sure we don't export silly token identifiers with periods or dashes.
826 AT_COMPILE([input.o])
829 # Periods are genuine letters, they can start identifiers.
830 # Digits and dashes cannot.
831 AT_DATA_GRAMMAR([input.y],
839 AT_BISON_CHECK([-o input.c input.y], [1], [],
840 [[input.y:10.10: error: invalid character: '-'
841 input.y:11.10-16: error: invalid identifier: '1NV4L1D'
842 input.y:12.10: error: invalid character: '-'
848 ## ----------------- ##
849 ## Numbered tokens. ##
850 ## ----------------- ##
852 AT_SETUP([Numbered tokens])
854 AT_DATA_GRAMMAR([redecl.y],
855 [[%token DECIMAL_1 11259375
856 HEXADECIMAL_1 0xabcdef
857 HEXADECIMAL_2 0xFEDCBA
860 start: DECIMAL_1 HEXADECIMAL_2;
863 AT_BISON_CHECK([redecl.y], [1], [],
864 [[redecl.y:10.10-22: error: user token number 11259375 redeclaration for HEXADECIMAL_1
865 redecl.y:9.8-16: previous declaration for DECIMAL_1
866 redecl.y:12.10-18: error: user token number 16702650 redeclaration for DECIMAL_2
867 redecl.y:11.10-22: previous declaration for HEXADECIMAL_2
870 AT_DATA_GRAMMAR([too-large.y],
871 [[%token TOO_LARGE_DEC 999999999999999999999
872 TOO_LARGE_HEX 0xFFFFFFFFFFFFFFFFFFF
874 start: TOO_LARGE_DEC TOO_LARGE_HEX
878 AT_BISON_CHECK([too-large.y], [1], [],
879 [[too-large.y:9.22-42: error: integer out of range: '999999999999999999999'
880 too-large.y:10.24-44: error: integer out of range: '0xFFFFFFFFFFFFFFFFFFF'
886 ## --------------------- ##
887 ## Unclosed constructs. ##
888 ## --------------------- ##
890 AT_SETUP([Unclosed constructs])
892 # Bison's scan-gram.l once forgot to STRING_FINISH some unclosed
893 # constructs, so they were prepended to whatever it STRING_GROW'ed
894 # next. It also threw them away rather than returning them to the
895 # parser. The effect was confusing subsequent error messages.
900 %token AB "ab" // Used to complain that "ab" was already used.
903 %token TICK_TWELVE "'12" // Used to complain that "'12" was already used.
909 // Used to report a syntax error because it didn't see any kind of symbol
915 // Used to report a syntax error because it didn't see braced code.
916 %destructor { free ($$)
919 AT_BISON_CHECK([-o input.c input.y], 1, [],
920 [[input.y:1.10-2.0: error: missing '"' at end of line
921 input.y:4.10-5.0: error: missing "'" at end of line
922 input.y:14.11-15.0: error: missing "'" at end of line
923 input.y:16.11-17.0: error: missing '"' at end of line
924 input.y:19.13-20.0: error: missing '}' at end of file
925 input.y:20.1: error: syntax error, unexpected end of file
931 ## ------------------------- ##
932 ## %start after first rule. ##
933 ## ------------------------- ##
935 AT_SETUP([%start after first rule])
937 # Bison once complained that a %start after the first rule was a
938 # redeclaration of the start symbol.
947 AT_BISON_CHECK([-o input.c input.y])
952 ## --------------------- ##
953 ## %prec takes a token. ##
954 ## --------------------- ##
956 AT_SETUP([%prec takes a token])
958 # Bison once allowed %prec sym where sym was a nonterminal.
962 start: PREC %prec PREC ;
966 AT_BISON_CHECK([input.y], [1], [],
967 [[input.y:3.1-4: error: rule given for PREC, which is a token
973 ## ------------------------------- ##
974 ## %prec's token must be defined. ##
975 ## ------------------------------- ##
977 AT_SETUP([[%prec's token must be defined]])
979 # According to POSIX, a %prec token must be defined separately.
986 AT_BISON_CHECK([[input.y]], [[0]], [],
987 [[input.y:2.8-17: warning: token for %prec is not defined: PREC [-Wother]
993 ## -------------------------------- ##
994 ## Reject unused %code qualifiers. ##
995 ## -------------------------------- ##
997 AT_SETUP([Reject unused %code qualifiers])
1007 AT_BISON_CHECK([[input-c.y]], [[1]], [],
1008 [[input-c.y:1.7: error: %code qualifier 'q' is not used
1009 input-c.y:2.7-9: error: %code qualifier 'bad' is not used
1010 input-c.y:3.7-9: error: %code qualifier 'bad' is not used
1011 input-c.y:4.7-12: error: %code qualifier 'format' is not used
1014 AT_DATA([input-c-glr.y],
1021 AT_BISON_CHECK([[input-c-glr.y]], [[1]], [],
1022 [[input-c-glr.y:1.7: error: %code qualifier 'q' is not used
1023 input-c-glr.y:2.7-9: error: %code qualifier 'bad' is not used
1024 input-c-glr.y:3.8-10: error: %code qualifier 'bad' is not used
1027 AT_DATA([input-c++.y],
1034 AT_BISON_CHECK([[input-c++.y]], [[1]], [],
1035 [[input-c++.y:1.7: error: %code qualifier 'q' is not used
1036 input-c++.y:2.7-9: error: %code qualifier 'bad' is not used
1037 input-c++.y:3.8: error: %code qualifier 'q' is not used
1040 AT_DATA([input-c++-glr.y],
1047 AT_BISON_CHECK([[input-c++-glr.y]], [[1]], [],
1048 [[input-c++-glr.y:1.7-9: error: %code qualifier 'bad' is not used
1049 input-c++-glr.y:2.7: error: %code qualifier 'q' is not used
1050 input-c++-glr.y:3.7: error: %code qualifier 'q' is not used
1053 AT_DATA([special-char-@@.y],
1060 AT_BISON_CHECK([[special-char-@@.y]], [[1]], [],
1061 [[special-char-@@.y:1.7-9: error: %code qualifier 'bad' is not used
1062 special-char-@@.y:2.7: error: %code qualifier 'q' is not used
1063 special-char-@@.y:3.7: error: %code qualifier 'q' is not used
1066 AT_DATA([special-char-@:>@.y],
1073 AT_BISON_CHECK([[special-char-@:>@.y]], [[1]], [],
1074 [[special-char-@:>@.y:1.7-9: error: %code qualifier 'bad' is not used
1075 special-char-@:>@.y:2.7: error: %code qualifier 'q' is not used
1076 special-char-@:>@.y:3.7: error: %code qualifier 'q' is not used
1082 ## ---------------- ##
1083 ## %define errors. ##
1084 ## ---------------- ##
1086 AT_SETUP([%define errors])
1088 AT_DATA([input-redefined.y],
1089 [[%define var "value1"
1090 %define var "value1"
1091 %define var "value2"
1092 %define special1 "@:>@"
1093 %define special2 "@<:@"
1098 AT_BISON_CHECK([[input-redefined.y]], [[1]], [],
1099 [[input-redefined.y:2.9-11: error: %define variable 'var' redefined
1100 input-redefined.y:1.9-11: previous definition
1101 input-redefined.y:3.10-12: error: %define variable 'var' redefined
1102 input-redefined.y:2.9-11: previous definition
1105 AT_DATA([input-unused.y],
1106 [[%define var "value"
1111 AT_BISON_CHECK([[input-unused.y]], [[1]], [],
1112 [[input-unused.y:1.9-11: error: %define variable 'var' is not used
1118 ## ----------------------------------- ##
1119 ## %define, --define, --force-define. ##
1120 ## ----------------------------------- ##
1122 AT_SETUP([[%define, --define, --force-define]])
1125 [[m4@&t@_divert_push(0)@
1126 @output(b4_parser_file_name@)@
1127 [var-dd: ]b4_percent_define_get([[var-dd]])[
1128 var-ff: ]b4_percent_define_get([[var-ff]])[
1129 var-dfg: ]b4_percent_define_get([[var-dfg]])[
1130 var-fd: ]b4_percent_define_get([[var-fd]])
1131 m4@&t@_divert_pop(0)
1133 AT_DATA([[input.y]],
1134 [[%define var-dfg "gram"
1138 AT_BISON_CHECK([[-Dvar-dd=cmd-d1 -Dvar-dd=cmd-d2 \
1139 -Fvar-ff=cmd-f1 -Fvar-ff=cmd-f2 \
1140 -Dvar-dfg=cmd-d -Fvar-dfg=cmd-f \
1141 -Fvar-fd=cmd-f -Dvar-fd=cmd-d \
1142 --skeleton ./skel.c input.y]])
1143 AT_CHECK([[cat input.tab.c]], [[0]],
1150 AT_DATA([[input-dg.y]],
1151 [[%define var "gram"
1155 AT_BISON_CHECK([[-Dvar=cmd-d input-dg.y]], [[1]], [],
1156 [[input-dg.y:1.9-11: error: %define variable 'var' redefined
1157 <command line>:2: previous definition
1160 AT_DATA([[input-unused.y]],
1164 AT_BISON_CHECK([[-Dunused-d -Funused-f input-unused.y]], [[1]], [],
1165 [[<command line>:2: error: %define variable 'unused-d' is not used
1166 <command line>:3: error: %define variable 'unused-f' is not used
1171 ## --------------------------- ##
1172 ## %define Boolean variables. ##
1173 ## --------------------------- ##
1175 AT_SETUP([[%define Boolean variables]])
1179 %define public "maybe"
1180 %define parser_class_name "Input"
1185 AT_BISON_CHECK([[Input.y]], [1], [],
1186 [[Input.y:2.9-14: error: invalid value for %define Boolean variable 'public'
1191 ## ------------------------ ##
1192 ## %define enum variables. ##
1193 ## ------------------------ ##
1195 AT_SETUP([[%define enum variables]])
1198 AT_DATA([[input.y]],
1199 [[%define lr.default-reduction bogus
1203 AT_BISON_CHECK([[input.y]], [[1]], [[]],
1204 [[input.y:1.9-28: error: invalid value for %define variable 'lr.default-reduction': 'bogus'
1205 input.y:1.9-28: accepted value: 'most'
1206 input.y:1.9-28: accepted value: 'consistent'
1207 input.y:1.9-28: accepted value: 'accepting'
1211 # FIXME: these should be indented, but we shouldn't mess with the m4 yet
1212 AT_DATA([[input.y]],
1213 [[%define api.push-pull neither
1217 AT_BISON_CHECK([[input.y]], [1], [],
1218 [[input.y:1.9-21: error: invalid value for %define variable 'api.push-pull': 'neither'
1219 input.y:1.9-21: accepted value: 'pull'
1220 input.y:1.9-21: accepted value: 'push'
1221 input.y:1.9-21: accepted value: 'both'
1226 ## -------------------------------- ##
1227 ## %define backward compatibility. ##
1228 ## -------------------------------- ##
1230 AT_SETUP([[%define backward compatibility]])
1232 # The error messages tell us whether underscores in these variables are
1233 # being converted to dashes.
1235 AT_DATA([[input.y]],
1236 [[%define api.push_pull "neither"
1240 AT_BISON_CHECK([[input.y]], [1], [],
1241 [[input.y:1.9-21: warning: deprecated %define variable name: 'api.push_pull', use 'api.push-pull' [-Wdeprecated]
1242 input.y:1.9-21: error: invalid value for %define variable 'api.push-pull': 'neither'
1243 input.y:1.9-21: accepted value: 'pull'
1244 input.y:1.9-21: accepted value: 'push'
1245 input.y:1.9-21: accepted value: 'both'
1248 AT_DATA([[input.y]],
1249 [[%define lr.keep_unreachable_states maybe
1253 AT_BISON_CHECK([[input.y]], [1], [],
1254 [[input.y:1.9-34: warning: deprecated %define variable name: 'lr.keep_unreachable_states', use 'lr.keep-unreachable-state' [-Wdeprecated]
1255 input.y:1.9-34: error: invalid value for %define Boolean variable 'lr.keep-unreachable-state'
1258 AT_DATA([[input.y]],
1259 [[%define namespace "foo"
1260 %define api.namespace "foo"
1264 AT_BISON_CHECK([[input.y]], [1], [],
1265 [[input.y:1.9-17: warning: deprecated %define variable name: 'namespace', use 'api.namespace' [-Wdeprecated]
1266 input.y:2.9-21: error: %define variable 'api.namespace' redefined
1267 input.y:1.9-17: previous definition
1270 AT_DATA([[input.y]],
1271 [[%define foo_bar "baz"
1275 AT_BISON_CHECK([[input.y]], [[1]], [],
1276 [[input.y:1.9-15: error: %define variable 'foo_bar' is not used
1281 ## ------------------------- ##
1282 ## Unused %define api.pure. ##
1283 ## ------------------------- ##
1285 AT_SETUP([[Unused %define api.pure]])
1287 # AT_CHECK_API_PURE(DECLS, VALUE)
1288 # -------------------------------
1289 # Make sure Bison reports that `%define api.pure VALUE' is unused when DECLS
1291 m4_define([AT_CHECK_API_PURE],
1293 AT_DATA([[input.y]],
1294 [[%define api.pure ]$2[
1300 AT_BISON_CHECK([[input.y]], [[1]], [],
1301 [[input.y:1.9-16: error: %define variable 'api.pure' is not used
1305 AT_CHECK_API_PURE([[%language "c++" %defines]], [[]])
1306 AT_CHECK_API_PURE([[%language "c++" %defines]], [[false]])
1307 AT_CHECK_API_PURE([[%language "c++" %defines %glr-parser]], [[""]])
1308 AT_CHECK_API_PURE([[%language "c++" %defines %glr-parser]], [[false]])
1309 AT_CHECK_API_PURE([[%language "java"]], [[true]])
1310 AT_CHECK_API_PURE([[%language "java"]], [[false]])
1314 ## -------------------------------- ##
1315 ## C++ namespace reference errors. ##
1316 ## -------------------------------- ##
1318 AT_SETUP([[C++ namespace reference errors]])
1320 # AT_CHECK_NAMESPACE_ERROR(NAMESPACE-DECL, ERROR, [ERROR], ...)
1321 # -------------------------------------------------------------
1322 # Make sure Bison reports all ERROR's for %define namespace "NAMESPACE-DECL".
1323 m4_define([AT_CHECK_NAMESPACE_ERROR],
1325 AT_DATA([[input.y]],
1328 %define api.namespace "]$1["
1333 AT_BISON_CHECK([[input.y]], [1], [],
1334 [m4_foreach([b4_arg], m4_dquote(m4_shift($@)),
1335 [[input.y:3.9-21: error: ]b4_arg[
1339 AT_CHECK_NAMESPACE_ERROR([[]],
1340 [[namespace reference is empty]])
1341 AT_CHECK_NAMESPACE_ERROR([[ ]],
1342 [[namespace reference is empty]])
1343 AT_CHECK_NAMESPACE_ERROR([[foo::::bar]],
1344 [[namespace reference has consecutive "::"]])
1345 AT_CHECK_NAMESPACE_ERROR([[foo:: ::bar]],
1346 [[namespace reference has consecutive "::"]])
1347 AT_CHECK_NAMESPACE_ERROR([[::::bar]],
1348 [[namespace reference has consecutive "::"]])
1349 AT_CHECK_NAMESPACE_ERROR([[:: ::bar]],
1350 [[namespace reference has consecutive "::"]])
1351 AT_CHECK_NAMESPACE_ERROR([[foo::bar:: ::]],
1352 [[namespace reference has consecutive "::"]],
1353 [[namespace reference has a trailing "::"]])
1354 AT_CHECK_NAMESPACE_ERROR([[foo::bar::]],
1355 [[namespace reference has a trailing "::"]])
1356 AT_CHECK_NAMESPACE_ERROR([[foo::bar:: ]],
1357 [[namespace reference has a trailing "::"]])
1358 AT_CHECK_NAMESPACE_ERROR([[::]],
1359 [[namespace reference has a trailing "::"]])
1363 ## ------------------------ ##
1364 ## Bad character literals. ##
1365 ## ------------------------ ##
1367 # Bison used to accept character literals that were empty or contained
1368 # too many characters.
1370 # FIXME: AT_DATA or some variant of AT_DATA may eventually permit
1371 # the final newline to be omitted. See the threads starting at
1372 # <http://lists.gnu.org/archive/html/bison-patches/2009-07/msg00019.html>.
1374 AT_SETUP([[Bad character literals]])
1381 AT_CHECK([[$PERL -e "print 'start: \'';" >> empty.y || exit 77]])
1383 AT_BISON_CHECK([empty.y], [1], [],
1384 [[empty.y:2.8-9: warning: empty character literal [-Wother]
1385 empty.y:3.8-4.0: warning: empty character literal [-Wother]
1386 empty.y:3.8-4.0: error: missing "'" at end of line
1387 empty.y:4.8: warning: empty character literal [-Wother]
1388 empty.y:4.8: error: missing "'" at end of file
1396 AT_CHECK([[$PERL -e "print 'start: \'ab';" >> two.y || exit 77]])
1398 AT_BISON_CHECK([two.y], [1], [],
1399 [[two.y:2.8-11: warning: extra characters in character literal [-Wother]
1400 two.y:3.8-4.0: warning: extra characters in character literal [-Wother]
1401 two.y:3.8-4.0: error: missing "'" at end of line
1402 two.y:4.8-10: warning: extra characters in character literal [-Wother]
1403 two.y:4.8-10: error: missing "'" at end of file
1411 AT_CHECK([[$PERL -e "print 'start: \'abc';" >> three.y || exit 77]])
1413 AT_BISON_CHECK([three.y], [1], [],
1414 [[three.y:2.8-12: warning: extra characters in character literal [-Wother]
1415 three.y:3.8-4.0: warning: extra characters in character literal [-Wother]
1416 three.y:3.8-4.0: error: missing "'" at end of line
1417 three.y:4.8-11: warning: extra characters in character literal [-Wother]
1418 three.y:4.8-11: error: missing "'" at end of file
1423 ## ------------------------- ##
1424 ## Bad escapes in literals. ##
1425 ## ------------------------- ##
1427 AT_SETUP([[Bad escapes in literals]])
1431 start: '\777' '\0' '\xfff' '\x0'
1432 '\uffff' '\u0000' '\Uffffffff' '\U00000000'
1436 # It is not easy to create special characters, we cannot even trust tr.
1437 # Beside we cannot even expect "echo '\0'" to output two characters
1438 # (well three with \n): at least Bash 3.2 converts the two-character
1439 # sequence "\0" into a single NUL character.
1440 AT_CHECK([[$PERL -e 'print "start: \"\\\t\\\f\\\0\\\1\" ;";' >> input.y \
1443 AT_BISON_CHECK([input.y], [1], [],
1444 [[input.y:2.9-12: error: invalid number after \-escape: 777
1445 input.y:2.8-13: warning: empty character literal [-Wother]
1446 input.y:2.16-17: error: invalid number after \-escape: 0
1447 input.y:2.15-18: warning: empty character literal [-Wother]
1448 input.y:2.21-25: error: invalid number after \-escape: xfff
1449 input.y:2.20-26: warning: empty character literal [-Wother]
1450 input.y:2.29-31: error: invalid number after \-escape: x0
1451 input.y:2.28-32: warning: empty character literal [-Wother]
1452 input.y:3.9-14: error: invalid number after \-escape: uffff
1453 input.y:3.8-15: warning: empty character literal [-Wother]
1454 input.y:3.18-23: error: invalid number after \-escape: u0000
1455 input.y:3.17-24: warning: empty character literal [-Wother]
1456 input.y:3.27-36: error: invalid number after \-escape: Uffffffff
1457 input.y:3.26-37: warning: empty character literal [-Wother]
1458 input.y:3.40-49: error: invalid number after \-escape: U00000000
1459 input.y:3.39-50: warning: empty character literal [-Wother]
1460 input.y:4.9-10: error: invalid character after \-escape: ' '
1461 input.y:4.8-11: warning: empty character literal [-Wother]
1462 input.y:4.14-15: error: invalid character after \-escape: A
1463 input.y:4.13-16: warning: empty character literal [-Wother]
1464 input.y:5.9-16: error: invalid character after \-escape: \t
1465 input.y:5.17: error: invalid character after \-escape: \f
1466 input.y:5.18: error: invalid character after \-escape: \0
1467 input.y:5.19: error: invalid character after \-escape: \001
1472 ## ------------------------- ##
1473 ## LAC: Errors for %define. ##
1474 ## ------------------------- ##
1476 AT_SETUP([[LAC: Errors for %define]])
1478 AT_DATA([[input.y]],
1483 # parse.lac.* options are useless if LAC isn't actually activated.
1484 AT_BISON_CHECK([[-Dparse.lac.es-capacity-initial=1 input.y]],
1486 [[<command line>:2: error: %define variable 'parse.lac.es-capacity-initial' is not used
1488 AT_BISON_CHECK([[-Dparse.lac.memory-trace=full input.y]],
1490 [[<command line>:2: error: %define variable 'parse.lac.memory-trace' is not used
1495 ## --------------------------------------------- ##
1496 ## -Werror is not affected by -Wnone and -Wall. ##
1497 ## --------------------------------------------- ##
1499 AT_SETUP([[-Werror is not affected by -Wnone and -Wall]])
1501 AT_DATA([[input.y]],
1506 # -Werror is not enabled by -Wall or equivalent.
1507 AT_BISON_CHECK([[-Wall input.y]], [[0]], [[]],
1508 [[input.y:2.1-7: warning: POSIX Yacc forbids dashes in symbol names: foo-bar [-Wyacc]
1510 AT_BISON_CHECK([[-W input.y]], [[0]], [[]],
1511 [[input.y:2.1-7: warning: POSIX Yacc forbids dashes in symbol names: foo-bar [-Wyacc]
1513 AT_BISON_CHECK([[-Wno-none input.y]], [[0]], [[]],
1514 [[input.y:2.1-7: warning: POSIX Yacc forbids dashes in symbol names: foo-bar [-Wyacc]
1517 # -Werror is not disabled by -Wnone or equivalent.
1518 AT_BISON_CHECK([[-Werror,none,yacc input.y]], [[1]], [[]], [[stderr]])
1519 AT_CHECK([[sed 's/^.*bison:/bison:/' stderr]], [[0]],
1520 [[input.y:2.1-7: error: POSIX Yacc forbids dashes in symbol names: foo-bar [-Werror=yacc]
1523 AT_BISON_CHECK([[-Werror,no-all,yacc input.y]], [[1]], [[]], [[experr]])
1528 ## ------------------------------------------------------ ##
1529 ## %name-prefix and %define api.prefix are incompatible. ##
1530 ## ------------------------------------------------------ ##
1532 AT_SETUP([[%name-prefix and %define api.prefix are incompatible]])
1534 # AT_TEST(DIRECTIVES, OPTIONS, ERROR-LOCATION)
1535 # --------------------------------------------
1536 m4_pushdef([AT_TEST],
1537 [AT_DATA([[input.y]],
1542 AT_BISON_CHECK([[$2 input.y]], [[1]], [[]],
1543 [[$3: error: '%name-prefix' and '%define api.prefix' cannot be used together
1547 AT_TEST([%define api.prefix foo %name-prefix "bar"], [], [input.y:1.9-18])
1548 AT_TEST([], [-Dapi.prefix=foo -p bar], [<command line>:2])
1549 AT_TEST([%name-prefix "bar"], [-Dapi.prefix=foo], [<command line>:2])
1550 AT_TEST([%define api.prefix foo], [-p bar], [input.y:1.9-18])
1552 m4_popdef([AT_TEST])
1557 ## -------------- ##
1559 ## -------------- ##
1561 AT_SETUP([[Stray $ or @]])
1563 # Give %printer and %destructor "<*> exp TOK" instead of "<*>" to
1564 # check that the warnings are reported once, not three times.
1566 AT_DATA_GRAMMAR([[input.y]],
1568 %token <TYPE> TOK TOK2
1569 %destructor { $%; @%; } <*> exp TOK;
1570 %initial-action { $%; @%; };
1571 %printer { $%; @%; } <*> exp TOK;
1573 exp: TOK { $%; @%; $$ = $1; };
1576 AT_BISON_CHECK([[input.y]], 0, [],
1577 [[input.y:11.19: warning: stray '$' [-Wother]
1578 input.y:11.23: warning: stray '@' [-Wother]
1579 input.y:12.19: warning: stray '$' [-Wother]
1580 input.y:12.23: warning: stray '@' [-Wother]
1581 input.y:13.19: warning: stray '$' [-Wother]
1582 input.y:13.23: warning: stray '@' [-Wother]
1583 input.y:15.19: warning: stray '$' [-Wother]
1584 input.y:15.23: warning: stray '@' [-Wother]
1591 ## ---------------- ##
1592 ## Code injection. ##
1593 ## ---------------- ##
1596 AT_SETUP([[Code injection]])
1598 m4_pattern_allow([^m4_errprintn$])
1602 # Try to have MACRO be run by bison.
1603 m4_pushdef([AT_TEST],
1604 [AT_DATA([[input.y]],
1605 [[%type <$1(DEAD %type)> exp
1606 %token <$1(DEAD %token)> a
1611 $<$1(DEAD %initial-action)>$
1616 $<$1(DEAD %printer)>$
1624 $1(DEAD %parse-param)
1632 $<$1(DEAD action 1)>$
1633 $<$1(DEAD action 2)>1
1634 $<$1(DEAD action 3)>name
1635 $<$1(DEAD action 4)>0
1640 # FIXME: Provide a means to iterate over all the skeletons.
1641 AT_BISON_CHECK([[-d input.y]])
1642 AT_BISON_CHECK([[-d -S glr.c input.y]])
1643 AT_BISON_CHECK([[-d -S lalr1.cc input.y]])
1644 AT_BISON_CHECK([[-d -S glr.cc input.y]])
1645 AT_BISON_CHECK([[ -S lalr1.java input.y]])
1648 AT_TEST([m4_errprintn])
1649 AT_TEST([@:>@m4_errprintn])
1651 m4_popdef([AT_TEST])
1655 ##----------------------- ##
1656 ## Deprecated directives. ##
1657 ## ---------------------- ##
1659 AT_SETUP([[Deprecated directives]])
1661 AT_KEYWORDS([[deprec]])
1663 AT_DATA_GRAMMAR([[input.y]],
1668 %file-prefix = "foo"
1686 AT_BISON_CHECK([[input.y]], [[0]], [[]],
1687 [[input.y:10.1-13: warning: deprecated directive: '%default_prec', use '%default-prec' [-Wdeprecated]
1688 input.y:11.1-14: warning: deprecated directive: '%error_verbose', use '%define parse.error verbose' [-Wdeprecated]
1689 input.y:12.1-10: warning: deprecated directive: '%expect_rr', use '%expect-rr' [-Wdeprecated]
1690 input.y:13.1-14: warning: deprecated directive: '%file-prefix =', use '%file-prefix' [-Wdeprecated]
1691 input.y:14.1-15.2: warning: deprecated directive: '%file-prefix\n =', use '%file-prefix' [-Wdeprecated]
1692 input.y:17.1-19: warning: deprecated directive: '%fixed-output_files', use '%fixed-output-files' [-Wdeprecated]
1693 input.y:18.1-19: warning: deprecated directive: '%fixed_output-files', use '%fixed-output-files' [-Wdeprecated]
1694 input.y:20.1-13: warning: deprecated directive: '%name-prefix=', use '%name-prefix' [-Wdeprecated]
1695 input.y:21.1-16: warning: deprecated directive: '%no-default_prec', use '%no-default-prec' [-Wdeprecated]
1696 input.y:22.1-16: warning: deprecated directive: '%no_default-prec', use '%no-default-prec' [-Wdeprecated]
1697 input.y:23.1-9: warning: deprecated directive: '%no_lines', use '%no-lines' [-Wdeprecated]
1698 input.y:24.1-9: warning: deprecated directive: '%output =', use '%output' [-Wdeprecated]
1699 input.y:25.1-12: warning: deprecated directive: '%pure_parser', use '%pure-parser' [-Wdeprecated]
1700 input.y:26.1-12: warning: deprecated directive: '%token_table', use '%token-table' [-Wdeprecated]
1705 ## ---------------------------- ##
1706 ## Unput's effect on locations. ##
1707 ## ---------------------------- ##
1708 dnl When the scanner detects a deprecated construct, it unputs the correct
1709 dnl version, but it should *not* have any impact on the scanner cursor. If it
1710 dnl does, the locations of directives on the same line become erroneous.
1712 AT_SETUP([[Unput's effect on locations]])
1714 AT_KEYWORDS([[deprec]])
1716 AT_DATA_GRAMMAR([[input.y]],
1719 %expect_rr 42 %expect_rr 42
1721 %error_verbose %error_verbose
1726 AT_BISON_CHECK([[input.y]], [[1]], [[]],
1727 [[input.y:11.1-10: warning: deprecated directive: '%expect_rr', use '%expect-rr' [-Wdeprecated]
1728 input.y:11.15-24: warning: deprecated directive: '%expect_rr', use '%expect-rr' [-Wdeprecated]
1729 input.y:12.15-24: warning: deprecated directive: '%expect_rr', use '%expect-rr' [-Wdeprecated]
1730 input.y:13.1-14: warning: deprecated directive: '%error_verbose', use '%define parse.error verbose' [-Wdeprecated]
1731 input.y:13.16-29: warning: deprecated directive: '%error_verbose', use '%define parse.error verbose' [-Wdeprecated]
1732 input.y:13.11-21: error: %define variable 'parse.error' redefined
1733 input.y:13-6: previous definition
1734 input.y:14.16-29: warning: deprecated directive: '%error_verbose', use '%define parse.error verbose' [-Wdeprecated]
1735 input.y:14.11-21: error: %define variable 'parse.error' redefined
1736 input.y:13.11-21: previous definition
1741 ##--------------------------- ##
1742 ## Non-deprecated directives. ##
1743 ## -------------------------- ##
1745 AT_SETUP([[Non-deprecated directives]])
1747 AT_KEYWORDS([[deprec]])
1749 AT_DATA_GRAMMAR([[input.y]],
1767 AT_BISON_CHECK([[input.y]], [[0]], [[]],
1768 [[input.y: warning: %expect-rr applies only to GLR parsers [-Wother]