summaryrefslogtreecommitdiff
path: root/data/skeletons/d.m4
diff options
context:
space:
mode:
authorAkim Demaille <akim.demaille@gmail.com>2021-08-07 09:30:24 +0200
committerAkim Demaille <akim.demaille@gmail.com>2021-08-07 12:53:19 +0200
commit80db1029e67e5d42fa6329489558b114fdfea880 (patch)
tree72f350019318187faa1d941c04eb79145cf996c0 /data/skeletons/d.m4
parent6118406c3eac88a06a414edf4a50b175fa339916 (diff)
downloadbison-80db1029e67e5d42fa6329489558b114fdfea880.tar.gz
m4: catch suspicions of unevaluated macros
Check in m4's output if there are sequences such as m4_foo or b4_foo, which are probably resulting from incorrect m4 processing. It actually already is useful: - it caught a leaking b4_lac_if leaking from glr.c, where LAC is not supported, hence b4_lac_if is not defined. - it also caught references to location.hh in position.hh when location.hh does not exist. - while making "Code injection" robust to these new warnings (it is its very purpose to let b4_canary pass unevaluated), I saw that it did not check lalr1.d, and when adding lalr1.d, it revealed it did underquote ocurrences of token value types. * src/scan-skel.l (macro): New abbreviation. Use it. * data/skeletons/glr.c: Don't use b4_lac_if, we don't have it. * data/skeletons/location.cc: Don't generate position.hh when we don't generate location.hh. * data/skeletons/d.m4 (b4_basic_symbol_constructor_define): Fix underquotation. * data/skeletons/bison.m4 (b4_canary): New. * tests/input.at (Code injection): Use it, and check lalr1.d too.
Diffstat (limited to 'data/skeletons/d.m4')
-rw-r--r--data/skeletons/d.m44
1 files changed, 2 insertions, 2 deletions
diff --git a/data/skeletons/d.m4 b/data/skeletons/d.m4
index b69df1a7..c0632e47 100644
--- a/data/skeletons/d.m4
+++ b/data/skeletons/d.m4
@@ -586,7 +586,7 @@ alias ACCEPT = ]b4_parser_class[.YYACCEPT;]])[]])[
# Create Symbol struct constructors for all the visible types.
m4_define([b4_basic_symbol_constructor_define],
[b4_token_visible_if([$1],
-[ this(TokenKind token]b4_symbol_if([$1], [has_type],
+[[ this(TokenKind token]b4_symbol_if([$1], [has_type],
[[, ]b4_union_if([], [[typeof(YYSemanticType.]])b4_symbol([$1], [type])dnl
[]b4_union_if([], [[) ]])[ val]])[]b4_locations_if([[, Location loc]])[)
{
@@ -601,7 +601,7 @@ m4_define([b4_basic_symbol_constructor_define],
value_.]b4_symbol([$1], [type])[ = val;]])])[]b4_locations_if([
location_ = loc;])[
}
-])])
+]])])
# b4_symbol_type_define