mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-22 10:43:02 +00:00
* src/reader.c (grammar_current_rule_check): Also check that $$
is used. Take the rule to check as argument, hence rename as... (grammar_rule_check): this. * src/reader.h, src/reader.c (grammar_rule_begin, grammar_rule_end): Rename as... (grammar_rule_begin, grammar_rule_end): these, for consistency. (grammar_midrule_action, grammar_symbol_append): Now static. * tests/torture.at (input): Don't rely on the default action being always performed. * tests/calc.at: "Set" $$ even when the action is "cut" with YYERROR or other. * tests/actions.at (Exotic Dollars): Instead of using unused values, check that the warning is issued.
This commit is contained in:
@@ -30,13 +30,13 @@ AT_SETUP([Mid-rule actions])
|
||||
# action.
|
||||
|
||||
AT_DATA_GRAMMAR([[input.y]],
|
||||
[[%{
|
||||
[[%error-verbose
|
||||
%debug
|
||||
%{
|
||||
# include <stdio.h>
|
||||
# include <stdlib.h>
|
||||
static void yyerror (const char *msg);
|
||||
static int yylex (void);
|
||||
# define YYDEBUG 1
|
||||
# define YYERROR_VERBOSE 1
|
||||
%}
|
||||
%%
|
||||
exp: { putchar ('0'); }
|
||||
@@ -91,13 +91,13 @@ AT_CLEANUP
|
||||
AT_SETUP([Exotic Dollars])
|
||||
|
||||
AT_DATA_GRAMMAR([[input.y]],
|
||||
[[%{
|
||||
[[%error-verbose
|
||||
%debug
|
||||
%{
|
||||
# include <stdio.h>
|
||||
# include <stdlib.h>
|
||||
static void yyerror (const char *msg);
|
||||
static int yylex (void);
|
||||
# define YYDEBUG 1
|
||||
# define YYERROR_VERBOSE 1
|
||||
# define USE(Var)
|
||||
%}
|
||||
|
||||
@@ -107,13 +107,12 @@ AT_DATA_GRAMMAR([[input.y]],
|
||||
};
|
||||
|
||||
%type <val> a_1 a_2 a_5
|
||||
sum_of_the_five_previous_values
|
||||
exp sum_of_the_five_previous_values
|
||||
|
||||
%%
|
||||
exp: a_1 a_2 { $<val>$ = 3; } { $<val>$ = $<val>3 + 1; } a_5
|
||||
sum_of_the_five_previous_values
|
||||
{
|
||||
USE (($1, $2, $5));
|
||||
printf ("%d\n", $6);
|
||||
}
|
||||
;
|
||||
@@ -147,7 +146,11 @@ main (void)
|
||||
}
|
||||
]])
|
||||
|
||||
AT_CHECK([bison -d -v -o input.c input.y])
|
||||
AT_CHECK([bison -d -v -o input.c input.y], 0, [],
|
||||
[input.y:30.6-34.5: warning: unused value: $1
|
||||
input.y:30.6-34.5: warning: unused value: $2
|
||||
input.y:30.6-34.5: warning: unused value: $5
|
||||
])
|
||||
AT_COMPILE([input])
|
||||
AT_PARSER_CHECK([./input], 0,
|
||||
[[15
|
||||
|
||||
Reference in New Issue
Block a user