[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 5/7] warn about typed mid-rule actions in Yacc mode
From: |
Akim Demaille |
Subject: |
[PATCH 5/7] warn about typed mid-rule actions in Yacc mode |
Date: |
Sun, 5 Aug 2018 16:09:57 +0200 |
* src/reader.c (grammar_current_rule_action_append): Warn.
* tests/input.at (AT_CHECK_UNUSED_VALUES): Check.
---
src/reader.c | 3 +++
tests/input.at | 22 ++++++++++++++++++++++
2 files changed, 25 insertions(+)
diff --git a/src/reader.c b/src/reader.c
index 198908cc..7d9e3b06 100644
--- a/src/reader.c
+++ b/src/reader.c
@@ -528,6 +528,9 @@ grammar_current_rule_action_append (const char *action,
location loc,
{
if (current_rule->action_props.code)
grammar_midrule_action ();
+ if (type)
+ complain (&loc, Wyacc,
+ _("POSIX Yacc does not support typed midrule actions"));
/* After all symbol declarations have been parsed, packgram invokes
code_props_translate_code. */
code_props_rule_action_init (¤t_rule->action_props, action, loc,
diff --git a/tests/input.at b/tests/input.at
index 037a9afe..44be3942 100644
--- a/tests/input.at
+++ b/tests/input.at
@@ -343,6 +343,28 @@ input.y:26.40-42: warning: unset value: $][$ [-Wother]
o: INT | INT <integer>{ } INT <integer>{ } INT { $][$ = $][1 + $][2 + $][3 +
$][4 + $][5; };
^^^
]])
+
+AT_BISON_CHECK([-Wnone,yacc -fcaret input.y],
+ [0], [],
+[[input.y:24.23-34: warning: POSIX Yacc does not support typed midrule actions
[-Wyacc]
+ m: INT | INT <integer>{ $][$ = $][1; } INT <integer>{ $][$ = $][2 + $][3; }
INT { $][$ = $][4 + $][5; };
+ ^^^^^^^^^^^^
+input.y:24.49-65: warning: POSIX Yacc does not support typed midrule actions
[-Wyacc]
+ m: INT | INT <integer>{ $][$ = $][1; } INT <integer>{ $][$ = $][2 + $][3; }
INT { $][$ = $][4 + $][5; };
+ ^^^^^^^^^^^^^^^^^
+input.y:25.23-25: warning: POSIX Yacc does not support typed midrule actions
[-Wyacc]
+ n: INT | INT <integer>{ } INT <integer>{ } INT { };
+ ^^^
+input.y:25.40-42: warning: POSIX Yacc does not support typed midrule actions
[-Wyacc]
+ n: INT | INT <integer>{ } INT <integer>{ } INT { };
+ ^^^
+input.y:26.23-25: warning: POSIX Yacc does not support typed midrule actions
[-Wyacc]
+ o: INT | INT <integer>{ } INT <integer>{ } INT { $][$ = $][1 + $][2 + $][3 +
$][4 + $][5; };
+ ^^^
+input.y:26.40-42: warning: POSIX Yacc does not support typed midrule actions
[-Wyacc]
+ o: INT | INT <integer>{ } INT <integer>{ } INT { $][$ = $][1 + $][2 + $][3 +
$][4 + $][5; };
+ ^^^
+]])
])
## --------------- ##
--
2.18.0