summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam James <sam@gentoo.org>2024-12-25 01:51:48 +0000
committerSam James <sam@gentoo.org>2024-12-25 02:18:07 +0000
commit61eac6a05a0fe99965cdb88163672aa9ab7f77e7 (patch)
treea8ea35d12302c7f6e63a72eca371ef138b2a1f40
parent0025805e303623386f1134b5f5f646bb40b00186 (diff)
downloadmeson-61eac6a05a0fe99965cdb88163672aa9ab7f77e7.tar.gz
test cases: fix '8 flex' with C23
With C23 (as upcoming GCC 15 will default to), `void yyerror()` is the same as `void yyerror(void)`, i.e. `yyerror` takes no arguments. Fix the prototype given we *do* call it with an error string: ``` pgen.p/parser.tab.c: In function ‘yyparse’: pgen.p/parser.tab.c:1104:7: error: too many arguments to function ‘yyerror’ 1104 | yyerror (YY_("syntax error")); | ^~~~~~~ ../test cases/frameworks/8 flex/parser.y:3:12: note: declared here 3 | extern int yyerror(); | ^~~~~~~ pgen.p/parser.tab.c:1215:3: error: too many arguments to function ‘yyerror’ 1215 | yyerror (YY_("memory exhausted")); | ^~~~~~~ ../test cases/frameworks/8 flex/parser.y:3:12: note: declared here 3 | extern int yyerror(); | ^~~~~~~ ``` Bug: https://bugs.gentoo.org/946625
-rw-r--r--test cases/frameworks/8 flex/lexer.l4
-rw-r--r--test cases/frameworks/8 flex/parser.y2
-rw-r--r--test cases/frameworks/8 flex/prog.c4
3 files changed, 5 insertions, 5 deletions
diff --git a/test cases/frameworks/8 flex/lexer.l b/test cases/frameworks/8 flex/lexer.l
index ca6513cb8..23a5f4869 100644
--- a/test cases/frameworks/8 flex/lexer.l
+++ b/test cases/frameworks/8 flex/lexer.l
@@ -3,11 +3,11 @@
#include "parser.tab.h"
extern int yylex(void);
-extern int yyerror();
+extern int yyerror(char *s);
%}
%option noyywrap nounput noinput
%%
("true"|"false") {return BOOLEAN;}
-. { yyerror(); }
+. { yyerror("Invalid value"); }
diff --git a/test cases/frameworks/8 flex/parser.y b/test cases/frameworks/8 flex/parser.y
index 663f2f3cf..ba8004efd 100644
--- a/test cases/frameworks/8 flex/parser.y
+++ b/test cases/frameworks/8 flex/parser.y
@@ -1,6 +1,6 @@
%{
extern int yylex(void);
-extern int yyerror();
+extern int yyerror(char *s);
%}
%token BOOLEAN
diff --git a/test cases/frameworks/8 flex/prog.c b/test cases/frameworks/8 flex/prog.c
index ae481d098..840a0644a 100644
--- a/test cases/frameworks/8 flex/prog.c
+++ b/test cases/frameworks/8 flex/prog.c
@@ -24,7 +24,7 @@ int yywrap(void) {
return 0;
}
-int yyerror(void) {
- printf("Parse error\n");
+int yyerror(char* s) {
+ printf("Parse error: %s\n", s);
exit(1);
}