Skip to content

Conversation

@a3a3el
Copy link
Contributor

@a3a3el a3a3el commented Sep 11, 2025

Pre-ANSI function declarators which do not declare their parameters have been removed in C23 and the syntax reused for declaring functions with no parameters (like C++). GCC 15 defaults to C23, so these declarators may cause compilation failures. For example:

parse_tab.c: In function 'yyparse':
parse_tab.c:2117:7: error: too many arguments to function 'yyerror'; expected 0, have 1
 2117 |       yyerror (YY_("syntax error"));
      |       ^~~~~~~
parse_tab.y:105:6: note: declared here
  105 | void yyerror();
      |      ^~~~~~~
parse_tab.c:2228:3: error: too many arguments to function 'yyerror'; expected 0, have 1
 2228 |   yyerror (YY_("memory exhausted"));
      |   ^~~~~~~
parse_tab.y:105:6: note: declared here
  105 | void yyerror();
      |      ^~~~~~~

Explicitly specify the parameters of yyerror and yylex.

Pre-ANSI function declarators which do not declare their parameters have been
removed in C23 and the syntax reused for declaring functions with no parameters
(like C++).  GCC 15 defaults to C23, so these declarators may cause compilation
failures.  For example:

	parse_tab.c: In function 'yyparse':
	parse_tab.c:2117:7: error: too many arguments to function 'yyerror'; expected 0, have 1
	 2117 |       yyerror (YY_("syntax error"));
	      |       ^~~~~~~
	parse_tab.y:105:6: note: declared here
	  105 | void yyerror();
	      |      ^~~~~~~
	parse_tab.c:2228:3: error: too many arguments to function 'yyerror'; expected 0, have 1
	 2228 |   yyerror (YY_("memory exhausted"));
	      |   ^~~~~~~
	parse_tab.y:105:6: note: declared here
	  105 | void yyerror();
	      |      ^~~~~~~

Explicitly specify the parameters of `yyerror` and `yylex`.

Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
Copy link
Member

@garlick garlick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Looks good to me.

@garlick garlick merged commit d009acd into chaos:master Sep 11, 2025
3 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants