summaryrefslogtreecommitdiff
path: root/binutils/mclex.c
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/mclex.c
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/mclex.c')
-rw-r--r--binutils/mclex.c13
1 files changed, 9 insertions, 4 deletions
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;
}