and return properly parenthesized result.
* data/lalar1.cc (YYLLOC_DEFAULT): Likewise.
* data/yacc.c (YYLLOC_DEFAULT): Likewise.
Remove unnecessary parentheses from uses.
* doc/bison.texinfo (Location Default Action): Describe the
conventions for parentheses.
+2003-06-20 Paul Eggert <eggert@twinsun.com>
+
+ * data/glr.c (YYLLOC_DEFAULT): Parenthesize arguments as needed,
+ and return properly parenthesized result.
+ * data/lalar1.cc (YYLLOC_DEFAULT): Likewise.
+ * data/yacc.c (YYLLOC_DEFAULT): Likewise.
+ Remove unnecessary parentheses from uses.
+ * doc/bison.texinfo (Location Default Action): Describe the
+ conventions for parentheses.
+
2003-06-19 Paul Eggert <eggert@twinsun.com>
* data/glr.c (yyremoveDeletes, yy_reduce_print, yyglrReduce,
#ifndef YYLLOC_DEFAULT
# define YYLLOC_DEFAULT(yyCurrent, yyRhs, YYN) \
- (yyCurrent).first_line = YYRHSLOC(yyRhs,1).first_line; \
- (yyCurrent).first_column = YYRHSLOC(yyRhs,1).first_column; \
- (yyCurrent).last_line = YYRHSLOC(yyRhs,YYN).last_line; \
- (yyCurrent).last_column = YYRHSLOC(yyRhs,YYN).last_column;
+ ((yyCurrent).first_line = YYRHSLOC(yyRhs, 1).first_line, \
+ (yyCurrent).first_column = YYRHSLOC(yyRhs, 1).first_column, \
+ (yyCurrent).last_line = YYRHSLOC(yyRhs, YYN).last_line, \
+ (yyCurrent).last_column = YYRHSLOC(yyRhs, YYN).last_column)
#endif
]],[
#ifndef YYLLOC_DEFAULT
-# define YYLLOC_DEFAULT(yyCurrent, yyRhs, YYN)
+# define YYLLOC_DEFAULT(yyCurrent, yyRhs, YYN) ((void) 0)
#endif
])[
b4_syncline([@oline@], [@ofile@])[
#ifndef YYLLOC_DEFAULT
# define YYLLOC_DEFAULT(Current, Rhs, N) \
- Current.end = Rhs[N].end;
+ ((Current).end = Rhs[N].end)
#endif
namespace yy
are run). */
#ifndef YYLLOC_DEFAULT
-# define YYLLOC_DEFAULT(Current, Rhs, N) \
- Current.first_line = Rhs[1].first_line; \
- Current.first_column = Rhs[1].first_column; \
- Current.last_line = Rhs[N].last_line; \
- Current.last_column = Rhs[N].last_column;
+# define YYLLOC_DEFAULT(Current, Rhs, N) \
+ ((Current).first_line = (Rhs)[1].first_line, \
+ (Current).first_column = (Rhs)[1].first_column, \
+ (Current).last_line = (Rhs)[N].last_line, \
+ (Current).last_column = (Rhs)[N].last_column)
#endif
/* YYLEX -- calling `yylex' with the right arguments. */
]b4_location_if(
[ /* Default location. */
- YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);])[
+ YYLLOC_DEFAULT (yyloc, yylsp - yylen, yylen);])[
YY_REDUCE_PRINT (yyn);
switch (yyn)
]{
YYDPRINTF ((stderr, "Shifting error token, "));
*++yyvsp = yylval;
-]b4_location_if([ YYLLOC_DEFAULT (yyloc, yylsp, (yylerrsp - yylsp));
+]b4_location_if([ YYLLOC_DEFAULT (yyloc, yylsp, yylerrsp - yylsp);
*++yylsp = yyloc;])[
yystate = yyn;
@example
@group
-#define YYLLOC_DEFAULT(Current, Rhs, N) \
- Current.first_line = Rhs[1].first_line; \
- Current.first_column = Rhs[1].first_column; \
- Current.last_line = Rhs[N].last_line; \
- Current.last_column = Rhs[N].last_column;
+# define YYLLOC_DEFAULT(Current, Rhs, N) \
+ ((Current).first_line = (Rhs)[1].first_line, \
+ (Current).first_column = (Rhs)[1].first_column, \
+ (Current).last_line = (Rhs)[N].last_line, \
+ (Current).last_column = (Rhs)[N].last_column)
@end group
@end example
@example
@group
-#define YYLLOC_DEFAULT(Current, Rhs, N) \
- Current.first_line = YYRHSLOC(Rhs,1).first_line; \
- Current.first_column = YYRHSLOC(Rhs,1).first_column; \
- Current.last_line = YYRHSLOC(Rhs,N).last_line; \
- Current.last_column = YYRHSLOC(Rhs,N).last_column;
+# define YYLLOC_DEFAULT(yyCurrent, yyRhs, YYN) \
+ ((yyCurrent).first_line = YYRHSLOC(yyRhs, 1).first_line, \
+ (yyCurrent).first_column = YYRHSLOC(yyRhs, 1).first_column, \
+ (yyCurrent).last_line = YYRHSLOC(yyRhs, YYN).last_line, \
+ (yyCurrent).last_column = YYRHSLOC(yyRhs, YYN).last_column)
@end group
@end example
@item
For consistency with semantic actions, valid indexes for the location
array range from 1 to @var{n}.
+
+@item
+Your macro should parenthesize its arguments, if need be, since the
+actual arguments may not be surrounded by parentheses. Also, your
+macro should expand to something that can be used as a single
+statement when it is followed by a semicolon.
@end itemize
@node Declarations