mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-21 18:23:03 +00:00
tests: fix minor issues
* tests/actions.at: Fix some log messages. Prefer #error to fprintf: it fixes the invalid use of yyoutput in %destructor, and it is an even stronger check: that the code is not even emitted. The portability of #error is not really a problem here, since the point is anyway to have the compilation fail.
This commit is contained in:
@@ -564,11 +564,11 @@ AT_LALR1_CC_IF([typedef yy::location YYLTYPE;])[
|
|||||||
thing
|
thing
|
||||||
|
|
||||||
%destructor
|
%destructor
|
||||||
{ fprintf (stderr, "Freeing raise thing (%d@%d-%d)\n", $$, RANGE (@$)); }
|
{ fprintf (stderr, "Freeing nterm raise (%d@%d-%d)\n", $$, RANGE (@$)); }
|
||||||
raise
|
raise
|
||||||
|
|
||||||
%destructor
|
%destructor
|
||||||
{ fprintf (stderr, "Freeing check-spontaneous-errors thing (%d@%d-%d)\n", $$, RANGE (@$)); }
|
{ fprintf (stderr, "Freeing nterm check-spontaneous-errors (%d@%d-%d)\n", $$, RANGE (@$)); }
|
||||||
check-spontaneous-errors
|
check-spontaneous-errors
|
||||||
|
|
||||||
%destructor
|
%destructor
|
||||||
@@ -1002,7 +1002,7 @@ AT_DATA_GRAMMAR([[input.y]],
|
|||||||
}
|
}
|
||||||
|
|
||||||
%printer {
|
%printer {
|
||||||
fprintf (yyoutput, "<*> printer should not be called.\n");
|
#error "<*> printer should not be used."
|
||||||
} <*>
|
} <*>
|
||||||
|
|
||||||
%printer {
|
%printer {
|
||||||
@@ -1020,7 +1020,7 @@ AT_DATA_GRAMMAR([[input.y]],
|
|||||||
} 'b' 'c'
|
} 'b' 'c'
|
||||||
|
|
||||||
%destructor {
|
%destructor {
|
||||||
fprintf (yyoutput, "<*> destructor should not be called.\n");
|
#error "<*> destructor should not be used."
|
||||||
} <*>
|
} <*>
|
||||||
|
|
||||||
%%
|
%%
|
||||||
@@ -1094,7 +1094,7 @@ AT_DATA_GRAMMAR([[input.y]],
|
|||||||
%}
|
%}
|
||||||
|
|
||||||
%printer {
|
%printer {
|
||||||
fprintf (yyoutput, "<> printer should not be called.\n");
|
#error "<> printer should not be used."
|
||||||
} <>
|
} <>
|
||||||
|
|
||||||
%union { int field0; int field1; int field2; }
|
%union { int field0; int field1; int field2; }
|
||||||
@@ -1121,7 +1121,7 @@ AT_DATA_GRAMMAR([[input.y]],
|
|||||||
%destructor { fprintf (stdout, "'d' destructor.\n"); } 'd'
|
%destructor { fprintf (stdout, "'d' destructor.\n"); } 'd'
|
||||||
|
|
||||||
%destructor {
|
%destructor {
|
||||||
fprintf (yyoutput, "<> destructor should not be called.\n");
|
#error "<> destructor should not be used."
|
||||||
} <>
|
} <>
|
||||||
|
|
||||||
%%
|
%%
|
||||||
@@ -1222,7 +1222,7 @@ AT_DATA_GRAMMAR([[input]]$1[[.y]],
|
|||||||
}
|
}
|
||||||
|
|
||||||
%destructor {
|
%destructor {
|
||||||
fprintf (yyoutput, "<]]not_kind[[> destructor should not be called.\n");
|
#error "<]]not_kind[[> destructor should not be used."
|
||||||
} <]]not_kind[[>
|
} <]]not_kind[[>
|
||||||
|
|
||||||
%token END 0
|
%token END 0
|
||||||
@@ -1234,7 +1234,7 @@ AT_DATA_GRAMMAR([[input]]$1[[.y]],
|
|||||||
} <]]kind[[>
|
} <]]kind[[>
|
||||||
|
|
||||||
%printer {
|
%printer {
|
||||||
fprintf (yyoutput, "<]]not_kind[[> printer should not be called.\n");
|
#error "<]]not_kind[[> printer should not be used."
|
||||||
} <]]not_kind[[>
|
} <]]not_kind[[>
|
||||||
|
|
||||||
]]m4_if($1, 0, [[[
|
]]m4_if($1, 0, [[[
|
||||||
@@ -1482,10 +1482,10 @@ AT_DATA_GRAMMAR([[input.y]],
|
|||||||
# define LOCATION_PRINT(File, Loc)
|
# define LOCATION_PRINT(File, Loc)
|
||||||
%}
|
%}
|
||||||
|
|
||||||
%printer { fprintf (yyoutput, "%d", @$); } <>
|
%printer { fprintf (yyoutput, "%d", @$); } <>
|
||||||
%destructor { fprintf (stderr, "DESTROY %d\n", @$); } <>
|
%destructor { fprintf (stderr, "DESTROY %d\n", @$); } <>
|
||||||
%printer { fprintf (yyoutput, "<*> printer should not be called"); } <*>
|
%printer { #error "<*> printer should not be used" } <*>
|
||||||
%destructor { fprintf (yyoutput, "<*> destructor should not be called"); } <*>
|
%destructor { #error "<*> destructor should not be used" } <*>
|
||||||
|
|
||||||
%%
|
%%
|
||||||
|
|
||||||
@@ -1506,19 +1506,19 @@ start:
|
|||||||
AT_BISON_OPTION_POPDEFS
|
AT_BISON_OPTION_POPDEFS
|
||||||
|
|
||||||
AT_BISON_CHECK([-o input.c input.y], 0,,
|
AT_BISON_CHECK([-o input.c input.y], 0,,
|
||||||
[[input.y:24.70-72: warning: useless %destructor for type <*> [-Wother]
|
[[input.y:24.57-59: warning: useless %destructor for type <*> [-Wother]
|
||||||
input.y:24.70-72: warning: useless %printer for type <*> [-Wother]
|
input.y:24.57-59: warning: useless %printer for type <*> [-Wother]
|
||||||
input.y:33.3-23: warning: unset value: $$ [-Wother]
|
input.y:33.3-23: warning: unset value: $$ [-Wother]
|
||||||
input.y:32.3-23: warning: unused value: $3 [-Wother]
|
input.y:32.3-23: warning: unused value: $3 [-Wother]
|
||||||
]])
|
]])
|
||||||
|
|
||||||
AT_BISON_CHECK([-fcaret -o input.c input.y], 0,,
|
AT_BISON_CHECK([-fcaret -o input.c input.y], 0,,
|
||||||
[[input.y:24.70-72: warning: useless %destructor for type <*> [-Wother]
|
[[input.y:24.57-59: warning: useless %destructor for type <*> [-Wother]
|
||||||
%printer { fprintf (yyoutput, "<*> printer should not be called"); } <*>
|
%printer { #error "<*> printer should not be used" } <*>
|
||||||
^^^
|
^^^
|
||||||
input.y:24.70-72: warning: useless %printer for type <*> [-Wother]
|
input.y:24.57-59: warning: useless %printer for type <*> [-Wother]
|
||||||
%printer { fprintf (yyoutput, "<*> printer should not be called"); } <*>
|
%printer { #error "<*> printer should not be used" } <*>
|
||||||
^^^
|
^^^
|
||||||
input.y:33.3-23: warning: unset value: $$ [-Wother]
|
input.y:33.3-23: warning: unset value: $$ [-Wother]
|
||||||
{ @$ = 4; } // Only used.
|
{ @$ = 4; } // Only used.
|
||||||
^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|||||||
Reference in New Issue
Block a user