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.

Full log


View this message in rfc822 format

From: Frederic Berat <fberat <at> redhat.com>
To: Zack Weinberg <zack <at> owlfolio.org>
Cc: 59993 <at> debbugs.gnu.org
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 <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.
>
>
>





This bug report was last modified 1 year and 263 days ago.

Previous Next


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