Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Silence compiler warnings #238

Merged
merged 3 commits into from
Nov 15, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions spec/lrama/integration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def test_rules(rules, input, expected, command_args: [], debug: false)

%%

program : { (void)yynerrs; }
program : /* empty */
| expr { printf("=> %d", $1); }
;
expr : NUM
Expand Down Expand Up @@ -149,7 +149,7 @@ def test_rules(rules, input, expected, command_args: [], debug: false)

%%

program : { }
program : /* empty */
;

Grammar
Expand Down Expand Up @@ -195,7 +195,7 @@ def test_rules(rules, input, expected, command_args: [], debug: false)

%%

program : { (void)yynerrs; }
program : /* empty */
| expr { printf("=> %d", $1); }
;
expr : NUM
Expand Down Expand Up @@ -290,8 +290,6 @@ def test_rules(rules, input, expected, command_args: [], debug: false)

line: expr
{
(void)yynerrs;

printf("line (%d): ", @expr.first_line);
print_location(&@expr);

Expand Down Expand Up @@ -411,7 +409,7 @@ def test_rules(rules, input, expected, command_args: [], debug: false)

%%

program : { (void)yynerrs; }
program : /* empty */
| expr { printf("=> %d", $1); }
;

Expand Down Expand Up @@ -457,7 +455,7 @@ def test_rules(rules, input, expected, command_args: [], debug: false)

%%

program : { (void)yynerrs; }
program : /* empty */
| expr { printf("=> %d", $1); }
;
expr : NUM
Expand Down
1 change: 1 addition & 0 deletions template/bison/yacc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1485,6 +1485,7 @@ YYLTYPE yylloc = yyloc_default;
<%# b4_declare_parser_state_variables -%>
/* Number of syntax errors so far. */
int yynerrs = 0;
(void) yynerrs; /* Silence compiler warning. */

yy_state_fast_t yystate = 0;
/* Number of tokens to shift before error messages enabled. */
Expand Down