mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-19 17:23:02 +00:00
c: no longer require stdio.h when locations are enabled
Recent changes (in 2.7) introduced a dependency on both FILE and fprintf, which are "available" only in %debug mode. This was to define yy_location_print_, which is used only in %debug mode by the parser, but massively used by the test suite to output the locations in yyerror. Break this dependency: the test suite should define its own routines to display the locations. Eventually Bison will provide the user with a means to display locations, but not yet. * data/c.m4 (b4_yy_location_print_define): Use YYFPRINTF instead of fprintf directly. * data/yacc.c (b4_yy_location_print_define): Invoke it only in %debug mode, so that stdio.h is included (needed for FILE*), and YYFPRINTF is defined. * tests/local.at (AT_YYERROR_DECLARE, AT_YYERROR_DEFINE): Declare and define location_print and LOCATION_PRINT. * tests/actions.at, tests/existing.at, tests/glr-regression.at, * tests/input.at, tests/named-refs.at, tests/regression.at: Adjust to use them. Fix the expected line numbers (as the prologue's length has changed).
This commit is contained in:
@@ -188,7 +188,9 @@ AT_CLEANUP
|
||||
|
||||
|
||||
|
||||
#######################################################################
|
||||
## ------------------------------------ ##
|
||||
## Undefined and ambiguous references. ##
|
||||
## ------------------------------------ ##
|
||||
|
||||
|
||||
AT_SETUP([Undefined and ambiguous references])
|
||||
@@ -250,44 +252,47 @@ exp:
|
||||
]])
|
||||
|
||||
AT_BISON_CHECK([-fcaret -o test.c test.y], 1, [],
|
||||
[[test.y:50.51-60: error: invalid reference: '$<ival>lo9'
|
||||
[[test.y:52.51-60: error: invalid reference: '$<ival>lo9'
|
||||
| exp[x] '+' { $<ival>$ = $x; } [l] exp[r] { $$ = $<ival>lo9 + $r; }
|
||||
^^^^^^^^^^
|
||||
test.y:50.3-68: symbol not found in production: lo9
|
||||
test.y:52.3-68: symbol not found in production: lo9
|
||||
| exp[x] '+' { $<ival>$ = $x; } [l] exp[r] { $$ = $<ival>lo9 + $r; }
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
test.y:51.51-60: warning: misleading reference: '$<ival>exp' [-Wother]
|
||||
test.y:53.51-60: warning: misleading reference: '$<ival>exp' [-Wother]
|
||||
| exp[x] '-' { $<ival>$ = $x; } [l] exp[r] { $$ = $<ival>exp - $r; }
|
||||
^^^^^^^^^^
|
||||
test.y:42.1-3: refers to: $exp at $$
|
||||
test.y:44.1-3: refers to: $exp at $$
|
||||
exp:
|
||||
^^^
|
||||
test.y:51.7: possibly meant: $x, hiding $exp at $1
|
||||
test.y:53.7: possibly meant: $x, hiding $exp at $1
|
||||
| exp[x] '-' { $<ival>$ = $x; } [l] exp[r] { $$ = $<ival>exp - $r; }
|
||||
^
|
||||
test.y:51.41: possibly meant: $r, hiding $exp at $4
|
||||
test.y:53.41: possibly meant: $r, hiding $exp at $4
|
||||
| exp[x] '-' { $<ival>$ = $x; } [l] exp[r] { $$ = $<ival>exp - $r; }
|
||||
^
|
||||
test.y:52.51-52: error: $l of 'exp' has no declared type
|
||||
test.y:54.51-52: error: $l of 'exp' has no declared type
|
||||
| exp[x] '*' { $<ival>$ = $x; } [l] exp[r] { $$ = $l * $r; }
|
||||
^^
|
||||
test.y:55.40-43: error: invalid reference: '$r12'
|
||||
test.y:57.40-43: error: invalid reference: '$r12'
|
||||
| exp[l] '^' exp[r] { $$ = power ($l, $r12); }
|
||||
^^^^
|
||||
test.y:55.3-47: symbol not found in production: r12
|
||||
test.y:57.3-47: symbol not found in production: r12
|
||||
| exp[l] '^' exp[r] { $$ = power ($l, $r12); }
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
test.y:56.29-33: error: invalid reference: '$expo'
|
||||
test.y:58.29-33: error: invalid reference: '$expo'
|
||||
| '(' exp ')' { $$ = $expo; }
|
||||
^^^^^
|
||||
test.y:56.3-46: symbol not found in production: expo
|
||||
test.y:58.3-46: symbol not found in production: expo
|
||||
| '(' exp ')' { $$ = $expo; }
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
]])
|
||||
AT_BISON_OPTION_POPDEFS
|
||||
AT_CLEANUP
|
||||
|
||||
#######################################################################
|
||||
|
||||
## ----------------------- ##
|
||||
## Misleading references. ##
|
||||
## ----------------------- ##
|
||||
|
||||
AT_SETUP([Misleading references])
|
||||
AT_DATA_GRAMMAR([test.y],
|
||||
|
||||
Reference in New Issue
Block a user