https://git.savannah.gnu.org/cgit/automake.git/commit/?id=13ae585a0184a4c0113fd4f3a19a0cedf1cfe5c2
https://git.savannah.gnu.org/cgit/automake.git/commit/?id=65ad31d87bcde7ffee0c0fa02cb293665c63b85f
https://git.savannah.gnu.org/cgit/automake.git/commit/?id=2a9908da9dbc075ee6c4e853cf3be0365b15f202
https://git.savannah.gnu.org/cgit/automake.git/commit/?id=6d6fc91c472fd84bd71a1b012fa9ab77bd94efea
https://git.savannah.gnu.org/cgit/automake.git/commit/?id=6c10512cce14d8537b33c2026aadbdbb1ff215c8
https://git.savannah.gnu.org/cgit/automake.git/commit/?id=c1f34ffe129323ec7ccebf77bc1eee89f97f971e
https://git.savannah.gnu.org/cgit/automake.git/commit/?id=80714ea0aba62f025780f432abfbab2e66f6f801

From 13ae585a0184a4c0113fd4f3a19a0cedf1cfe5c2 Mon Sep 17 00:00:00 2001
From: Mike Frysinger <vapier@gentoo.org>
Date: Sun, 20 Feb 2022 14:28:11 -0500
Subject: tests: fix yacc C++ tests with some C++ compilers

Fixes automake bug https://bugs.gnu.org/20031.

The C++ standard does not require symbols be placed into the global
namespace, just in the std namespace.  The GNU implementation will
place symbols in both.  For our specific code, we don't care either.

Unfortunately, it looks like generated flex code assumes that some
stdlib.h symbols (free, malloc, exit) are in the global namespace,
even when compiling for C++.  So when we include <cstdlib> but not
<stdlib.h>, we might not get the symbols in the global namespace.

We can workaround this by including stdlib.h in these tests without
invalidating the point of the tests in general.

* t/yacc-cxx.sh: Include stdlib.h.
* t/yacc-d-cxx.sh: Likewise.
* t/yacc-mix-c-cxx.sh: Likewise.
--- a/t/yacc-cxx.sh
+++ b/t/yacc-cxx.sh
@@ -43,6 +43,9 @@ END
 
 cat > parse1.yy << 'END'
 %{
+// Include C header to provide global symbols that flex assumes.
+// https://bugs.gnu.org/20031
+#include <stdlib.h>
 // Valid C++, but deliberately invalid C.
 #include <cstdio>
 #include <cstdlib>
--- a/t/yacc-d-cxx.sh
+++ b/t/yacc-d-cxx.sh
@@ -26,6 +26,9 @@ write_parse ()
   header=$1
   unindent <<END
     %{
+    // Include C header to provide global symbols that flex assumes.
+    // https://bugs.gnu.org/20031
+    #include <stdlib.h>
     // Valid C++, but deliberately invalid C.
     #include <cstdlib>
     #include "$header"
--- a/t/yacc-mix-c-cxx.sh
+++ b/t/yacc-mix-c-cxx.sh
@@ -82,6 +82,10 @@ END
 
 cat > parse.yy <<'END'
 %{
+// Include C header to provide global symbols that flex assumes.
+// https://bugs.gnu.org/20031
+#include <stdlib.h>
+// Valid C++, but deliberately invalid C.
 #include <cstdlib>
 #include "parse.hh"
 int yylex (void) { return 0; }
-- 
cgit v1.1

From 65ad31d87bcde7ffee0c0fa02cb293665c63b85f Mon Sep 17 00:00:00 2001
From: Bogdan <bogdro_rep@gmx.us>
Date: Sun, 9 Jul 2023 09:57:15 -0700
Subject: tests: avoid some SunOS declaration conflicts.

This change: finishes fixing https://bugs.gnu.org/34151
  and https://bugs.gnu.org/30612 and https://bugs.gnu.org/42393;
fixes https://bugs.gnu.org/44795 and https://bugs.gnu.org/49755;
partially fixes https://bugs.gnu.org/45205
  and https://bugs.gnu.org/55073.
Still open: https://bugs.gnu.org/15256;

* t/lex-clean-cxx.sh: test __cplusplus, __sun, and __EXTERN_C__
before using extern "C" for the yylex decl, as explained at
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=45205#13.
* t/lex-depend-cxx.sh: likewise.

* t/yacc-cxx.sh: "using" std::exit, std::free, std::malloc.
* t/yacc-d-cxx.sh: likewise.
* t/yacc-mix-c-cxx.sh: likewise.

* NEWS: mention this.
--- a/t/lex-clean-cxx.sh
+++ b/t/lex-clean-cxx.sh
@@ -51,10 +51,15 @@ CLEANFILES = parsebaz.l++ parsequx.lpp
 LDADD = $(LEXLIB)
 END
 
+# For the explanation of the conditionals on using extern "C",
+# see https://debbugs.gnu.org/cgi/bugreport.cgi?bug=45205#13.
 cat > parsefoo.lxx << 'END'
 %{
 #define YY_DECL int yylex (void)
-extern "C" YY_DECL;
+#if (defined __cplusplus) && ((!defined __sun) || (defined __EXTERN_C__))
+extern "C"
+#endif
+YY_DECL;
 #define YY_NO_UNISTD_H 1
 int isatty (int fd) { return 0; }
 %}
@@ -71,7 +76,10 @@ cp parsefoo.lxx parsebar.ll
 
 cat > mainfoo.cc << 'END'
 // This file should contain valid C++ but invalid C.
-extern "C" int yylex (void);
+#if (defined __cplusplus) && ((!defined __sun) || (defined __EXTERN_C__))
+extern "C"
+#endif
+int yylex (void);
 using namespace std;
 int main (int argc, char **argv)
 {
--- a/t/lex-depend-cxx.sh
+++ b/t/lex-depend-cxx.sh
@@ -44,10 +44,15 @@ test-obj-updated: joe.$(OBJEXT) moe.$(OBJEXT)
 	is_newest moe.$(OBJEXT) my-hdr.hxx
 END
 
+# For the explanation of the conditionals on using extern "C",
+# see https://debbugs.gnu.org/cgi/bugreport.cgi?bug=45205#13.
 cat > joe.ll << 'END'
 %{
 #define YY_DECL int yylex (void)
-extern "C" YY_DECL;
+#if (defined __cplusplus) && ((!defined __sun) || (defined __EXTERN_C__))
+extern "C"
+#endif
+YY_DECL;
 #define YY_NO_UNISTD_H 1
 int isatty (int fd) { return 0; }
 %}
--- a/t/yacc-cxx.sh
+++ b/t/yacc-cxx.sh
@@ -49,6 +49,9 @@ cat > parse1.yy << 'END'
 // Valid C++, but deliberately invalid C.
 #include <cstdio>
 #include <cstdlib>
+using std::exit;
+using std::free;
+using std::malloc;
 // "std::" qualification required by Sun C++ 5.9.
 int yylex (void) { return std::getchar (); }
 void yyerror (const char *s) {}
--- a/t/yacc-d-cxx.sh
+++ b/t/yacc-d-cxx.sh
@@ -31,6 +31,9 @@ write_parse ()
     #include <stdlib.h>
     // Valid C++, but deliberately invalid C.
     #include <cstdlib>
+    using std::exit;
+    using std::free;
+    using std::malloc;
     #include "$header"
     int yylex (void) { return 0; }
     void yyerror (const char *s) {}
--- a/t/yacc-mix-c-cxx.sh
+++ b/t/yacc-mix-c-cxx.sh
@@ -86,6 +86,9 @@ cat > parse.yy <<'END'
 // https://bugs.gnu.org/20031
 #include <stdlib.h>
 // Valid C++, but deliberately invalid C.
+using std::exit;
+using std::free;
+using std::malloc;
 #include <cstdlib>
 #include "parse.hh"
 int yylex (void) { return 0; }
-- 
cgit v1.1

From 2a9908da9dbc075ee6c4e853cf3be0365b15f202 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20B=C3=A9rat?= <fberat@redhat.com>
Date: Mon, 12 Dec 2022 08:05:53 +0100
Subject: [PATCH] tests: Fix 'type defaults' error in link_cond due to main not
 being properly declared

This is related to an effort to prepare Automake for future GCC/Clang
versions which set c99 as default standard to be used.
Not properly declaring main as "int main(...)" is rejected since c99.

* t/link_cond.sh: Add (void) to main definition.
--- a/t/link_cond.sh
+++ b/t/link_cond.sh
@@ -52,7 +52,7 @@ $AUTOCONF
 rm -f *.c++
 cat > less.c <<'END'
 /* Valid C but deliberately invalid C++ */
-main ()
+int main (void)
 {
   int new = 0;
   return new;
-- 
2.39.1

From 6d6fc91c472fd84bd71a1b012fa9ab77bd94efea Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20B=C3=A9rat?= <fberat@redhat.com>
Date: Mon, 12 Dec 2022 07:32:13 +0100
Subject: [PATCH] tests: depcomp: ensure make_ok() fails when run_make fails

While running automake tests with -std-gnu=c99, the compiler report
errors which lead to make to fail. Yet, these failures are ignored
during the tests, which considers them to be successful as stderror is
check for one specific pattern.

If make fails, investigation should be made to discover why, whatever
the reason for the failure is.

* t/ax/depcomp.sh: Make make_ok fail when make fails.
--- a/t/ax/depcomp.sh
+++ b/t/ax/depcomp.sh
@@ -160,7 +160,7 @@ case $depcomp_with_libtool in
     echo lib_LTLIBRARIES = libfoo.la >> Makefile.am
     make_ok ()
     {
-      run_make -M -- ${1+"$@"}
+      run_make -M -- ${1+"$@"} || return 1
       $FGREP 'unknown directive' output && return 1
       rm -f output
       # Checks for stray files possibly left around by less common
-- 
2.39.1

From 6c10512cce14d8537b33c2026aadbdbb1ff215c8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20B=C3=A9rat?= <fberat@redhat.com>
Date: Mon, 28 Aug 2023 06:11:39 -0700
Subject: tests: avoid implicit function declaration in t/depcomp.sh.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

This patch is from https://bugs.gnu.org/60962.

* t/ax/depcomp.sh: save and restore sub/subfoo.h, so its
declaration will be seen, as required by C99.
--- a/t/ax/depcomp.sh
+++ b/t/ax/depcomp.sh
@@ -243,6 +243,8 @@ cat > sub/subfoo.h <<'END'
 #include <stdio.h>
 extern int subfoo (void);
 END
+# Save subfoo.h so we can restore it below; see #60962.
+cp sub/subfoo.h sub/subfoo.save
 
 cat > src/baz.c <<'END'
 #include "baz.h"
@@ -399,8 +401,7 @@ do_test ()
       && rewrite "$srcdir"/sub/subfoo.h echo 'choke me' \
       && not $MAKE \
       && delete "$srcdir"/sub/subfoo.h \
-      && edit "$srcdir"/sub/subfoo.c -e 1d \
-      && edit "$srcdir"/foo.h -e 2d \
+      && cp "$srcdir"/sub/subfoo.save "$srcdir"/sub/subfoo.h \
       && make_ok \
       || r='not ok'
     result_ "$r" "$pfx dependency tracking works"
-- 
cgit v1.1

From c1f34ffe129323ec7ccebf77bc1eee89f97f971e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20B=C3=A9rat?= <fberat@redhat.com>
Date: Mon, 28 Aug 2023 18:32:53 -0700
Subject: tests: don't try to prevent flex from including unistd.h.

This patch is from https://bugs.gnu.org/59994.

* t/cond35.sh: This patch is related to an effort to prepare
Automake for future GCC/Clang versions which set c99 as default
standard to be used.

In the current version of flex, not having unistd.h leads to
implicit function declarations that are not compatible with C99.

A future version of flex will (hopefully) make the "NO_UNISTD"
flag a no-op, and include unistd.h by default.

Also, while flex-dedicated tests had this macro set,
yacc tests did not, despite their use of flex.

For consistency, all the yacc/flex related tests now have the
"--never-interactive" option set in AM_LFLAGS, and do not try
define an isatty function.

* t/lex-clean-cxx.sh: Likewise.
* t/lex-clean.sh: Likewise.
* t/lex-depend-cxx.sh: Likewise.
* t/lex-depend.sh: Likewise.
* t/lex-header.sh: Likewise.
* t/lex-lib-external.sh: Likewise.
* t/lex-lib.sh: Likewise.
* t/lex-libobj.sh: Likewise.
* t/lex-line.sh: Likewise.
* t/lex-multiple.sh: Likewise.
* t/lex-nodist.sh: Likewise.
* t/lex-noyywrap.sh: Likewise.
* t/lex-pr204.sh: Likewise.
* t/lex-subobj-nodep.sh: Likewise.
* t/lex3.sh: Likewise.
* t/lex5.sh: Likewise.
* t/lexvpath.sh: Likewise.
* t/silent-lex.sh: Likewise.
* t/silent-many-languages.sh: Likewise.
* t/silent-yacc-headers.sh: Likewise.
* t/silent-yacc.sh: Likewise.
* t/subpkg-yacc.sh: Likewise.
* t/suffix10.tap: Likewise.
* t/yacc-auxdir.sh: Likewise.
* t/yacc-basic.sh: Likewise.
* t/yacc-bison-skeleton-cxx.sh: Likewise.
* t/yacc-bison-skeleton.sh: Likewise.
* t/yacc-clean-cxx.sh: Likewise.
* t/yacc-clean.sh: Likewise.
* t/yacc-cxx-grepping.sh: Likewise.
* t/yacc-cxx.sh: Likewise.
* t/yacc-d-basic.sh: Likewise.
* t/yacc-d-cxx.sh: Likewise.
* t/yacc-d-vpath.sh: Likewise.
* t/yacc-deleted-headers.sh: Likewise.
* t/yacc-depend.sh: Likewise.
* t/yacc-depend2.sh: Likewise.
* t/yacc-dist-nobuild-subdir.sh: Likewise.
* t/yacc-dist-nobuild.sh: Likewise.
* t/yacc-dry.sh: Likewise.
* t/yacc-grepping.sh: Likewise.
* t/yacc-grepping2.sh: Likewise.
* t/yacc-headers-and-dist-pr47.sh: Likewise.
* t/yacc-line.sh: Likewise.
* t/yacc-misc.sh: Likewise.
* t/yacc-mix-c-cxx.sh: Likewise.
* t/yacc-nodist.sh: Likewise.
* t/yacc-pr204.sh: Likewise.
* t/yacc-subdir.sh: Likewise.
* t/yacc-vpath.sh: Likewise.
* t/yacc-weirdnames.sh: Likewise.
* t/yflags-cmdline-override.sh: Likewise.
* t/yflags-cxx.sh: Likewise.
* t/yflags-d-false-positives.sh: Likewise.
* t/yflags-force-conditional.sh: Likewise.
* t/yflags-force-override.sh: Likewise.
* t/yflags-var-expand.sh: Likewise.
* t/yflags.sh: Likewise.
--- a/t/cond35.sh
+++ b/t/cond35.sh
@@ -30,6 +30,7 @@ EOF
 
 cat > Makefile.am <<'EOF'
 AM_YFLAGS               =       -d
+AM_LFLAGS               =       --never-interactive
 
 BUILT_SOURCES           =       tparse.h
 
@@ -58,9 +59,6 @@ $FGREP 'tparse.h' Makefile.in # For debugging.
 test $($FGREP -c 'tparse.h:' Makefile.in) -eq 1
 
 cat > tscan.l << 'END'
-%{
-#define YY_NO_UNISTD_H 1
-%}
 %%
 "END"   return EOF;
 %%
--- a/t/lex-clean-cxx.sh
+++ b/t/lex-clean-cxx.sh
@@ -29,6 +29,8 @@ AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
+AM_LFLAGS = --never-interactive
+
 bin_PROGRAMS = foo bar baz qux
 
 foo_SOURCES = mainfoo.cc parsefoo.lxx
@@ -60,8 +62,6 @@ cat > parsefoo.lxx << 'END'
 extern "C"
 #endif
 YY_DECL;
-#define YY_NO_UNISTD_H 1
-int isatty (int fd) { return 0; }
 %}
 %%
 "GOOD"   return EOF;
--- a/t/lex-clean.sh
+++ b/t/lex-clean.sh
@@ -29,6 +29,8 @@ AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
+AM_LFLAGS = --never-interactive
+
 bin_PROGRAMS = foo bar baz qux
 
 foo_SOURCES = main.c lexer.l
@@ -52,9 +54,6 @@ LDADD = $(LEXLIB)
 END
 
 cat > lexer.l << 'END'
-%{
-#define YY_NO_UNISTD_H 1
-%}
 %%
 "GOOD"   return EOF;
 .
--- a/t/lex-depend-cxx.sh
+++ b/t/lex-depend-cxx.sh
@@ -27,6 +27,8 @@ AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
+AM_LFLAGS = --never-interactive
+
 noinst_PROGRAMS = joe moe
 joe_SOURCES = joe.ll
 moe_SOURCES = moe.l++
@@ -53,8 +55,6 @@ cat > joe.ll << 'END'
 extern "C"
 #endif
 YY_DECL;
-#define YY_NO_UNISTD_H 1
-int isatty (int fd) { return 0; }
 %}
 %%
 "foo" return EOF;
--- a/t/lex-depend.sh
+++ b/t/lex-depend.sh
@@ -27,6 +27,8 @@ AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
+AM_LFLAGS = --never-interactive
+
 bin_PROGRAMS = zoo
 zoo_SOURCES = joe.l
 LDADD = $(LEXLIB)
@@ -42,9 +44,6 @@ test-obj-updated: joe.$(OBJEXT)
 END
 
 cat > joe.l << 'END'
-%{
-#define YY_NO_UNISTD_H 1
-%}
 %%
 "foo" return EOF;
 .
--- a/t/lex-header.sh
+++ b/t/lex-header.sh
@@ -33,6 +33,8 @@ AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
+AM_LFLAGS = --never-interactive
+
 bin_PROGRAMS = foo
 foo_SOURCES = lexer.l main.c mylex.h
 foo_LFLAGS = --header-file=mylex.h
@@ -45,9 +47,6 @@ END
 
 cat > lexer.l << 'END'
 %option noyywrap
-%{
-#define YY_NO_UNISTD_H 1
-%}
 %%
 "GOOD"   return EOF;
 .
@@ -55,7 +54,6 @@ cat > lexer.l << 'END'
 END
 
 cat > main.c <<'END'
-#define YY_NO_UNISTD_H 1
 #include "mylex.h"
 int main (void)
 {
--- a/t/lex-lib-external.sh
+++ b/t/lex-lib-external.sh
@@ -28,6 +28,8 @@ AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
+AM_LFLAGS = --never-interactive
+
 bin_PROGRAMS = lexer
 lexer_SOURCES = foo.l
 lexer_LDADD = $(LEXLIB)
@@ -42,9 +44,6 @@ have-lexlib:
 END
 
 cat > foo.l <<'END'
-%{
-#define YY_NO_UNISTD_H 1
-%}
 %%
 "GOOD"   return EOF;
 .
--- a/t/lex-lib.sh
+++ b/t/lex-lib.sh
@@ -31,6 +31,8 @@ AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
+AM_LFLAGS = --never-interactive
+
 bin_PROGRAMS = lexer
 lexer_SOURCES = foo.l
 lexer_LDADD = $(LEXLIB)
@@ -47,9 +49,6 @@ int yywrap (void)
 END
 
 cat > foo.l <<'END'
-%{
-#define YY_NO_UNISTD_H 1
-%}
 %%
 "END" return EOF;
 .
--- a/t/lex-libobj.sh
+++ b/t/lex-libobj.sh
@@ -32,6 +32,8 @@ AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
+AM_LFLAGS = --never-interactive
+
 noinst_PROGRAMS = foo
 foo_SOURCES = foo.l
 foo_LDADD = $(LEXLIB) $(LIBOBJS)
@@ -45,9 +47,6 @@ int yywrap (void)
 END
 
 cat > foo.l <<'END'
-%{
-#define YY_NO_UNISTD_H 1
-%}
 %%
 "END" return EOF;
 .
--- a/t/lex-line.sh
+++ b/t/lex-line.sh
@@ -32,6 +32,8 @@ END
 mkdir dir sub sub/dir
 
 cat > Makefile.am << 'END'
+AM_LFLAGS = --never-interactive
+
 SUBDIRS = sub
 bin_PROGRAMS = foo bar
 LDADD = $(LEXLIB)
@@ -44,6 +46,8 @@ bar-quux.@OBJEXT@: bar-quux.c
 END
 
 cat > sub/Makefile.am << 'END'
+AM_LFLAGS = --never-interactive
+
 AUTOMAKE_OPTIONS = subdir-objects
 noinst_PROGRAMS = foo bar
 ## We already used $(LEXLIB) above, so try @LEXLIB@ now.
@@ -57,9 +61,6 @@ dir/quux.@OBJEXT@: dir/quux.c
 END
 
 cat > zardoz.l << 'END'
-%{
-#define YY_NO_UNISTD_H 1
-%}
 %%
 "END"  return EOF;
 .
--- a/t/lex-multiple.sh
+++ b/t/lex-multiple.sh
@@ -31,7 +31,9 @@ AC_PROG_RANLIB
 AC_OUTPUT
 END
 
-cat > Makefile.am << 'END'
+cat > Makefile.am <<  'END'
+AM_LFLAGS = --never-interactive
+
 bin_PROGRAMS = zardoz
 
 zardoz_SOURCES = main.c
@@ -72,9 +74,6 @@ int main (int argc, char *argv[])
 END
 
 cat > 0.l << 'END'
-%{
-#define YY_NO_UNISTD_H 1
-%}
 %%
 "VANILLA" { printf (":%s:\n", yytext); return 121; }
 . { printf (":%s:\n", yytext); return 1; }
--- a/t/lex-nodist.sh
+++ b/t/lex-nodist.sh
@@ -31,6 +31,8 @@ AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
+AM_LFLAGS = --never-interactive
+
 .PHONY: test-build test-dist
 test-build: all
 	ls -l
@@ -45,9 +47,6 @@ check-local: test-build test-dist
 lexer.l:
 	rm -f $@ $@-t
 	:; { : \
-	  && echo '%{' \
-	  && echo '#define YY_NO_UNISTD_H 1' \
-	  && echo '%}' \
 	  && echo '%%' \
 	  && echo '"GOOD" return EOF;' \
 	  && echo '.'; \
--- a/t/lex-noyywrap.sh
+++ b/t/lex-noyywrap.sh
@@ -26,6 +26,8 @@ AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
+AM_LFLAGS = --never-interactive
+
 bin_PROGRAMS = foo
 foo_SOURCES = foo.l
 
@@ -37,9 +39,6 @@ END
 
 cat > foo.l << 'END'
 %option noyywrap
-%{
-#define YY_NO_UNISTD_H 1
-%}
 %%
 "GOOD"   return EOF;
 .
--- a/t/lex-pr204.sh
+++ b/t/lex-pr204.sh
@@ -35,6 +35,8 @@ EOF
 # The LEXER2 intermediate variable is there to make sure Automake
 # matches 'nodist_' against the right variable name...
 cat > Makefile.am << 'EOF'
+AM_LFLAGS = --never-interactive
+
 EXTRA_PROGRAMS = foo
 LEXER2 = lexer2.l
 nodist_foo_SOURCES = lexer.l $(LEXER2)
@@ -49,9 +51,6 @@ distdirtest: distdir
 EOF
 
 cat > lexer.l << 'END'
-%{
-#define YY_NO_UNISTD_H 1
-%}
 %%
 "GOOD"   return EOF;
 .
--- a/t/lex-subobj-nodep.sh
+++ b/t/lex-subobj-nodep.sh
@@ -28,6 +28,8 @@ END
 
 cat >Makefile.am <<\END
 AUTOMAKE_OPTIONS = subdir-objects
+AM_LFLAGS = --never-interactive
+
 bin_PROGRAMS = p1 p2
 p1_SOURCES = sub1/s1.l
 p2_SOURCES = sub2/s2.l
@@ -37,9 +39,6 @@ END
 mkdir sub1 sub2
 
 cat >sub1/s1.l <<\END
-%{
-#define YY_NO_UNISTD_H 1
-%}
 %%
 "END"   return EOF;
 .
--- a/t/lex3.sh
+++ b/t/lex3.sh
@@ -28,14 +28,13 @@ AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
+AM_LFLAGS = --never-interactive
+
 noinst_PROGRAMS = foo
 foo_SOURCES = foo.l
 END
 
 cat > foo.l << 'END'
-%{
-#define YY_NO_UNISTD_H 1
-%}
 %%
 "GOOD"   return EOF;
 .
--- a/t/lex5.sh
+++ b/t/lex5.sh
@@ -28,6 +28,7 @@ END
 cat > Makefile.am << 'END'
 AUTOMAKE_OPTIONS  = subdir-objects
 LDADD             = @LEXLIB@
+AM_LFLAGS         = --never-interactive
 
 bin_PROGRAMS    = foo/foo
 foo_foo_SOURCES = foo/foo.l
@@ -36,9 +37,6 @@ END
 mkdir foo
 
 cat > foo/foo.l << 'END'
-%{
-#define YY_NO_UNISTD_H 1
-%}
 %%
 "END"   return EOF;
 .
--- a/t/lexvpath.sh
+++ b/t/lexvpath.sh
@@ -37,6 +37,8 @@ AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
+AM_LFLAGS = --never-interactive
+
 bin_PROGRAMS = foo
 foo_SOURCES = lexer.l foo.c
 LDADD = $(LEXLIB)
@@ -44,9 +46,6 @@ END
 
 # Original lexer, with a "foobar" comment
 cat > lexer.l << 'END'
-%{
-#define YY_NO_UNISTD_H 1
-%}
 %%
 "END" return EOF;
 .
@@ -89,9 +88,6 @@ $sleep
 
 # New lexer, with 'fubar' comment.
 cat > ../lexer.l << 'END'
-%{
-#define YY_NO_UNISTD_H 1
-%}
 %%
 "END" return EOF;
 .
@@ -112,9 +108,6 @@ $sleep
 
 # New lexer, with 'maude' comment.
 cat > ../lexer.l << 'END'
-%{
-#define YY_NO_UNISTD_H 1
-%}
 %%
 "END" return EOF;
 .
--- a/t/silent-lex.sh
+++ b/t/silent-lex.sh
@@ -28,6 +28,8 @@ AC_OUTPUT
 EOF
 
 cat > Makefile.am <<'EOF'
+AM_LFLAGS = --never-interactive
+
 # Need generic and non-generic rules.
 bin_PROGRAMS = foo1 foo2
 foo1_SOURCES = foo.l
@@ -40,6 +42,8 @@ EOF
 
 cat > sub/Makefile.am <<'EOF'
 AUTOMAKE_OPTIONS = subdir-objects
+AM_LFLAGS = --never-interactive
+
 # Need generic and non-generic rules.
 bin_PROGRAMS = bar1 bar2
 bar1_SOURCES = bar.l
@@ -50,9 +54,6 @@ LDADD = $(LEXLIB)
 EOF
 
 cat > foo.l <<'EOF'
-%{
-#define YY_NO_UNISTD_H 1
-%}
 %%
 "END"   return EOF;
 .
--- a/t/silent-many-languages.sh
+++ b/t/silent-many-languages.sh
@@ -151,6 +151,7 @@ ba2_YFLAGS = -v
 ba2_LFLAGS = -n
 ba2_LDADD = $(LEXLIB)
 AM_YFLAGS = -d
+AM_LFLAGS = --never-interactive
 BUILT_SOURCES = baz6.h
 EOF
 
--- a/t/silent-yacc-headers.sh
+++ b/t/silent-yacc-headers.sh
@@ -31,6 +31,7 @@ EOF
 cat > Makefile.am <<'EOF'
 # Need generic and non-generic rules.
 AM_YFLAGS = -d
+AM_LFLAGS = --never-interactive
 bin_PROGRAMS = foo bar
 foo_SOURCES = parse.y
 bar_SOURCES = $(foo_SOURCES)
--- a/t/silent-yacc.sh
+++ b/t/silent-yacc.sh
@@ -29,6 +29,8 @@ AC_OUTPUT
 EOF
 
 cat > Makefile.am <<'EOF'
+AM_LFLAGS = --never-interactive
+
 # Need generic and non-generic rules.
 bin_PROGRAMS = foo1 foo2
 foo1_SOURCES = foo.y
@@ -40,6 +42,8 @@ EOF
 
 cat > sub/Makefile.am <<'EOF'
 AUTOMAKE_OPTIONS = subdir-objects
+AM_LFLAGS = --never-interactive
+
 # Need generic and non-generic rules.
 bin_PROGRAMS = bar1 bar2
 bar1_SOURCES = bar.y
--- a/t/subpkg-yacc.sh
+++ b/t/subpkg-yacc.sh
@@ -61,6 +61,8 @@ AC_OUTPUT
 EOF
 
 cat >lib/Makefile.am <<'EOF'
+AM_LFLAGS = --never-interactive
+
 noinst_LIBRARIES = liblib.a
 liblib_a_SOURCES = src/x.c foo.y
 EXTRA_liblib_a_SOURCES = bar.y
--- a/t/suffix10.tap
+++ b/t/suffix10.tap
@@ -31,6 +31,8 @@ AC_OUTPUT
 EOF
 
 cat >Makefile.am << 'END'
+AM_LFLAGS = --never-interactive
+
 lib_LTLIBRARIES = libfoo.la
 libfoo_la_SOURCES = foo.x_
 .x_.y:
--- a/t/yacc-auxdir.sh
+++ b/t/yacc-auxdir.sh
@@ -35,12 +35,16 @@ cat > Makefile.am << 'END'
 SUBDIRS = sub
 bin_PROGRAMS = foo
 AM_YFLAGS = -d
+AM_LFLAGS = --never-interactive
+
 foo_SOURCES = foo.y
 END
 
 cat > sub/Makefile.am << 'END'
 bin_PROGRAMS = bar
 AM_YFLAGS = -d
+AM_LFLAGS = --never-interactive
+
 bar_SOURCES = bar.y main.c
 END
 
--- a/t/yacc-basic.sh
+++ b/t/yacc-basic.sh
@@ -27,6 +27,8 @@ AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
+AM_LFLAGS = --never-interactive
+
 bin_PROGRAMS = foo bar
 foo_SOURCES = parse.y foo.c
 bar_SOURCES = $(foo_SOURCES)
--- a/t/yacc-bison-skeleton-cxx.sh
+++ b/t/yacc-bison-skeleton-cxx.sh
@@ -27,6 +27,8 @@ AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
+AM_LFLAGS = --never-interactive
+
 bin_PROGRAMS = zardoz
 zardoz_SOURCES = zardoz.yy foo.cc
 
--- a/t/yacc-bison-skeleton.sh
+++ b/t/yacc-bison-skeleton.sh
@@ -31,6 +31,8 @@ cat > Makefile.am << 'END'
 bin_PROGRAMS = zardoz
 zardoz_SOURCES = zardoz.y foo.c
 AM_YFLAGS = -d --skeleton glr.c
+AM_LFLAGS = --never-interactive
+
 BUILT_SOURCES = zardoz.h
 END
 
--- a/t/yacc-clean-cxx.sh
+++ b/t/yacc-clean-cxx.sh
@@ -39,6 +39,8 @@ END
 mkdir sub1 sub2
 
 cat > sub1/Makefile.am << 'END'
+AM_LFLAGS = --never-interactive
+
 bin_PROGRAMS = foo bar baz qux
 
 foo_SOURCES = mainfoo.cc parsefoo.yxx
--- a/t/yacc-clean.sh
+++ b/t/yacc-clean.sh
@@ -38,6 +38,8 @@ END
 mkdir sub1 sub2
 
 cat > sub1/Makefile.am << 'END'
+AM_LFLAGS = --never-interactive
+
 bin_PROGRAMS = foo bar baz qux
 
 foo_SOURCES = main.c parse.y
--- a/t/yacc-cxx-grepping.sh
+++ b/t/yacc-cxx-grepping.sh
@@ -27,6 +27,8 @@ AC_PROG_YACC
 END
 
 cat > Makefile.am << 'END'
+AM_LFLAGS = --never-interactive
+
 bin_PROGRAMS = foo bar baz qux
 foo_SOURCES = foo.y++
 bar_SOURCES = bar.ypp
--- a/t/yacc-cxx.sh
+++ b/t/yacc-cxx.sh
@@ -28,6 +28,8 @@ AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
+AM_LFLAGS = --never-interactive
+
 bin_PROGRAMS = foo1 foo2 foo3 foo4
 foo1_SOURCES = parse1.yy  foo.cc
 foo2_SOURCES = parse2.y++ bar.c++
--- a/t/yacc-d-basic.sh
+++ b/t/yacc-d-basic.sh
@@ -35,6 +35,8 @@ END
 mkdir foo bar baz
 
 cat > foo/Makefile.am <<'END'
+AM_LFLAGS = --never-interactive
+
 bin_PROGRAMS = zardoz
 zardoz_SOURCES = parse.y main.c
 .PHONY: echo-distcom
--- a/t/yacc-d-cxx.sh
+++ b/t/yacc-d-cxx.sh
@@ -70,6 +70,8 @@ mkdir foo bar baz qux baz/sub
 
 # These makefiles will be extended later.
 cat > Makefile.am <<'END'
+AM_LFLAGS = --never-interactive
+
 .PHONY: echo-distcom
 echo-distcom:
 	@echo ' ' $(DIST_COMMON) ' '
--- a/t/yacc-d-vpath.sh
+++ b/t/yacc-d-vpath.sh
@@ -32,6 +32,8 @@ AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
+AM_LFLAGS = --never-interactive
+
 bin_PROGRAMS = foo
 foo_SOURCES = parse.y foo.c
 AM_YFLAGS = -d
--- a/t/yacc-deleted-headers.sh
+++ b/t/yacc-deleted-headers.sh
@@ -26,6 +26,8 @@ AC_OUTPUT
 END
 
 cat > Makefile.am <<'END'
+AM_LFLAGS = --never-interactive
+
 bin_PROGRAMS = p1 p2 p3 p4
 # The order in which files are listed in the p*_SOURCES variables
 # below is significant, since it causes make failures whenever
--- a/t/yacc-depend.sh
+++ b/t/yacc-depend.sh
@@ -29,6 +29,8 @@ END
 cat > Makefile.am << 'END'
 bin_PROGRAMS = foo
 AM_YFLAGS = -d
+AM_LFLAGS = --never-interactive
+
 foo_SOURCES = foo.y main.c
 BUILT_SOURCES = foo.h
 END
--- a/t/yacc-depend2.sh
+++ b/t/yacc-depend2.sh
@@ -28,6 +28,8 @@ AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
+AM_LFLAGS = --never-interactive
+
 bin_PROGRAMS = foo
 AM_YFLAGS = -d
 foo_SOURCES = foo.y main.c
--- a/t/yacc-dist-nobuild-subdir.sh
+++ b/t/yacc-dist-nobuild-subdir.sh
@@ -49,6 +49,8 @@ END
 
 cat > Makefile.am <<'END'
 AUTOMAKE_OPTIONS = subdir-objects
+AM_LFLAGS = --never-interactive
+
 noinst_PROGRAMS = foo bar
 foo_SOURCES = sub/parse.y
 bar_SOURCES = $(foo_SOURCES)
--- a/t/yacc-dist-nobuild.sh
+++ b/t/yacc-dist-nobuild.sh
@@ -28,6 +28,8 @@ AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
+AM_LFLAGS = --never-interactive
+
 bin_PROGRAMS = foobar zardoz
 foobar_SOURCES = parse.y main.c
 zardoz_SOURCES = $(foobar_SOURCES)
--- a/t/yacc-dry.sh
+++ b/t/yacc-dry.sh
@@ -26,6 +26,8 @@ AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
+AM_LFLAGS = --never-interactive
+
 AM_YFLAGS = -d
 bin_PROGRAMS = foo
 foo_SOURCES = foo.c parse.y
--- a/t/yacc-grepping.sh
+++ b/t/yacc-grepping.sh
@@ -35,6 +35,8 @@ END
 $ACLOCAL
 
 cat > Makefile.am <<'END'
+AM_LFLAGS = --never-interactive
+
 bin_PROGRAMS = zardoz
 zardoz_SOURCES = zardoz.y
 END
--- a/t/yacc-grepping2.sh
+++ b/t/yacc-grepping2.sh
@@ -25,6 +25,8 @@ AC_PROG_YACC
 END
 
 cat > Makefile.am << 'END'
+AM_LFLAGS = --never-interactive
+
 bin_PROGRAMS = maude
 maude_SOURCES = sub/maude.y
 END
--- a/t/yacc-headers-and-dist-pr47.sh
+++ b/t/yacc-headers-and-dist-pr47.sh
@@ -30,6 +30,8 @@ AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
+AM_LFLAGS = --never-interactive
+
 bin_PROGRAMS = foo
 foo_SOURCES = foo.y
 AM_YFLAGS = -d
--- a/t/yacc-line.sh
+++ b/t/yacc-line.sh
@@ -32,6 +32,8 @@ END
 mkdir dir sub sub/dir
 
 cat > Makefile.am << 'END'
+AM_LFLAGS = --never-interactive
+
 SUBDIRS = sub
 bin_PROGRAMS = foo bar
 AM_YFLAGS = -d
@@ -45,6 +47,8 @@ END
 
 cat > sub/Makefile.am << 'END'
 AUTOMAKE_OPTIONS = subdir-objects
+AM_LFLAGS = --never-interactive
+
 noinst_PROGRAMS = foo bar
 foo_YFLAGS = -d
 foo_SOURCES = zardoz.y
--- a/t/yacc-misc.sh
+++ b/t/yacc-misc.sh
@@ -26,6 +26,8 @@ AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
+AM_LFLAGS = --never-interactive
+
 bin_PROGRAMS = foo bar
 foo_SOURCES = parse.y foo.c
 bar_SOURCES = bar.y foo.c
--- a/t/yacc-mix-c-cxx.sh
+++ b/t/yacc-mix-c-cxx.sh
@@ -28,6 +28,8 @@ AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
+AM_LFLAGS = --never-interactive
+
 bin_PROGRAMS = c1 c2 cxx1 cxx2 cxx3
 AM_YFLAGS = -d
 
--- a/t/yacc-nodist.sh
+++ b/t/yacc-nodist.sh
@@ -31,6 +31,8 @@ AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
+AM_LFLAGS = --never-interactive
+
 SUBDIRS = sub1 sub2
 .PHONY: test-build test-dist
 test-build: all
--- a/t/yacc-pr204.sh
+++ b/t/yacc-pr204.sh
@@ -34,6 +34,8 @@ EOF
 # sure Automake match 'nodist_' against the right
 # variable name...
 cat > Makefile.am << 'EOF'
+AM_LFLAGS = --never-interactive
+
 AM_YFLAGS = -d
 EXTRA_PROGRAMS = foo
 PARSE2 = parse2.y
--- a/t/yacc-subdir.sh
+++ b/t/yacc-subdir.sh
@@ -28,6 +28,8 @@ END
 
 cat > Makefile.am << 'END'
 AUTOMAKE_OPTIONS = subdir-objects
+AM_LFLAGS = --never-interactive
+
 bin_PROGRAMS = foo/foo
 foo_foo_SOURCES = foo/parse.y
 AM_YFLAGS = -d
--- a/t/yacc-vpath.sh
+++ b/t/yacc-vpath.sh
@@ -32,6 +32,8 @@ AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
+AM_LFLAGS = --never-interactive
+
 bin_PROGRAMS = foo
 foo_SOURCES = parse.y foo.c
 END
--- a/t/yacc-weirdnames.sh
+++ b/t/yacc-weirdnames.sh
@@ -27,6 +27,8 @@ AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
+AM_LFLAGS = --never-interactive
+
 bin_PROGRAMS = foo bar foo2 bar2
 
 foo_SOURCES = parse.y.y
--- a/t/yflags-cmdline-override.sh
+++ b/t/yflags-cmdline-override.sh
@@ -27,6 +27,8 @@ AC_OUTPUT
 END
 
 cat > Makefile.am <<'END'
+AM_LFLAGS = --never-interactive
+
 bin_PROGRAMS = foo
 foo_SOURCES = foo.y
 # A minor automake wart: automake doesn't generate code to clean
--- a/t/yflags-cxx.sh
+++ b/t/yflags-cxx.sh
@@ -39,6 +39,8 @@ END
 
 cat > Makefile.am <<'END'
 AUTOMAKE_OPTIONS = no-dependencies
+AM_LFLAGS = --never-interactive
+
 bin_PROGRAMS = foo bar
 foo_SOURCES = main.cc foo.yy
 bar_SOURCES = main.cc bar.y++
--- a/t/yflags-d-false-positives.sh
+++ b/t/yflags-d-false-positives.sh
@@ -26,6 +26,8 @@ END
 $ACLOCAL
 
 cat > Makefile.am <<'END'
+AM_LFLAGS = --never-interactive
+
 bin_PROGRAMS = zardoz foobar
 zardoz_SOURCES = zardoz.y
 foobar_SOURCES = foobar.y
--- a/t/yflags-force-conditional.sh
+++ b/t/yflags-force-conditional.sh
@@ -38,6 +38,8 @@ YACC=fake-yacc; export YACC
 
 cat > Makefile.am <<'END'
 AUTOMAKE_OPTIONS = no-dependencies
+AM_LFLAGS = --never-interactive
+
 bin_PROGRAMS = foo bar
 foo_SOURCES = foo.y main.c
 bar_SOURCES = $(foo_SOURCES)
--- a/t/yflags-force-override.sh
+++ b/t/yflags-force-override.sh
@@ -28,6 +28,8 @@ AC_OUTPUT
 END
 
 cat > Makefile.am <<'END'
+AM_LFLAGS = --never-interactive
+
 bin_PROGRAMS = foo
 foo_SOURCES = foo.y
 # Don't do this in a real-life Makefile.am!
--- a/t/yflags-var-expand.sh
+++ b/t/yflags-var-expand.sh
@@ -29,6 +29,8 @@ END
 $ACLOCAL
 
 cat > Makefile.am <<'END'
+AM_LFLAGS = --never-interactive
+
 bin_PROGRAMS = foo bar
 foo_SOURCES = foo.y
 bar_SOURCES = bar.y
--- a/t/yflags.sh
+++ b/t/yflags.sh
@@ -39,6 +39,8 @@ END
 
 cat > Makefile.am <<'END'
 AUTOMAKE_OPTIONS = no-dependencies
+AM_LFLAGS = --never-interactive
+
 bin_PROGRAMS = foo bar
 foo_SOURCES = main.c foo.y
 bar_SOURCES = main.c bar.y
-- 
cgit v1.1

From 80714ea0aba62f025780f432abfbab2e66f6f801 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20B=C3=A9rat?= <fberat@redhat.com>
Date: Tue, 29 Aug 2023 11:00:41 -0700
Subject: tests: avoid implicit function declarations.

This patch is from https://bugs.gnu.org/59993 (v2 part 2).

* t/c-demo.sh: This patch is related to an effort to prepare
Automake for future GCC/Clang versions which set c99 as default
standard to be used.

C99 requires that functions be properly declared before use.
This is true for both user functions and standard functions,
e.g., printf.

* t/cond35.sh: Likewise.
* t/dist-vs-built-sources.sh: Likewise.
* t/lex-clean.sh: Likewise.
* t/lex-multiple.sh: Likewise.
* t/lex-nodist.sh: Likewise.
* t/ltcond2.sh: Likewise.
* t/ltconv.sh: Likewise.
* t/subobj-clean-lt-pr10697.sh: Likewise.
* t/subobj-clean-pr10697.sh: Likewise.
* t/tags-pr12372.sh: Likewise.
* t/yacc-basic.sh: Likewise.
* t/yacc-clean.sh: Likewise.
* t/yacc-nodist.sh: Likewise.

This patch is from https://bugs.gnu.org/59993.
--- a/t/c-demo.sh
+++ b/t/c-demo.sh
@@ -113,6 +113,7 @@ test -f build-aux/compile # We have per-target flags on C sources.
 ./configure --enable-dependency-tracking
 
 cat > src/main.c << 'END'
+#include <stdio.h>
 #include "foo.h"
 #include "bar.h"
 int main (void)
--- a/t/cond35.sh
+++ b/t/cond35.sh
@@ -71,6 +71,8 @@ END
 
 cat > tparse.y << 'END'
 %{
+extern int yylex(void);
+
 void yyerror (const char *s) {}
 %}
 %token EOF
--- a/t/dist-vs-built-sources.sh
+++ b/t/dist-vs-built-sources.sh
@@ -41,6 +41,7 @@ foo_SOURCES = foo.c
 END
 
 cat > foo.c << 'END'
+#include <stdio.h>
 #include "h.h"
 int main (void) { printf ("%s\n", F); return 0; }
 END
--- a/t/lex-clean.sh
+++ b/t/lex-clean.sh
@@ -60,6 +60,7 @@ cat > lexer.l << 'END'
 END
 
 cat > main.c << 'END'
+extern int yylex (void);
 int main (void)
 {
   return yylex ();
--- a/t/lex-multiple.sh
+++ b/t/lex-multiple.sh
@@ -58,6 +58,10 @@ cat > main.c << 'END'
 #include <stdlib.h>
 #include <string.h>
 
+extern int yylex (void);
+extern int foolex (void);
+extern int bar_lex (void);
+
 int main (int argc, char *argv[])
 {
   if (argc != 2)
--- a/t/lex-nodist.sh
+++ b/t/lex-nodist.sh
@@ -61,6 +61,8 @@ CLEANFILES = $(nodist_prog_SOURCES)
 END
 
 cat > main.c << 'END'
+extern int yylex (void);
+
 int main ()
 {
   return yylex ();
--- a/t/ltcond2.sh
+++ b/t/ltcond2.sh
@@ -73,6 +73,8 @@ void print (void)
 END
 
 cat > main.c <<'END'
+extern void print(void);
+
 int main (void)
 {
   print();
--- a/t/ltconv.sh
+++ b/t/ltconv.sh
@@ -91,6 +91,12 @@ echo 'int sub22 () { return 22; }' > sub2/sub22/sub22.c
 
 cat >test.c <<'EOF'
 #include <stdio.h>
+
+extern int sub1 (void);
+extern int sub2 (void);
+extern int sub21 (void);
+extern int sub22 (void);
+
 int main ()
 {
   if (1 != sub1 ())
--- a/t/subobj-clean-lt-pr10697.sh
+++ b/t/subobj-clean-lt-pr10697.sh
@@ -83,7 +83,15 @@ libfoo_la_SOURCES = \
 END
 
 mkdir sub1 sub2
-echo 'int libmain (void)' > main.c
+
+echo "/* Subobj clean: libtool case*/" > main.c
+for i in 1 2; do
+  for j in a b c d e f; do
+    echo "extern void $j$i (void);" >> main.c
+  done
+done
+
+echo 'int libmain (void)' >> main.c
 echo '{' >> main.c
 for i in 1 2; do
   for j in a b c d e f; do
--- a/t/subobj-clean-pr10697.sh
+++ b/t/subobj-clean-pr10697.sh
@@ -81,7 +81,15 @@ foo_SOURCES = \
 END
 
 mkdir sub1 sub2
-echo 'int main (void)' > main.c
+
+echo "/* Subobj clean: generic case*/" > main.c
+for i in 1 2; do
+  for j in a b c d e f; do
+    echo "extern void $j$i (void);" >> main.c
+  done
+done
+
+echo 'int main (void)' >> main.c
 echo '{' >> main.c
 for i in 1 2; do
   for j in a b c d e f; do
--- a/t/tags-pr12372.sh
+++ b/t/tags-pr12372.sh
@@ -53,7 +53,8 @@ noinst_PROGRAMS = zap
 zap_SOURCES = zardoz.pc
 END
 
-echo 'int main(void) [ return bar(1); ]' > foo-main.pc
+echo 'extern int bar(int);' > foo-main.pc
+echo 'int main(void) [ return bar(1); ]' >> foo-main.pc
 echo 'int bar(int x) { return !x; }' > barbar.c
 echo 'int m@in(void) { return 0; }' > sub/zardoz.pc
 
--- a/t/yacc-basic.sh
+++ b/t/yacc-basic.sh
@@ -51,6 +51,7 @@ a : 'a' { exit(0); };
 END
 
 cat > foo.c << 'END'
+extern int yyparse(void);
 int main () { yyparse (); return 1; }
 END
 
--- a/t/yacc-clean.sh
+++ b/t/yacc-clean.sh
@@ -67,6 +67,8 @@ END
 
 cat > sub1/parse.y << 'END'
 %{
+#include <stdio.h>
+
 int yylex () { return (getchar ()); }
 void yyerror (const char *s) {}
 %}
@@ -76,6 +78,8 @@ END
 cp sub1/parse.y sub2/parse.y
 
 cat > sub1/main.c << 'END'
+extern int yyparse(void);
+
 int main ()
 {
   return yyparse ();
--- a/t/yacc-nodist.sh
+++ b/t/yacc-nodist.sh
@@ -80,6 +80,8 @@ BUILT_SOURCES = parse.h
 END
 
 cat > sub1/main.c << 'END'
+extern int yyparse(void);
+
 int main ()
 {
   return yyparse ();
-- 
cgit v1.1
