Hello,
while building the latest binutils git I got this error on sysinfo.c (generated by sysinfo.y) sysinfo.c:175:6: error: conflicting types for 'yyerror' 175 | void yyerror (const char *msg); | ^~~~~~~ sysinfo.y:36:12: note: previous declaration of 'yyerror' was here 36 | static int yyerror (char *s); | ^~~~~~~ sysinfo.y:438:1: error: conflicting types for 'yyerror' 438 | yyerror (char *s) | ^~~~~~~ sysinfo.c:175:6: note: previous declaration of 'yyerror' was here 175 | void yyerror (const char *msg); and, after fixing it, the same one on arparse.c (generated by arparse.y). I think in both cases the problem is the following lines in the generated files: #if !defined yyerror && !defined YYERROR_IS_DECLARED void yyerror (const char *msg); #endif The condition gets hit and that default prototype generates the conflict. To avoid any conflict I made the definition and declaration of yyerror identical to the default prototype. The bison documentation also suggests defining yyerror as void (https://www.gnu.org/software/bison/manual/html_node/Error-Reporting-Function.html). Let me know, Andrea Monaco 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/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; }