automake-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#59993] [PATCH 2/2] tests: Fix implicit function declaration errors


From: Frederic Berat
Subject: [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@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.
>
>
>






reply via email to

[Prev in Thread] Current Thread [Next in Thread]