mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-18 08:43:03 +00:00
* data/glr.c (b4_lhs_value, b4_rhs_value, b4_rhs-location):
Parenthesize rhs to avoid obscure problems with mistakes like "foo$$bar = foo$1bar;". Problem reported by twlevo at xs4all. * data/lalr1.cc (b4_lhs_value, b4_rhs_value, b4_lhs_location, b4_rhs_location): Likewise. * data/yacc.c (b4_lhs_value, b4_rhs_value, b4_lhs_location, b4_rhs_location): Likewise.
This commit is contained in:
@@ -103,7 +103,7 @@ m4_define([b4_lpure_formals],
|
||||
# --------------------
|
||||
# Expansion of $<TYPE>$.
|
||||
m4_define([b4_lhs_value],
|
||||
[(*yyvalp)[]m4_ifval([$1], [.$1])])
|
||||
[((*yyvalp)[]m4_ifval([$1], [.$1]))])
|
||||
|
||||
|
||||
# b4_rhs_value(RULE-LENGTH, NUM, [TYPE])
|
||||
@@ -111,7 +111,7 @@ m4_define([b4_lhs_value],
|
||||
# Expansion of $<TYPE>NUM, where the current rule has RULE-LENGTH
|
||||
# symbols on RHS.
|
||||
m4_define([b4_rhs_value],
|
||||
[((yyGLRStackItem const *)yyvsp)@{YYFILL (m4_eval([$2 - $1]))@}.yystate.yysemantics.yysval[]m4_ifval([$3], [.$3])])
|
||||
[(((yyGLRStackItem const *)yyvsp)@{YYFILL (m4_eval([$2 - $1]))@}.yystate.yysemantics.yysval[]m4_ifval([$3], [.$3]))])
|
||||
|
||||
|
||||
|
||||
@@ -131,7 +131,7 @@ m4_define([b4_lhs_location],
|
||||
# Expansion of @NUM, where the current rule has RULE-LENGTH symbols
|
||||
# on RHS.
|
||||
m4_define([b4_rhs_location],
|
||||
[((yyGLRStackItem const *)yyvsp)@{YYFILL (m4_eval([$2 - $1]))@}.yystate.yyloc])
|
||||
[(((yyGLRStackItem const *)yyvsp)@{YYFILL (m4_eval([$2 - $1]))@}.yystate.yyloc)])
|
||||
|
||||
# We do want M4 expansion after # for CPP macros.
|
||||
m4_changecom()
|
||||
|
||||
Reference in New Issue
Block a user