yyerror: update to POSIX standard

To comply with the latest POSIX standard, in Yacc compatibility mode
(options `-y`/`--yacc`) Bison now generates prototypes for yyerror and
yylex.  In some situations, this is breaking compatibility: if the user
has already declared these functions but with some differences (e.g., to
declare them as static, or to use specific attributes), the generated
parser will fail to compile.  To disable these prototypes, #define yyerror
(to `yyerror`), and likewise for yylex.

refer: https://git.savannah.gnu.org/cgit/bison.git/tree/NEWS

GNU Bison 3.8
This commit is contained in:
heitbaum
2021-09-10 00:28:16 +10:00
committed by Luke Howard
parent 3afd037fa3
commit c7bd01c62a
4 changed files with 7 additions and 4 deletions

View File

@@ -78,7 +78,7 @@ error_message (const char *format, ...)
}
void
yyerror (char *s)
yyerror (const char *s)
{
error_message("%s\n", s);
}

View File

@@ -51,5 +51,6 @@ extern char *filename;
extern int error_flag;
void error_message (const char *format, ...);
int yylex(void);
void yyerror (char *s);
void yyerror (const char *s);
#define yyerror yyerror
extern unsigned lineno;