Let yyerror always receive the msg as last argument, so that

yyerror can be variadic.
* data/yacc.c (b4_yyerror_args): New.
Use it when calling yyerror.
* data/glr.c (b4_yyerror_args, b4_lyyerror_args): New.
Use it when calling yyerror.
* doc/bison.texinfo (Error Reporting): Adjust.
* tests/calc.at (_AT_DATA_CALC_Y): Adjust.
* tests/cxx-type.at (_AT_TEST_GLR_CALC): Adjust.
This commit is contained in:
Akim Demaille
2002-11-07 12:52:19 +00:00
parent 0e25cad542
commit 93724f139a
6 changed files with 74 additions and 33 deletions

View File

@@ -100,9 +100,9 @@ static int power (int base, int exponent);
/* yyerror receives the location if:
- %location & %pure & %glr
- %location & %pure & %yacc & %parse-param. */
static void yyerror (const char *s
]AT_YYERROR_ARG_LOC_IF([, YYLTYPE *yylloc])[
]AT_PARAM_IF([, value_t *result, int *count])[
static void yyerror (]AT_YYERROR_ARG_LOC_IF([YYLTYPE *yylloc, ])[
]AT_PARAM_IF([value_t *result, int *count, ])[
const char *s
);
static int yylex (LEX_FORMALS);
static int yygetc (LEX_FORMALS);
@@ -154,9 +154,10 @@ exp:
FILE *yyin;
static void
yyerror (const char *s
]AT_YYERROR_ARG_LOC_IF([, YYLTYPE *yylloc])[
]AT_PARAM_IF([, value_t *result, int *count])[)
yyerror (]AT_YYERROR_ARG_LOC_IF([YYLTYPE *yylloc, ])[
]AT_PARAM_IF([value_t *result, int *count, ])[
const char *s
)
{
]AT_PARAM_IF([(void) result; (void) count; ])[
]AT_YYERROR_SEES_LOC_IF([

View File

@@ -36,10 +36,11 @@ $1
]m4_bmatch([$2], [stmtMerge],
[ static YYSTYPE stmtMerge (YYSTYPE x0, YYSTYPE x1);])[
#define YYINITDEPTH 10
int yyerror (const char *s
int yyerror (
#if YYPURE && YYLSP_NEEDED
, YYLTYPE *yylocation
YYLTYPE *yylocation,
#endif
const char *s
);
#if YYPURE
@@ -157,10 +158,11 @@ yylex ()
}
int
yyerror (const char *s
yyerror (
#if YYPURE && YYLSP_NEEDED
, YYLTYPE *yylocation
YYLTYPE *yylocation,
#endif
const char *s
)
{
#if YYPURE && YYLSP_NEEDED