summaryrefslogtreecommitdiff
path: root/binutils
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2021-11-06 20:48:14 +1030
committerAlan Modra <amodra@gmail.com>2021-11-06 21:15:49 +1030
commit314ec7aeeb1b2e68f0d8fb9990f2335f475a6e33 (patch)
tree55e741cd404603b278fabe83cf3cb9f04eb4feb4 /binutils
parente8f81980cee2d21605e60414a025f8b795147d9f (diff)
downloadbinutils-gdb-314ec7aeeb1b2e68f0d8fb9990f2335f475a6e33.tar.gz
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.
Diffstat (limited to 'binutils')
-rw-r--r--binutils/arparse.y5
-rw-r--r--binutils/dlltool.c4
-rw-r--r--binutils/dlltool.h2
-rw-r--r--binutils/mclex.c13
-rw-r--r--binutils/sysinfo.y7
-rw-r--r--binutils/windmc.h2
6 files changed, 17 insertions, 16 deletions
diff --git a/binutils/arparse.y b/binutils/arparse.y
index 5fee56262a1..7ea5e7ff0db 100644
--- a/binutils/arparse.y
+++ b/binutils/arparse.y
@@ -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;
}
diff --git a/binutils/dlltool.c b/binutils/dlltool.c
index e6fafb4dc84..4f337f78d24 100644
--- a/binutils/dlltool.c
+++ b/binutils/dlltool.c
@@ -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
diff --git a/binutils/dlltool.h b/binutils/dlltool.h
index 72d05378022..74e9b817161 100644
--- a/binutils/dlltool.h
+++ b/binutils/dlltool.h
@@ -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;
diff --git a/binutils/mclex.c b/binutils/mclex.c
index aa1814cc745..670e88652e9 100644
--- a/binutils/mclex.c
+++ b/binutils/mclex.c
@@ -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;
}
diff --git a/binutils/sysinfo.y b/binutils/sysinfo.y
index 3d09fc0f958..7aca49ef7f8 100644
--- a/binutils/sysinfo.y
+++ b/binutils/sysinfo.y
@@ -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;
}
diff --git a/binutils/windmc.h b/binutils/windmc.h
index edea8735801..e3ef2e314ce 100644
--- a/binutils/windmc.h
+++ b/binutils/windmc.h
@@ -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);