Modernise yyerror

Newer versions of bison emit a prototype for yyerror
	void yyerror (const char *);
This clashes with some of our old code that declares yyerror to return
an int.  Fix that in most cases by modernizing yyerror.  bfin-parse.y
uses the return value all over the place, so for there disable
generation of the prototype as specified by posix.

binutils/
	* arparse.y (yyerror): Return void.
	* dlltool.c (yyerror): Likewise.
	* dlltool.h (yyerror): Likewise.
	* sysinfo.y (yyerror): Likewise.
	* windmc.h (yyerror): Likewise.
	* mclex.c (mc_error): Extract from ..
	(yyerror): ..here, both now returning void.
gas/
	* config/bfin-parse.y (yyerror): Define.
	(yyerror): Make static.
	* itbl-parse.y (yyerror): Return void.
ld/
	* deffilep.y (def_error): Return void.
This commit is contained in:
Alan Modra
2021-11-06 20:48:14 +10:30
parent e8f81980ce
commit 314ec7aeeb
9 changed files with 26 additions and 24 deletions

View File

@@ -31,7 +31,7 @@
#include "arsup.h"
extern int verbose;
extern int yylex (void);
static int yyerror (const char *);
static void yyerror (const char *);
%}
%union {
@@ -193,11 +193,10 @@ verbose_command:
%%
static int
static void
yyerror (const char *x ATTRIBUTE_UNUSED)
{
extern int linenumber;
printf (_("Syntax error in archive script, line %d\n"), linenumber + 1);
return 0;
}

View File

@@ -990,13 +990,11 @@ static int d_nforwards = 0; /* Number of forwarded exports. */
static int d_is_dll;
static int d_is_exe;
int
void
yyerror (const char * err ATTRIBUTE_UNUSED)
{
/* xgettext:c-format */
non_fatal (_("Syntax error in def file %s:%d"), def_file, linenumber);
return 0;
}
void

View File

@@ -31,7 +31,7 @@ extern void def_section (const char *, int);
extern void def_stacksize (int, int);
extern void def_version (int, int);
extern int yyparse (void);
extern int yyerror (const char *);
extern void yyerror (const char *);
extern int yylex (void);
extern int yydebug;

View File

@@ -103,14 +103,19 @@ mc_fatal (const char *s, ...)
}
int
yyerror (const char *s, ...)
static void
mc_error (const char *s, ...)
{
va_list argp;
va_start (argp, s);
show_msg ("parser", s, argp);
va_end (argp);
return 1;
}
void
yyerror (const char *s)
{
mc_error (s);
}
static unichar *
@@ -451,7 +456,7 @@ yylex (void)
yylval.ustr = get_diff (input_stream_pos, start_token);
return MCIDENT;
}
yyerror ("illegal character 0x%x.", ch);
mc_error ("illegal character 0x%x.", ch);
}
return -1;
}

View File

@@ -33,7 +33,7 @@ static int rdepth;
static char *names[] = {" ","[n]","[n][m]"};
static char *pnames[]= {"","*","**"};
static int yyerror (char *s);
static void yyerror (const char *s);
extern int yylex (void);
%}
@@ -434,9 +434,8 @@ if (writecode == 'd')
return 0;
}
static int
yyerror (char *s)
static void
yyerror (const char *s)
{
fprintf(stderr, "%s\n" , s);
return 0;
}

View File

@@ -80,7 +80,7 @@ mc_node_lang *mc_add_node_lang (mc_node *, const mc_keyword *, rc_uint_type);
mc_node *mc_add_node (void);
/* Standard yacc/flex stuff. */
int yyerror (const char *, ...);
void yyerror (const char *);
int yylex (void);
int yyparse (void);