GNU bug report logs - #59993
[PATCH 2/2] tests: Fix implicit function declaration errors

Previous Next

Package: automake-patches;

Reported by: Frederic Berat <fberat <at> redhat.com>

Date: Mon, 12 Dec 2022 08:44:05 UTC

Severity: normal

Tags: patch

Done: Karl Berry <karl <at> freefriends.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 59993 in the body.
You can then email your comments to 59993 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to automake-patches <at> gnu.org:
bug#59993; Package automake-patches. (Mon, 12 Dec 2022 08:44:05 GMT) Full text and rfc822 format available.

Acknowledgement sent to Frederic Berat <fberat <at> redhat.com>:
New bug report received and forwarded. Copy sent to automake-patches <at> gnu.org. (Mon, 12 Dec 2022 08:44:05 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Frederic Berat <fberat <at> redhat.com>
To: automake-patches <at> gnu.org
Cc: Frédéric Bérat <fberat <at> redhat.com>
Subject: [PATCH 2/2] tests: Fix implicit function declaration errors
Date: Mon, 12 Dec 2022 08:05:54 +0100
From: Frédéric Bérat <fberat <at> redhat.com>

This is related to an effort to prepare Automake for future GCC/Clang
versions which set c99 as default standard to be used.

Function should be properly declared prior to use in order to be
compatible with c99 standard.
This is valid for both local functions and standard functions (as
printf).

Modified files:

 * t/ax/depcomp.sh
 * t/c-demo.sh
 * t/cond35.sh
 * t/dist-vs-built-sources.sh
 * t/lex-clean.sh
 * t/lex-multiple.sh
 * t/lex-nodist.sh
 * t/ltcond2.sh
 * t/ltconv.sh
 * t/subobj-clean-lt-pr10697.sh
 * t/subobj-clean-pr10697.sh
 * t/tags-pr12372.sh
 * t/yacc-basic.sh
 * t/yacc-clean.sh
 * t/yacc-nodist.sh
---
 t/ax/depcomp.sh              |  4 ++--
 t/c-demo.sh                  |  1 +
 t/cond35.sh                  |  2 ++
 t/dist-vs-built-sources.sh   |  1 +
 t/lex-clean.sh               |  1 +
 t/lex-multiple.sh            |  4 ++++
 t/lex-nodist.sh              |  2 ++
 t/ltcond2.sh                 |  2 ++
 t/ltconv.sh                  |  6 ++++++
 t/subobj-clean-lt-pr10697.sh | 10 +++++++++-
 t/subobj-clean-pr10697.sh    | 10 +++++++++-
 t/tags-pr12372.sh            |  3 ++-
 t/yacc-basic.sh              |  1 +
 t/yacc-clean.sh              |  4 ++++
 t/yacc-nodist.sh             |  2 ++
 15 files changed, 48 insertions(+), 5 deletions(-)

diff --git a/t/ax/depcomp.sh b/t/ax/depcomp.sh
index e4e7565df..a9debc8ef 100644
--- a/t/ax/depcomp.sh
+++ b/t/ax/depcomp.sh
@@ -243,6 +243,7 @@ cat > sub/subfoo.h <<'END'
 #include <stdio.h>
 extern int subfoo (void);
 END
+cp sub/subfoo.h sub/subfoo.save
 
 cat > src/baz.c <<'END'
 #include "baz.h"
@@ -399,8 +400,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 \
+      && mv  "$srcdir"/sub/subfoo.save "$srcdir"/sub/subfoo.h \
       && make_ok \
       || r='not ok'
     result_ "$r" "$pfx dependency tracking works"
diff --git a/t/c-demo.sh b/t/c-demo.sh
index 7e0e8d64f..d25bf214b 100644
--- 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)
diff --git a/t/cond35.sh b/t/cond35.sh
index 215a22548..bad133970 100644
--- a/t/cond35.sh
+++ b/t/cond35.sh
@@ -73,6 +73,8 @@ END
 
 cat > tparse.y << 'END'
 %{
+extern int yylex(void);
+
 void yyerror (const char *s) {}
 %}
 %token EOF
diff --git a/t/dist-vs-built-sources.sh b/t/dist-vs-built-sources.sh
index d038e66dd..db2776f9a 100644
--- 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
diff --git a/t/lex-clean.sh b/t/lex-clean.sh
index 5aa199338..e53da8fd2 100644
--- a/t/lex-clean.sh
+++ b/t/lex-clean.sh
@@ -61,6 +61,7 @@ cat > lexer.l << 'END'
 END
 
 cat > main.c << 'END'
+extern int yylex (void);
 int main (void)
 {
   return yylex ();
diff --git a/t/lex-multiple.sh b/t/lex-multiple.sh
index 2655b633e..bf119ec84 100644
--- a/t/lex-multiple.sh
+++ b/t/lex-multiple.sh
@@ -56,6 +56,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)
diff --git a/t/lex-nodist.sh b/t/lex-nodist.sh
index 599539405..187dd5437 100644
--- a/t/lex-nodist.sh
+++ b/t/lex-nodist.sh
@@ -62,6 +62,8 @@ CLEANFILES = $(nodist_prog_SOURCES)
 END
 
 cat > main.c << 'END'
+extern int yylex (void);
+
 int main ()
 {
   return yylex ();
diff --git a/t/ltcond2.sh b/t/ltcond2.sh
index 29244c9b3..7e7bcadc4 100644
--- 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();
diff --git a/t/ltconv.sh b/t/ltconv.sh
index 2c4cc47a1..ec79ef80e 100644
--- 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 ())
diff --git a/t/subobj-clean-lt-pr10697.sh b/t/subobj-clean-lt-pr10697.sh
index bb656c43f..53fc02f09 100644
--- 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
diff --git a/t/subobj-clean-pr10697.sh b/t/subobj-clean-pr10697.sh
index f77de8c92..a7f97f6d1 100644
--- 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
diff --git a/t/tags-pr12372.sh b/t/tags-pr12372.sh
index b9c022f70..1a9e1e026 100644
--- 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 <at> in(void) { return 0; }' > sub/zardoz.pc
 
diff --git a/t/yacc-basic.sh b/t/yacc-basic.sh
index 5b258a30c..8cc0d06a2 100644
--- a/t/yacc-basic.sh
+++ b/t/yacc-basic.sh
@@ -49,6 +49,7 @@ a : 'a' { exit(0); };
 END
 
 cat > foo.c << 'END'
+extern int yyparse(void);
 int main () { yyparse (); return 1; }
 END
 
diff --git a/t/yacc-clean.sh b/t/yacc-clean.sh
index 373774b6a..fef079cf3 100644
--- a/t/yacc-clean.sh
+++ b/t/yacc-clean.sh
@@ -65,6 +65,8 @@ END
 
 cat > sub1/parse.y << 'END'
 %{
+#include <stdio.h>
+
 int yylex () { return (getchar ()); }
 void yyerror (const char *s) {}
 %}
@@ -74,6 +76,8 @@ END
 cp sub1/parse.y sub2/parse.y
 
 cat > sub1/main.c << 'END'
+extern int yyparse(void);
+
 int main ()
 {
   return yyparse ();
diff --git a/t/yacc-nodist.sh b/t/yacc-nodist.sh
index d350a80f9..4a8ebe9ca 100644
--- a/t/yacc-nodist.sh
+++ b/t/yacc-nodist.sh
@@ -78,6 +78,8 @@ BUILT_SOURCES = parse.h
 END
 
 cat > sub1/main.c << 'END'
+extern int yyparse(void);
+
 int main ()
 {
   return yyparse ();
-- 
2.38.1





Information forwarded to automake-patches <at> gnu.org:
bug#59993; Package automake-patches. (Mon, 12 Dec 2022 20:19:01 GMT) Full text and rfc822 format available.

Message #8 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Zack Weinberg <zack <at> owlfolio.org>
To: automake-patches <at> gnu.org
Subject: Re: [bug#59993] [PATCH 2/2] tests: Fix implicit function declaration
 errors
Date: Mon, 12 Dec 2022 15:18:36 -0500
On 2022-12-12 2:05 AM, Frederic Berat wrote:
> This is related to an effort to prepare Automake for future GCC/Clang
> versions which set c99 as default standard to be used.
> Function should be properly declared prior to use in order to be
> compatible with c99 standard.

OK in principle, but ...

> --- a/t/ax/depcomp.sh
> +++ b/t/ax/depcomp.sh
> @@ -243,6 +243,7 @@ cat > sub/subfoo.h <<'END'
>   #include <stdio.h>
>   extern int subfoo (void);
>   END
> +cp sub/subfoo.h sub/subfoo.save
>   
>   cat > src/baz.c <<'END'
>   #include "baz.h"
> @@ -399,8 +400,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 \
> +      && mv  "$srcdir"/sub/subfoo.save "$srcdir"/sub/subfoo.h \
>         && make_ok \
>         || r='not ok'
>       result_ "$r" "$pfx dependency tracking works"

These changes don't seem to have anything to do with the patch as 
described.  They should be submitted separately.

> --- a/t/lex-nodist.sh
> +++ b/t/lex-nodist.sh
> @@ -62,6 +62,8 @@ CLEANFILES = $(nodist_prog_SOURCES)
>   END
>   
>   cat > main.c << 'END'
> +extern int yylex (void);
> +
>   int main ()
>   {
>     return yylex ();

Please change `int main ()` to `int main (void)` as long as you're in here.

> --- 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 ())

Same here.

> --- a/t/yacc-basic.sh
> +++ b/t/yacc-basic.sh
> @@ -49,6 +49,7 @@ a : 'a' { exit(0); };
>   END
>   
>   cat > foo.c << 'END'
> +extern int yyparse(void);
>   int main () { yyparse (); return 1; }
>   END

And here.

> --- a/t/yacc-clean.sh
> +++ b/t/yacc-clean.sh
> @@ -74,6 +76,8 @@ END
>   cp sub1/parse.y sub2/parse.y
>   
>   cat > sub1/main.c << 'END'
> +extern int yyparse(void);
> +
>   int main ()
>   {
>     return yyparse ();

And here.

> --- a/t/yacc-nodist.sh
> +++ b/t/yacc-nodist.sh
> @@ -78,6 +78,8 @@ BUILT_SOURCES = parse.h
>   END
>   
>   cat > sub1/main.c << 'END'
> +extern int yyparse(void);
> +
>   int main ()
>   {
>     return yyparse ();

And here as well.




Information forwarded to automake-patches <at> gnu.org:
bug#59993; Package automake-patches. (Tue, 13 Dec 2022 08:03:04 GMT) Full text and rfc822 format available.

Message #11 received at 59993 <at> debbugs.gnu.org (full text, mbox):

From: Frederic Berat <fberat <at> redhat.com>
To: Zack Weinberg <zack <at> owlfolio.org>
Cc: 59993 <at> debbugs.gnu.org
Subject: Re: [bug#59993] [PATCH 2/2] tests: Fix implicit function declaration
 errors
Date: Tue, 13 Dec 2022 07:30:35 +0100
On Mon, Dec 12, 2022 at 9:19 PM Zack Weinberg <zack <at> owlfolio.org> wrote:
>
> On 2022-12-12 2:05 AM, Frederic Berat wrote:
> > This is related to an effort to prepare Automake for future GCC/Clang
> > versions which set c99 as default standard to be used.
> > Function should be properly declared prior to use in order to be
> > compatible with c99 standard.
>
> OK in principle, but ...
>
> > --- a/t/ax/depcomp.sh
> > +++ b/t/ax/depcomp.sh
> > @@ -243,6 +243,7 @@ cat > sub/subfoo.h <<'END'
> >   #include <stdio.h>
> >   extern int subfoo (void);
> >   END
> > +cp sub/subfoo.h sub/subfoo.save
> >
> >   cat > src/baz.c <<'END'
> >   #include "baz.h"
> > @@ -399,8 +400,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 \
> > +      && mv  "$srcdir"/sub/subfoo.save "$srcdir"/sub/subfoo.h \
> >         && make_ok \
> >         || r='not ok'
> >       result_ "$r" "$pfx dependency tracking works"
>
> These changes don't seem to have anything to do with the patch as
> described.  They should be submitted separately.

Actually, that is related. The edit removes the "#include subfoo.h"
line from foo.h, because the subfoo.h file got overwritten earlier.
This subfoo.h is the one that had the function declaration in ("extern
int subfoo (void);" specifically).
Either you need the original header back, or you need to get the
declaration back another way. I felt this way was easier than trying
to insert a declaration without breaking the test.

I agree that more explanation could have been useful. If you have
another suggestion to get the declaration in, I'm open.

>
> > --- a/t/lex-nodist.sh
> > +++ b/t/lex-nodist.sh
> > @@ -62,6 +62,8 @@ CLEANFILES = $(nodist_prog_SOURCES)
> >   END
> >
> >   cat > main.c << 'END'
> > +extern int yylex (void);
> > +
> >   int main ()
> >   {
> >     return yylex ();
>
> Please change `int main ()` to `int main (void)` as long as you're in here.

Agree.

>
> > --- 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 ())
>
> Same here.
>
> > --- a/t/yacc-basic.sh
> > +++ b/t/yacc-basic.sh
> > @@ -49,6 +49,7 @@ a : 'a' { exit(0); };
> >   END
> >
> >   cat > foo.c << 'END'
> > +extern int yyparse(void);
> >   int main () { yyparse (); return 1; }
> >   END
>
> And here.
>
> > --- a/t/yacc-clean.sh
> > +++ b/t/yacc-clean.sh
> > @@ -74,6 +76,8 @@ END
> >   cp sub1/parse.y sub2/parse.y
> >
> >   cat > sub1/main.c << 'END'
> > +extern int yyparse(void);
> > +
> >   int main ()
> >   {
> >     return yyparse ();
>
> And here.
>
> > --- a/t/yacc-nodist.sh
> > +++ b/t/yacc-nodist.sh
> > @@ -78,6 +78,8 @@ BUILT_SOURCES = parse.h
> >   END
> >
> >   cat > sub1/main.c << 'END'
> > +extern int yyparse(void);
> > +
> >   int main ()
> >   {
> >     return yyparse ();
>
> And here as well.
>
>
>





Information forwarded to automake-patches <at> gnu.org:
bug#59993; Package automake-patches. (Tue, 13 Dec 2022 21:02:02 GMT) Full text and rfc822 format available.

Message #14 received at submit <at> debbugs.gnu.org (full text, mbox):

From: "Zack Weinberg" <zack <at> owlfolio.org>
To: automake-patches <at> gnu.org
Subject: Re: [bug#59993] [PATCH 2/2] tests: Fix implicit function declaration
 errors
Date: Tue, 13 Dec 2022 15:58:10 -0500
On Tue, Dec 13, 2022, at 1:30 AM, Frederic Berat wrote:
> On Mon, Dec 12, 2022 at 9:19 PM Zack Weinberg <zack <at> owlfolio.org> wrote:
>> > --- a/t/ax/depcomp.sh
>> > +++ b/t/ax/depcomp.sh
>> > @@ -243,6 +243,7 @@ cat > sub/subfoo.h <<'END'
>> >   #include <stdio.h>
>> >   extern int subfoo (void);
>> >   END
>> > +cp sub/subfoo.h sub/subfoo.save
>> >
>> >   cat > src/baz.c <<'END'
>> >   #include "baz.h"
>> > @@ -399,8 +400,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 \
>> > +      && mv  "$srcdir"/sub/subfoo.save "$srcdir"/sub/subfoo.h \
>> >         && make_ok \
>> >         || r='not ok'
>> >       result_ "$r" "$pfx dependency tracking works"
>>
>> These changes don't seem to have anything to do with the patch as
>> described.  They should be submitted separately.
>
> Actually, that is related. The edit removes the "#include subfoo.h"
> line from foo.h, because the subfoo.h file got overwritten earlier.
> This subfoo.h is the one that had the function declaration in ("extern
> int subfoo (void);" specifically).
> Either you need the original header back, or you need to get the
> declaration back another way. I felt this way was easier than trying
> to insert a declaration without breaking the test.

OK, I clearly don't understand what this test is doing, so I'm going to
defer to someone else to review it.

zw




Information forwarded to automake-patches <at> gnu.org:
bug#59993; Package automake-patches. (Wed, 14 Dec 2022 07:11:02 GMT) Full text and rfc822 format available.

Message #17 received at 59993 <at> debbugs.gnu.org (full text, mbox):

From: Frederic Berat <fberat <at> redhat.com>
To: Zack Weinberg <zack <at> owlfolio.org>
Cc: 59993 <at> debbugs.gnu.org
Subject: Re: [bug#59993] [PATCH 2/2] tests: Fix implicit function declaration
 errors
Date: Wed, 14 Dec 2022 08:09:59 +0100
I'll separe this one in a dedicated patch and give it a more
detailed/specific explanation.

On Tue, Dec 13, 2022 at 10:02 PM Zack Weinberg <zack <at> owlfolio.org> wrote:
>
> On Tue, Dec 13, 2022, at 1:30 AM, Frederic Berat wrote:
> > On Mon, Dec 12, 2022 at 9:19 PM Zack Weinberg <zack <at> owlfolio.org> wrote:
> >> > --- a/t/ax/depcomp.sh
> >> > +++ b/t/ax/depcomp.sh
> >> > @@ -243,6 +243,7 @@ cat > sub/subfoo.h <<'END'
> >> >   #include <stdio.h>
> >> >   extern int subfoo (void);
> >> >   END
> >> > +cp sub/subfoo.h sub/subfoo.save
> >> >
> >> >   cat > src/baz.c <<'END'
> >> >   #include "baz.h"
> >> > @@ -399,8 +400,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 \
> >> > +      && mv  "$srcdir"/sub/subfoo.save "$srcdir"/sub/subfoo.h \
> >> >         && make_ok \
> >> >         || r='not ok'
> >> >       result_ "$r" "$pfx dependency tracking works"
> >>
> >> These changes don't seem to have anything to do with the patch as
> >> described.  They should be submitted separately.
> >
> > Actually, that is related. The edit removes the "#include subfoo.h"
> > line from foo.h, because the subfoo.h file got overwritten earlier.
> > This subfoo.h is the one that had the function declaration in ("extern
> > int subfoo (void);" specifically).
> > Either you need the original header back, or you need to get the
> > declaration back another way. I felt this way was easier than trying
> > to insert a declaration without breaking the test.
>
> OK, I clearly don't understand what this test is doing, so I'm going to
> defer to someone else to review it.
>
> zw
>
>
>





Information forwarded to automake-patches <at> gnu.org:
bug#59993; Package automake-patches. (Thu, 15 Dec 2022 16:49:02 GMT) Full text and rfc822 format available.

Message #20 received at 59993 <at> debbugs.gnu.org (full text, mbox):

From: Frederic Berat <fberat <at> redhat.com>
To: Zack Weinberg <zack <at> owlfolio.org>
Cc: 59993 <at> debbugs.gnu.org
Subject: Re: [bug#59993] [PATCH 2/2] tests: Fix implicit function declaration
 errors
Date: Thu, 15 Dec 2022 17:48:44 +0100
On Mon, Dec 12, 2022 at 9:19 PM Zack Weinberg <zack <at> owlfolio.org> wrote:
>
> On 2022-12-12 2:05 AM, Frederic Berat wrote:
> > This is related to an effort to prepare Automake for future GCC/Clang
> > versions which set c99 as default standard to be used.
> > Function should be properly declared prior to use in order to be
> > compatible with c99 standard.
>
> OK in principle, but ...
>
> > --- a/t/ax/depcomp.sh
> > +++ b/t/ax/depcomp.sh
> > @@ -243,6 +243,7 @@ cat > sub/subfoo.h <<'END'
> >   #include <stdio.h>
> >   extern int subfoo (void);
> >   END
> > +cp sub/subfoo.h sub/subfoo.save
> >
> >   cat > src/baz.c <<'END'
> >   #include "baz.h"
> > @@ -399,8 +400,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 \
> > +      && mv  "$srcdir"/sub/subfoo.save "$srcdir"/sub/subfoo.h \
> >         && make_ok \
> >         || r='not ok'
> >       result_ "$r" "$pfx dependency tracking works"
>
> These changes don't seem to have anything to do with the patch as
> described.  They should be submitted separately.
>
> > --- a/t/lex-nodist.sh
> > +++ b/t/lex-nodist.sh
> > @@ -62,6 +62,8 @@ CLEANFILES = $(nodist_prog_SOURCES)
> >   END
> >
> >   cat > main.c << 'END'
> > +extern int yylex (void);
> > +
> >   int main ()
> >   {
> >     return yylex ();
>
> Please change `int main ()` to `int main (void)` as long as you're in here.

I'm hesitant on this. That isn't the purpose of the patch, and if I
start to do that, there are about 48 files that would need to be
touched (which omit void for empty argument list). Kind of a noisy
change with no real benefit.
But if you insist, I can do the ones in the files I touched.

>
> > --- 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 ())
>
> Same here.
>
> > --- a/t/yacc-basic.sh
> > +++ b/t/yacc-basic.sh
> > @@ -49,6 +49,7 @@ a : 'a' { exit(0); };
> >   END
> >
> >   cat > foo.c << 'END'
> > +extern int yyparse(void);
> >   int main () { yyparse (); return 1; }
> >   END
>
> And here.
>
> > --- a/t/yacc-clean.sh
> > +++ b/t/yacc-clean.sh
> > @@ -74,6 +76,8 @@ END
> >   cp sub1/parse.y sub2/parse.y
> >
> >   cat > sub1/main.c << 'END'
> > +extern int yyparse(void);
> > +
> >   int main ()
> >   {
> >     return yyparse ();
>
> And here.
>
> > --- a/t/yacc-nodist.sh
> > +++ b/t/yacc-nodist.sh
> > @@ -78,6 +78,8 @@ BUILT_SOURCES = parse.h
> >   END
> >
> >   cat > sub1/main.c << 'END'
> > +extern int yyparse(void);
> > +
> >   int main ()
> >   {
> >     return yyparse ();
>
> And here as well.
>
>
>





Information forwarded to automake-patches <at> gnu.org:
bug#59993; Package automake-patches. (Fri, 16 Dec 2022 06:19:02 GMT) Full text and rfc822 format available.

Message #23 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Frederic Berat <fberat <at> redhat.com>
To: automake-patches <at> gnu.org
Cc: Frédéric Bérat <fberat <at> redhat.com>
Subject: [PATCH v2 2/3] tests: Fix implicit function declaration errors
Date: Fri, 16 Dec 2022 07:17:18 +0100
From: Frédéric Bérat <fberat <at> redhat.com>

Changes from v1:
  Modifications to "t/ax/depcomp.sh" have been moved to a dedicated patch

-- 8< --

This is related to an effort to prepare Automake for future GCC/Clang
versions which set c99 as default standard to be used.

Function should be properly declared prior to use in order to be
compatible with c99 standard.
This is valid for both local functions and standard functions (as
printf).

Modified files:

 * t/c-demo.sh
 * t/cond35.sh
 * t/dist-vs-built-sources.sh
 * t/lex-clean.sh
 * t/lex-multiple.sh
 * t/lex-nodist.sh
 * t/ltcond2.sh
 * t/ltconv.sh
 * t/subobj-clean-lt-pr10697.sh
 * t/subobj-clean-pr10697.sh
 * t/tags-pr12372.sh
 * t/yacc-basic.sh
 * t/yacc-clean.sh
 * t/yacc-nodist.sh
---
 t/c-demo.sh                  |  1 +
 t/cond35.sh                  |  2 ++
 t/dist-vs-built-sources.sh   |  1 +
 t/lex-clean.sh               |  1 +
 t/lex-multiple.sh            |  4 ++++
 t/lex-nodist.sh              |  2 ++
 t/ltcond2.sh                 |  2 ++
 t/ltconv.sh                  |  6 ++++++
 t/subobj-clean-lt-pr10697.sh | 10 +++++++++-
 t/subobj-clean-pr10697.sh    | 10 +++++++++-
 t/tags-pr12372.sh            |  3 ++-
 t/yacc-basic.sh              |  1 +
 t/yacc-clean.sh              |  4 ++++
 t/yacc-nodist.sh             |  2 ++
 14 files changed, 46 insertions(+), 3 deletions(-)

diff --git a/t/c-demo.sh b/t/c-demo.sh
index 7e0e8d64f..d25bf214b 100644
--- 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)
diff --git a/t/cond35.sh b/t/cond35.sh
index 215a22548..bad133970 100644
--- a/t/cond35.sh
+++ b/t/cond35.sh
@@ -73,6 +73,8 @@ END
 
 cat > tparse.y << 'END'
 %{
+extern int yylex(void);
+
 void yyerror (const char *s) {}
 %}
 %token EOF
diff --git a/t/dist-vs-built-sources.sh b/t/dist-vs-built-sources.sh
index d038e66dd..db2776f9a 100644
--- 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
diff --git a/t/lex-clean.sh b/t/lex-clean.sh
index 5aa199338..e53da8fd2 100644
--- a/t/lex-clean.sh
+++ b/t/lex-clean.sh
@@ -61,6 +61,7 @@ cat > lexer.l << 'END'
 END
 
 cat > main.c << 'END'
+extern int yylex (void);
 int main (void)
 {
   return yylex ();
diff --git a/t/lex-multiple.sh b/t/lex-multiple.sh
index 2655b633e..bf119ec84 100644
--- a/t/lex-multiple.sh
+++ b/t/lex-multiple.sh
@@ -56,6 +56,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)
diff --git a/t/lex-nodist.sh b/t/lex-nodist.sh
index 599539405..187dd5437 100644
--- a/t/lex-nodist.sh
+++ b/t/lex-nodist.sh
@@ -62,6 +62,8 @@ CLEANFILES = $(nodist_prog_SOURCES)
 END
 
 cat > main.c << 'END'
+extern int yylex (void);
+
 int main ()
 {
   return yylex ();
diff --git a/t/ltcond2.sh b/t/ltcond2.sh
index 29244c9b3..7e7bcadc4 100644
--- 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();
diff --git a/t/ltconv.sh b/t/ltconv.sh
index 2c4cc47a1..ec79ef80e 100644
--- 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 ())
diff --git a/t/subobj-clean-lt-pr10697.sh b/t/subobj-clean-lt-pr10697.sh
index bb656c43f..53fc02f09 100644
--- 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
diff --git a/t/subobj-clean-pr10697.sh b/t/subobj-clean-pr10697.sh
index f77de8c92..a7f97f6d1 100644
--- 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
diff --git a/t/tags-pr12372.sh b/t/tags-pr12372.sh
index b9c022f70..1a9e1e026 100644
--- 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 <at> in(void) { return 0; }' > sub/zardoz.pc
 
diff --git a/t/yacc-basic.sh b/t/yacc-basic.sh
index 5b258a30c..8cc0d06a2 100644
--- a/t/yacc-basic.sh
+++ b/t/yacc-basic.sh
@@ -49,6 +49,7 @@ a : 'a' { exit(0); };
 END
 
 cat > foo.c << 'END'
+extern int yyparse(void);
 int main () { yyparse (); return 1; }
 END
 
diff --git a/t/yacc-clean.sh b/t/yacc-clean.sh
index 373774b6a..fef079cf3 100644
--- a/t/yacc-clean.sh
+++ b/t/yacc-clean.sh
@@ -65,6 +65,8 @@ END
 
 cat > sub1/parse.y << 'END'
 %{
+#include <stdio.h>
+
 int yylex () { return (getchar ()); }
 void yyerror (const char *s) {}
 %}
@@ -74,6 +76,8 @@ END
 cp sub1/parse.y sub2/parse.y
 
 cat > sub1/main.c << 'END'
+extern int yyparse(void);
+
 int main ()
 {
   return yyparse ();
diff --git a/t/yacc-nodist.sh b/t/yacc-nodist.sh
index d350a80f9..4a8ebe9ca 100644
--- a/t/yacc-nodist.sh
+++ b/t/yacc-nodist.sh
@@ -78,6 +78,8 @@ BUILT_SOURCES = parse.h
 END
 
 cat > sub1/main.c << 'END'
+extern int yyparse(void);
+
 int main ()
 {
   return yyparse ();
-- 
2.38.1





Information forwarded to automake-patches <at> gnu.org:
bug#59993; Package automake-patches. (Fri, 16 Dec 2022 06:19:02 GMT) Full text and rfc822 format available.

Message #26 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Frederic Berat <fberat <at> redhat.com>
To: automake-patches <at> gnu.org
Cc: Frédéric Bérat <fberat <at> redhat.com>
Subject: [PATCH v2 3/3] tests: Fix implicit function declaration in
 ax/depcomp.sh
Date: Fri, 16 Dec 2022 07:17:19 +0100
From: Frédéric Bérat <fberat <at> redhat.com>

Changes from v1:
  Split from [PATCH 2/2]

-- 8< --

In depcomp.sh, the following occurs:

1. Files are created so that headers and units are available in
   subdirectories
2. Multiple "make" are executed, while modifying the content of the
   headers, some should fail, others should succeed.
3. At the end, the "sub/subfoo.h" header gets removed.
4. make is executed again, which is expected to succeed.

Yet, with c99, this can't work as the subfoo.h header contains
declaration that are used by foo.c.
Thus, we need to get them back, either by inserting the declaration in
foo.c (or any other header/unit), or by restoring subfoo.h to its
original state.

The later solution seems the easiest path, being less intrusive in
depcomp.sh.
---
 t/ax/depcomp.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/t/ax/depcomp.sh b/t/ax/depcomp.sh
index e4e7565df..a9debc8ef 100644
--- a/t/ax/depcomp.sh
+++ b/t/ax/depcomp.sh
@@ -243,6 +243,7 @@ cat > sub/subfoo.h <<'END'
 #include <stdio.h>
 extern int subfoo (void);
 END
+cp sub/subfoo.h sub/subfoo.save
 
 cat > src/baz.c <<'END'
 #include "baz.h"
@@ -399,8 +400,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 \
+      && mv  "$srcdir"/sub/subfoo.save "$srcdir"/sub/subfoo.h \
       && make_ok \
       || r='not ok'
     result_ "$r" "$pfx dependency tracking works"
-- 
2.38.1





Information forwarded to automake-patches <at> gnu.org:
bug#59993; Package automake-patches. (Thu, 29 Dec 2022 03:23:02 GMT) Full text and rfc822 format available.

Message #29 received at 59993 <at> debbugs.gnu.org (full text, mbox):

From: Zack Weinberg <zack <at> owlfolio.org>
To: Frederic Berat <fberat <at> redhat.com>
Cc: 59993 <at> debbugs.gnu.org
Subject: Re: [bug#59993] [PATCH 2/2] tests: Fix implicit function declaration
 errors
Date: Wed, 28 Dec 2022 22:20:50 -0500
On Thu, 15 Dec 2022 11:48:44 -0500, Frederic Berat wrote:
> On Mon, Dec 12, 2022 at 9:19 PM Zack Weinberg <zack <at> owlfolio.org> wrote:
> > >     return yylex ();
> > Please change `int main ()` to `int main (void)` as long as you're in here.
> I'm hesitant on this. That isn't the purpose of the patch, and if I
> start to do that, there are about 48 files that would need to be
> touched (which omit void for empty argument list).

Yeah, I suppose that ought to be its own separate patch, in that
case.

> Kind of a noisy change with no real benefit.

It’d be a step in the direction of making the testsuite run cleanly
with -Wstrict-prototypes and/or -Wold-style-definition, which might
plausibly help with the related effort to support compilers that
reject old-style definitions.  But I agree that it’s not a high
priority and shouldn’t block this patch.

zw




Information forwarded to automake-patches <at> gnu.org:
bug#59993; Package automake-patches. (Fri, 13 Jan 2023 06:49:01 GMT) Full text and rfc822 format available.

Message #32 received at 59993 <at> debbugs.gnu.org (full text, mbox):

From: Mike Frysinger <vapier <at> gentoo.org>
To: Frederic Berat <fberat <at> redhat.com>
Cc: 59993 <at> debbugs.gnu.org
Subject: Re: [PATCH v2 3/3] tests: Fix implicit function declaration in
 ax/depcomp.sh
Date: Fri, 13 Jan 2023 06:48:04 +0000 (UTC)
this breaks `make check`, so i can't merge it
-mike




Information forwarded to automake-patches <at> gnu.org:
bug#59993; Package automake-patches. (Fri, 13 Jan 2023 07:58:02 GMT) Full text and rfc822 format available.

Message #35 received at 59993 <at> debbugs.gnu.org (full text, mbox):

From: Frederic Berat <fberat <at> redhat.com>
To: Mike Frysinger <vapier <at> gentoo.org>
Cc: 59993 <at> debbugs.gnu.org
Subject: Re: [PATCH v2 3/3] tests: Fix implicit function declaration in
 ax/depcomp.sh
Date: Fri, 13 Jan 2023 08:57:11 +0100
[Message part 1 (text/plain, inline)]
That's strange, although I tested it on top of automake-1.16.5, I don't
have any failure on `make check` with this one here [1].

May you provide more details ?


[1]
============================================================================
Testsuite summary for GNU Automake 1.16.5
============================================================================
# TOTAL: 2980
# PASS:  2882
# SKIP:  60
# XFAIL: 38
# FAIL:  0
# XPASS: 0
# ERROR: 0
============================================================================

On Fri, Jan 13, 2023 at 7:48 AM Mike Frysinger <vapier <at> gentoo.org> wrote:

> this breaks `make check`, so i can't merge it
> -mike
>
>
[Message part 2 (text/html, inline)]

Information forwarded to automake-patches <at> gnu.org:
bug#59993; Package automake-patches. (Fri, 13 Jan 2023 08:15:01 GMT) Full text and rfc822 format available.

Message #38 received at 59993 <at> debbugs.gnu.org (full text, mbox):

From: Frederic Berat <fberat <at> redhat.com>
To: Mike Frysinger <vapier <at> gentoo.org>
Cc: 59993 <at> debbugs.gnu.org
Subject: Re: [PATCH v2 3/3] tests: Fix implicit function declaration in
 ax/depcomp.sh
Date: Fri, 13 Jan 2023 09:14:03 +0100
[Message part 1 (text/plain, inline)]
I made one more build with a different patchset list, could it be that the
failure you encounter is with "t/subobj.sh" ?

In my tests run this failure is fixed by:
https://lists.gnu.org/archive/html/automake-patches/2022-12/msg00001.html

On Fri, Jan 13, 2023 at 8:57 AM Frederic Berat <fberat <at> redhat.com> wrote:

> That's strange, although I tested it on top of automake-1.16.5, I don't
> have any failure on `make check` with this one here [1].
>
> May you provide more details ?
>
>
> [1]
>
> ============================================================================
> Testsuite summary for GNU Automake 1.16.5
>
> ============================================================================
> # TOTAL: 2980
> # PASS:  2882
> # SKIP:  60
> # XFAIL: 38
> # FAIL:  0
> # XPASS: 0
> # ERROR: 0
>
> ============================================================================
>
> On Fri, Jan 13, 2023 at 7:48 AM Mike Frysinger <vapier <at> gentoo.org> wrote:
>
>> this breaks `make check`, so i can't merge it
>> -mike
>>
>>
[Message part 2 (text/html, inline)]

Information forwarded to automake-patches <at> gnu.org:
bug#59993; Package automake-patches. (Fri, 13 Jan 2023 08:48:02 GMT) Full text and rfc822 format available.

Message #41 received at 59993 <at> debbugs.gnu.org (full text, mbox):

From: Mike Frysinger <vapier <at> gentoo.org>
To: Frederic Berat <fberat <at> redhat.com>
Cc: 59993 <at> debbugs.gnu.org
Subject: Re: [PATCH v2 3/3] tests: Fix implicit function declaration in
 ax/depcomp.sh
Date: Fri, 13 Jan 2023 03:47:28 -0500
[Message part 1 (text/plain, inline)]
On 13 Jan 2023 09:14, Frederic Berat wrote:
> I made one more build with a different patchset list, could it be that the
> failure you encounter is with "t/subobj.sh" ?

to be clear, i applied this patch only to current git master.  i didn't try
including anything else.  with that in mind, the failure is not in that, but
in t/depcomp-auto.tap.
FAIL: t/depcomp-auto
FAIL: t/depcomp-auto.tap 14 - [simple VPATH] make distclean
FAIL: t/depcomp-auto.tap 21 - [long VPATH] make distclean
FAIL: t/depcomp-auto.tap 28 - [absolute VPATH] make distclean

ERROR: files left in build directory after distclean:
./.deps/foo.Tpo
make: *** [Makefile:750: distcleancheck] Error 1
-mike
[signature.asc (application/pgp-signature, inline)]

Information forwarded to automake-patches <at> gnu.org:
bug#59993; Package automake-patches. (Fri, 13 Jan 2023 09:58:02 GMT) Full text and rfc822 format available.

Message #44 received at 59993 <at> debbugs.gnu.org (full text, mbox):

From: Frederic Berat <fberat <at> redhat.com>
To: Mike Frysinger <vapier <at> gentoo.org>
Cc: 59993 <at> debbugs.gnu.org
Subject: Re: [PATCH v2 3/3] tests: Fix implicit function declaration in
 ax/depcomp.sh
Date: Fri, 13 Jan 2023 10:57:21 +0100
[Message part 1 (text/plain, inline)]
Ok, I'll try to figure out why this test passes on 1.16.5 but not on HEAD
with the same patch.

On Fri, Jan 13, 2023 at 9:47 AM Mike Frysinger <vapier <at> gentoo.org> wrote:

> On 13 Jan 2023 09:14, Frederic Berat wrote:
> > I made one more build with a different patchset list, could it be that
> the
> > failure you encounter is with "t/subobj.sh" ?
>
> to be clear, i applied this patch only to current git master.  i didn't try
> including anything else.  with that in mind, the failure is not in that,
> but
> in t/depcomp-auto.tap.
> FAIL: t/depcomp-auto
> FAIL: t/depcomp-auto.tap 14 - [simple VPATH] make distclean
> FAIL: t/depcomp-auto.tap 21 - [long VPATH] make distclean
> FAIL: t/depcomp-auto.tap 28 - [absolute VPATH] make distclean
>
> ERROR: files left in build directory after distclean:
> ./.deps/foo.Tpo
> make: *** [Makefile:750: distcleancheck] Error 1
> -mike
>
[Message part 2 (text/html, inline)]

Information forwarded to automake-patches <at> gnu.org:
bug#59993; Package automake-patches. (Mon, 16 Jan 2023 09:16:01 GMT) Full text and rfc822 format available.

Message #47 received at 59993 <at> debbugs.gnu.org (full text, mbox):

From: Frederic Berat <fberat <at> redhat.com>
To: Mike Frysinger <vapier <at> gentoo.org>
Cc: 59993 <at> debbugs.gnu.org
Subject: Re: [PATCH v2 3/3] tests: Fix implicit function declaration in
 ax/depcomp.sh
Date: Mon, 16 Jan 2023 10:15:09 +0100
[Message part 1 (text/plain, inline)]
I'm still investigating this failure.

So far I could find 2 similar scenarios, both based on 1.16.5 with the
patch, but one that fails, and the other that succeeds, seemingly
consistently.
Case 1: using the 1.16.5 tarball + the patch applied, automake is built and
tested within fedora environment (with specific env variables and flags
...), the test seems to pass consistently.
Case 2: using the 1.16.5 tarball + the patch applied, I distclean,
bootstrap, reconfigure (using same configure command as case 1) and build
manually, the test seems to fail consistently.
Both builds are run within the same chroot.

In the failure case, foo.o doesn't get rebuilt when the header is restored
to its original state, whereas the header is listed in the foo.Tpo file.
Since foo.o isn't rebuilt, the foo.Tpo file isn't moved to foo.Po, which
leads to the test failure.

I'm trying to figure out why in one case foo.o is consistently rebuilt,
while not in the other.

On Fri, Jan 13, 2023 at 10:57 AM Frederic Berat <fberat <at> redhat.com> wrote:

> Ok, I'll try to figure out why this test passes on 1.16.5 but not on HEAD
> with the same patch.
>
> On Fri, Jan 13, 2023 at 9:47 AM Mike Frysinger <vapier <at> gentoo.org> wrote:
>
>> On 13 Jan 2023 09:14, Frederic Berat wrote:
>> > I made one more build with a different patchset list, could it be that
>> the
>> > failure you encounter is with "t/subobj.sh" ?
>>
>> to be clear, i applied this patch only to current git master.  i didn't
>> try
>> including anything else.  with that in mind, the failure is not in that,
>> but
>> in t/depcomp-auto.tap.
>> FAIL: t/depcomp-auto
>> FAIL: t/depcomp-auto.tap 14 - [simple VPATH] make distclean
>> FAIL: t/depcomp-auto.tap 21 - [long VPATH] make distclean
>> FAIL: t/depcomp-auto.tap 28 - [absolute VPATH] make distclean
>>
>> ERROR: files left in build directory after distclean:
>> ./.deps/foo.Tpo
>> make: *** [Makefile:750: distcleancheck] Error 1
>> -mike
>>
>
[Message part 2 (text/html, inline)]

Information forwarded to automake-patches <at> gnu.org:
bug#59993; Package automake-patches. (Tue, 29 Aug 2023 18:02:01 GMT) Full text and rfc822 format available.

Message #50 received at 59993 <at> debbugs.gnu.org (full text, mbox):

From: Karl Berry <karl <at> freefriends.org>
To: fberat <at> redhat.com
Cc: 59993 <at> debbugs.gnu.org
Subject: Re: [bug#59993] [PATCH v2 3/3] tests: Fix implicit function
 declaration in ax/depcomp.sh
Date: Tue, 29 Aug 2023 12:01:30 -0600
    Subject: [bug#59993] [PATCH v2 2/3] tests: Fix implicit function declaration
     errors

I applied this part of the patch. Final diff as applied below.

    Subject: [bug#59993] [PATCH v2 3/3] tests: Fix implicit function declaration
     in ax/depcomp.sh

Part 3 for t/ax/depcomp.sh was applied/fixed in
https://bugs.gnu.org/60962.

I think the "random" failures mentioned toward the end of this patch
(msg#47 and preceding) were the timing problem with autom4te we
found/discussed elsewhere (https://bugs.gnu.org/64756).

Thus I think this bug is finally complete? Closing ... --thanks, karl.

-----------------------------------------------------------------------------
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.

diff --git a/t/c-demo.sh b/t/c-demo.sh
index 446551958..ee0d5c3ec 100644
--- 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)
diff --git a/t/cond35.sh b/t/cond35.sh
index 8b044644e..a00c9e280 100644
--- 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
diff --git a/t/dist-vs-built-sources.sh b/t/dist-vs-built-sources.sh
index da8c8fb23..4c73d53b0 100644
--- 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
diff --git a/t/lex-clean.sh b/t/lex-clean.sh
index 4668e97c7..a966b4b07 100644
--- 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 ();
diff --git a/t/lex-multiple.sh b/t/lex-multiple.sh
index 6486a012f..32dd854b6 100644
--- 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)
diff --git a/t/lex-nodist.sh b/t/lex-nodist.sh
index d499aea7f..29f0cb0ec 100644
--- 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 ();
diff --git a/t/ltcond2.sh b/t/ltcond2.sh
index 000d0ad34..c9f7af1dc 100644
--- 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();
diff --git a/t/ltconv.sh b/t/ltconv.sh
index 64e42949a..3c35f50e7 100644
--- 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 ())
diff --git a/t/subobj-clean-lt-pr10697.sh b/t/subobj-clean-lt-pr10697.sh
index 0b4bb10a7..94af0778b 100644
--- 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
diff --git a/t/subobj-clean-pr10697.sh b/t/subobj-clean-pr10697.sh
index 591684bc8..360716ec3 100644
--- 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
diff --git a/t/tags-pr12372.sh b/t/tags-pr12372.sh
index 7e86f7214..19ac07da4 100644
--- 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 <at> in(void) { return 0; }' > sub/zardoz.pc

diff --git a/t/yacc-basic.sh b/t/yacc-basic.sh
index 51ee5f6a3..be578e14a 100644
--- 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

diff --git a/t/yacc-clean.sh b/t/yacc-clean.sh
index d0f793843..da2e3d5b2 100644
--- 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 ();
diff --git a/t/yacc-nodist.sh b/t/yacc-nodist.sh
index 8e5338e94..e3b02b3fa 100644
--- 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 ();

compile finished at Tue Aug 29 11:00:41 2023




Reply sent to Karl Berry <karl <at> freefriends.org>:
You have taken responsibility. (Tue, 29 Aug 2023 18:02:02 GMT) Full text and rfc822 format available.

Notification sent to Frederic Berat <fberat <at> redhat.com>:
bug acknowledged by developer. (Tue, 29 Aug 2023 18:02:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 27 Sep 2023 11:24:15 GMT) Full text and rfc822 format available.

This bug report was last modified 212 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.