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

Frederic Berat <[email protected]>
Newsgroups gmane.comp.sysutils.automake.patches
Message-ID <CAObJKZqECEhajQ=haVFGgOOqULih1fZRotkpKO6-4HHO08XJsg@mail.gmail.com>
On Mon, Dec 12, 2022 at 9:19 PM Zack Weinberg <[email protected]> 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.
>
>
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.