Re: gdb: disable -Wmissing-prototypes warning w/gcc

Mike Frysinger via Gdb-patches
2021-11-04T20:18:25Z

[-- Attachment #1: Type: text/plain, Size: 1458 bytes --]

On 04 Nov 2021 14:43, Simon Marchi via Gdb-patches wrote:
> > Just wondering, does anybody care about building GDB with a compiler
> > other than GCC and Clang? Because another way that excludes the warning
> > just for gcc (rather than include it for anything that isn't gcc) would
> > be (in pseudo code):
> >
> > diff --git a/gdbsupport/warning.m4 b/gdbsupport/warning.m4
> > index 46036fa461e8..33a729a60d5d 100644
> > --- a/gdbsupport/warning.m4
> > +++ b/gdbsupport/warning.m4
> > @@ -150,7 +150,7 @@ then
> > [WARN_CFLAGS="${WARN_CFLAGS} $w"],
> > []
> > )
> > - else
> > + elif (compiler is not gcc) or (warning is not -Wmissing-prototypes); then
> > AC_COMPILE_IFELSE(
> > [AC_LANG_PROGRAM([], [])],
> > [WARN_CFLAGS="${WARN_CFLAGS} $w"],
> >
> > If that works, I think it would be preferable, but otherwise I think
> > your patch is OK. Please push whatever makes the most sense to you, so
> > we can finally get rid of this warning :).
>
> Hmm, actually using $GCC doesn't work: it gets set to yes even when
> building with clang. I think it means more "does the compiler supports
> the GNU extension", which the clang compiler supports, for the most
> part. And the goal is to have -Wmissing-prototypes when building with
> clang.

we could invert the logic: only add the flag if it's clang.

we can test for clang via --version grep or a __clang__ preproc test.
-mike

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]