]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
tests: let yacc's yyerror take its argument as a const string
authorAkim Demaille <akim@lrde.epita.fr>
Sat, 11 Sep 2021 08:06:13 +0000 (10:06 +0200)
committerPaul Eggert <eggert@cs.ucla.edu>
Sat, 11 Sep 2021 14:55:39 +0000 (07:55 -0700)
Some of yacc error messages are const strings; it makes no sense for
yyerror to take a 'char *', it should be a 'const char *' as POSIX now
requires.

Fixes all the failures reported by Kiyoshi Kanazawa.
<https://lists.gnu.org/r/bug-bison/2021-09/msg00005.html>
See bug#50469 <https://debbugs.gnu.org/50469>.

* t/cond35.sh, t/silent-many-languages.sh, t/silent-yacc-headers.sh,
* t/silent-yacc.sh, t/subpkg-yacc.sh, t/suffix10.tap, t/yacc-basic.sh,
* t/yacc-clean.sh, t/yacc-d-basic.sh, t/yacc-d-vpath.sh,
* t/yacc-deleted-headers.sh, t/yacc-depend.sh, t/yacc-depend2.sh,
* t/yacc-dist-nobuild-subdir.sh, t/yacc-dist-nobuild.sh, t/yacc-dry.sh,
* t/yacc-line.sh, t/yacc-misc.sh, t/yacc-mix-c-cxx.sh, t/yacc-nodist.sh,
* t/yacc-pr204.sh, t/yacc-subdir.sh, t/yacc-vpath.sh,
* t/yflags-cmdline-override.sh, t/yflags-force-override.sh
(yyerror): From 'char *' to 'const char *'.
Enforce consistency: prefer '{}' to '{ return; }'.

28 files changed:
t/cond35.sh
t/silent-many-languages.sh
t/silent-yacc-headers.sh
t/silent-yacc.sh
t/subpkg-yacc.sh
t/suffix10.tap
t/yacc-basic.sh
t/yacc-bison-skeleton.sh
t/yacc-clean-cxx.sh
t/yacc-clean.sh
t/yacc-cxx.sh
t/yacc-d-basic.sh
t/yacc-d-vpath.sh
t/yacc-deleted-headers.sh
t/yacc-depend.sh
t/yacc-depend2.sh
t/yacc-dist-nobuild-subdir.sh
t/yacc-dist-nobuild.sh
t/yacc-dry.sh
t/yacc-line.sh
t/yacc-misc.sh
t/yacc-mix-c-cxx.sh
t/yacc-nodist.sh
t/yacc-pr204.sh
t/yacc-subdir.sh
t/yacc-vpath.sh
t/yflags-cmdline-override.sh
t/yflags-force-override.sh

index 786bb3cf5e6354152cd736492eb38c4ebedab042..37a25eae31b9eb6e27cb6bd6af816d9bbd6b293d 100644 (file)
@@ -73,7 +73,7 @@ END
 
 cat > tparse.y << 'END'
 %{
-void yyerror (char *s) {}
+void yyerror (const char *s) {}
 %}
 %token EOF
 %%
index edb59e7c9b069ea5ab0b5c9da23d7e719a13cef4..9361b2bf8264839126ec87b2d67f1471846a4362 100644 (file)
@@ -188,7 +188,7 @@ EOF
 cat > foo6.y <<'EOF'
 %{
 extern int yylex (void);
-void yyerror (char *s) {}
+void yyerror (const char *s) {}
 %}
 %token EOF
 %%
index c10fc5cc4040fd4a34deeda07ab7b0659b36acb8..0582973f5cfa5c2f26bdfb0578623479e489d78d 100644 (file)
@@ -39,7 +39,7 @@ EOF
 
 cat > parse.y <<'EOF'
 %{
-void yyerror (char *s) { return; }
+void yyerror (const char *s) {}
 int yylex (void) { return 0; }
 int main (void) { return 0; }
 %}
index d11fc2ab2d272eb92b13189f1f4708e321d1e1ff..3254d401439a46c4e7d0caffb6543ef21f62e976 100644 (file)
@@ -50,7 +50,7 @@ EOF
 
 cat > foo.y <<'EOF'
 %{
-void yyerror (char *s) { return; }
+void yyerror (const char *s) {}
 int yylex (void) { return 0; }
 int main (void) { return 0; }
 %}
index eac56cb1f23c51fa151f3b3b16ffca8a7956b0f0..9e31c5151e8c9874016eaf8a8f576fb6094e10de 100644 (file)
@@ -88,7 +88,7 @@ EOF
 cat > lib/foo.y << 'END'
 %{
 int yylex (void) { return 0; }
-void yyerror (char *s) {}
+void yyerror (const char *s) {}
 %}
 %%
 foobar : 'f' 'o' 'o' 'b' 'a' 'r' {};
index 2258120e7887d37498c9fe0e80578032512a7bd6..d233c6c213f39e4aa7826c6a314863aebd8a8f09 100644 (file)
@@ -39,7 +39,7 @@ libfoo_la_SOURCES = foo.x_
        :; { echo '/* autogenerated */' \
          && echo '%{' \
          && echo 'int yylex () {return 0;}' \
-         && echo 'void yyerror (char *s) {}' \
+         && echo 'void yyerror (const char *s) {}' \
          && echo '%}' \
          && echo '%%' \
          && echo "foobar : 'f' 'o' 'o' 'b' 'a' 'r' {};" \
index cfbaa195778915f9ef6585a89eaa9c39c73722f9..d50157099eb38ddc68d23cf9dea9db1360e2c34e 100644 (file)
@@ -42,7 +42,7 @@ cat > parse.y << 'END'
 #include <stdio.h>
 #include <stdlib.h>
 int yylex () { return getchar (); }
-void yyerror (char *s) {}
+void yyerror (const char *s) {}
 %}
 %%
 a : 'a' { exit(0); };
index 60e85dd856199cd27b79899eb6dd967783faf26a..6069489dab5d31043445ff40154d4e7f938033d6 100644 (file)
@@ -44,7 +44,7 @@ void yyerror (const char *s);
 foobar : 'f' 'o' 'o' 'b' 'a' 'r' {};
 %%
 int yylex () { return 0; }
-void yyerror (const char *s) { return; }
+void yyerror (const char *s) {}
 END
 
 cat > foo.c << 'END'
index fe2795894c03d4664fd0b34a1a86ce10231ba0cb..811d46939a2f146289e3d2992897bb3d6ff7d7cb 100644 (file)
@@ -70,7 +70,7 @@ cat > sub1/parsefoo.yxx << 'END'
 #include <cstdio>
 // "std::" qualification required by Sun C++ 5.9.
 int yylex (void) { return std::getchar (); }
-void yyerror (const char *s) { return; }
+void yyerror (const char *s) {}
 %}
 %%
 x : 'x' { };
index 9ea13a70443a96ea3c7afe8bf4b6179c3574544e..c248e5c89b9535d9a080452e900a75cc417f51e7 100644 (file)
@@ -66,7 +66,7 @@ END
 cat > sub1/parse.y << 'END'
 %{
 int yylex () { return (getchar ()); }
-void yyerror (char *s) {}
+void yyerror (const char *s) {}
 %}
 %%
 x : 'x' { };
index 0e163eb4476af39eb2a821f1f69cc6f4fb900fed..b9dcd458bd36c1395e9c7a48decae20c87e5e727 100644 (file)
@@ -48,7 +48,7 @@ cat > parse1.yy << 'END'
 #include <cstdlib>
 // "std::" qualification required by Sun C++ 5.9.
 int yylex (void) { return std::getchar (); }
-void yyerror (const char *s) { return; }
+void yyerror (const char *s) {}
 %}
 %%
 a : 'a' { exit(0); };
index 66c11063e9c8c137c45dea3636a4062d1a4a3fec..b468d553225e653016f0fa5a08249fe7510481a7 100644 (file)
@@ -48,7 +48,7 @@ cat > foo/parse.y << 'END'
 %{
 #include "parse.h"
 int yylex () { return 0; }
-void yyerror (char *s) {}
+void yyerror (const char *s) {}
 %}
 %%
 x : 'x' {};
index e0fb951f2854c8b09a79074661e9a9c6b7155b4d..86ae07b0cdcb6b35c12effffd07d7a6fa82e6f1b 100644 (file)
@@ -41,7 +41,7 @@ END
 cat > parse.y << 'END'
 %{
 int yylex () { return 0; }
-void yyerror (char *s) {}
+void yyerror (const char *s) {}
 %}
 %token FOOBAR
 %%
@@ -74,7 +74,7 @@ $sleep
 cat > ../parse.y << 'END'
 %{
 int yylex () { return 0; }
-void yyerror (char *s) {}
+void yyerror (const char *s) {}
 %}
 %token FUBAR
 %%
@@ -94,7 +94,7 @@ $sleep
 cat > ../parse.y << 'END'
 %{
 int yylex () { return 0; }
-void yyerror (char *s) {}
+void yyerror (const char *s) {}
 %}
 %token MAUDE
 %%
index 766caac5c0bb51a30fcaddb1ed0d2314a4eb7015..5b661d1e530599c6b5cce2ef87ddfd4ee1947aa3 100644 (file)
@@ -56,7 +56,7 @@ cat > parse1.y << 'END'
 %{
 #include "parse1.h"
 int yylex () { return 0; }
-void yyerror (char *s) { return; }
+void yyerror (const char *s) {}
 %}
 %token ZARDOZ
 %%
@@ -81,7 +81,7 @@ sed 's/"parse1\.h"/"parse3.h"/' main1.c > main3.c
 cat > parse4.y << 'END'
 %{
 int yylex () { return 0; }
-void yyerror (char *s) { return; }
+void yyerror (const char *s) {}
 %}
 %%
 x : 'x' {};
index 27c704b3d5926d50ec29e4de070fcb6dfb5a15d1..dc82a316a4a34e21b0870f92a48283a617975e20 100644 (file)
@@ -36,7 +36,7 @@ END
 cat > foo.y << 'END'
 %{
 int yylex () { return 0; }
-void yyerror (char *s) { return; }
+void yyerror (const char *s) {}
 %}
 %token TOKEN
 %%
index ce730f42bf4d6cce1ff641382108742a45cde226..c2b1b9be549e26193062ef6bfc8141e788c0841d 100644 (file)
@@ -42,7 +42,7 @@ END
 cat > foo.y << 'END'
 %{
 int yylex () { return 0; }
-void yyerror (char *s) { return; }
+void yyerror (const char *s) {}
 %}
 %token TOKEN
 %%
index c918c399601d0a2271ddfc54d62633554dc659ab..8b15d2c2a07c1a85b35d5a6741a7a5e1d7ce141a 100644 (file)
@@ -36,7 +36,7 @@ mkdir sub
 cat > sub/parse.y << 'END'
 %{
 int yylex () { return 0; }
-void yyerror (char *s) { return; }
+void yyerror (const char *s) {}
 %}
 %%
 x : 'x' {};
index 5e1a2a70afe5484aa69401165acf4946e356fd84..f4d3fbcb2e6a4a0a1998ece262597d52c946942a 100644 (file)
@@ -37,7 +37,7 @@ END
 cat > parse.y << 'END'
 %{
 int yylex () { return 0; }
-void yyerror (char *s) {}
+void yyerror (const char *s) {}
 %}
 %%
 foobar : 'f' 'o' 'o' 'b' 'a' 'r' {};
index c9c1aa2e0c48a1e62bec31c64bb131856e391484..43e1422a6d6dbb9fc25e515e8ba485277d0c9e53 100644 (file)
@@ -38,7 +38,7 @@ END
 cat > parse.y << 'END'
 %{
 int yylex () { return 0; }
-void yyerror (char *s) {}
+void yyerror (const char *s) {}
 %}
 %%
 foobar : 'f' 'o' 'o' 'b' 'a' 'r' {};
index 10e8a8cd44e9e974c3f1c811f81678e3b49ec6bd..ef48d83c561fbd715f5018de8b57c0189e803c41 100644 (file)
@@ -57,7 +57,7 @@ END
 cat > zardoz.y << 'END'
 %{
 int yylex () { return 0; }
-void yyerror (char *s) { return; }
+void yyerror (const char *s) {}
 %}
 %%
 x : 'x' {};
index 2371a099f8bf83be4bfaa056c354e910d5f6ce5e..9dc8f9dfd9c5d5414257aff5e1263245b95f7d1b 100644 (file)
@@ -35,7 +35,7 @@ END
 cat > parse.y << 'END'
 %{
 int yylex () { return 0; }
-void yyerror (char *s) {}
+void yyerror (const char *s) {}
 %}
 %%
 foobar : 'f' 'o' 'o' 'b' 'a' 'r' {};
@@ -45,7 +45,7 @@ END
 cat > bar.y << 'END'
 %{
 int yylex () { return 0; }
-void yyerror (char *s) {}
+void yyerror (const char *s) {}
 %}
 %%
 fubar : 'f' 'o' 'o' 'b' 'a' 'r' {};
index ad9bf9523116028f0aee57e1a3e0bb8de495a1ae..45dffa0d2b832cc5a7daae848a8ec9677bdd7a23 100644 (file)
@@ -53,7 +53,7 @@ END
 cat > p.y <<'END'
 %{
 int yylex (void) { int new = 0; return new; }
-void yyerror (char *s) { return; }
+void yyerror (const char *s) {}
 %}
 %token ZARDOZ
 %%
@@ -85,7 +85,7 @@ cat > parse.yy <<'END'
 #include <cstdlib>
 #include "parse.hh"
 int yylex (void) { return 0; }
-void yyerror (const char *s) { return; }
+void yyerror (const char *s) {}
 %}
 %token FOOBAR
 %%
@@ -97,7 +97,7 @@ cat > parse2.y++ <<'END'
 %{
 #include <cstdlib>
 int yylex (void) { return 0; }
-void yyerror (const char *s) { return; }
+void yyerror (const char *s) {}
 %}
 %%
 x : 'x' {};
index 075e077434666c910fd7c064e1ef61a4ace36036..3b523e888fe94ec18bd70102e8bf6be1ce0e04c1 100644 (file)
@@ -59,7 +59,7 @@ parse.y:
        :; { : \
          && echo "%{" \
          && echo "int yylex () { return 0; }" \
-         && echo "void yyerror (char *s) {}" \
+         && echo "void yyerror (const char *s) {}" \
          && echo "%}" \
          && echo "%%" \
          && echo "maude : 'm' 'a' 'u' 'd' 'e' {}"; \
index 9606f7b3dd5e6dee0fbcaa0ee220a700bfc1b8ec..e07f5e5c9debba725219ba0440c157bd3f0df44d 100644 (file)
@@ -51,7 +51,7 @@ EOF
 cat > parse.y << 'END'
 %{
 int yylex () {return 0;}
-void yyerror (char *s) {}
+void yyerror (const char *s) {}
 %}
 %%
 maude : 'm' 'a' 'u' 'd' 'e' {};
index 5f38621876144b0784006e1cfc27434aeb146f55..879b433c67e759db9115db114c02652dd2b8b459 100644 (file)
@@ -49,7 +49,7 @@ mkdir foo
 cat > foo/parse.y << 'END'
 %{
 int yylex () { return 0; }
-void yyerror (char *s) {}
+void yyerror (const char *s) {}
 %}
 %%
 foobar : 'f' 'o' 'o' 'b' 'a' 'r' {};
index f9bb719daecce4574a8d5ee4a65247745f21997a..5481d9646677d668a5d60c78abe806e229e2bbc0 100644 (file)
@@ -40,7 +40,7 @@ END
 cat > parse.y << 'END'
 %{
 int yylex () { return 0; }
-void yyerror (char *s) {}
+void yyerror (const char *s) {}
 %}
 %%
 foobar : 'f' 'o' 'o' 'b' 'a' 'r' {};
@@ -67,7 +67,7 @@ $sleep
 cat > ../parse.y << 'END'
 %{
 int yylex () { return 0; }
-void yyerror (char *s) {}
+void yyerror (const char *s) {}
 %}
 %%
 fubar : 'f' 'o' 'o' 'b' 'a' 'r' {};
@@ -85,7 +85,7 @@ $sleep
 cat > ../parse.y << 'END'
 %{
 int yylex () { return 0; }
-void yyerror (char *s) {}
+void yyerror (const char *s) {}
 %}
 %%
 maude : 'm' 'a' 'u' 'd' 'e' {};
index eaee47849ed855ebf9318ca304992523a670dfae..63d31fbfa9039bd3885b9264e783feaba0cb433f 100644 (file)
@@ -43,7 +43,7 @@ END
 cat > foo.y << 'END'
 %{
 int yylex () { return 0; }
-void yyerror (char *s) { return; }
+void yyerror (const char *s) {}
 int main () { return 0; }
 %}
 %%
index 2d5cb55e1408c91c94ce7e51509f65e91ad7f0f8..1346c12597f9a958cb5cb318ff5d1ab72a5321b7 100644 (file)
@@ -37,7 +37,7 @@ END
 cat > foo.y << 'END'
 %{
 int yylex () { return 0; }
-void yyerror (char *s) { return; }
+void yyerror (const char *s) {}
 int main () { return 0; }
 %}
 %%