Re: [PATCH] merge-file: fix build warning with gcc 4.8.5
- From
Đoàn Trần Công Danh <congdanhqx@gmail.com>
- Date
- Jul 30, 2022, 00:19 UTC
- Message-ID
- <YuR5Jado2LrtZUjP@danh.dev>
- In-Reply-To
- <YuQ60ZUPBHAVETD7@coredump.intra.peff.net>
On 2022-07-29 15:53:53-0400, Jeff King <peff@peff.net> wrote:
Show 40 quoted lines
> On Fri, Jul 29, 2022 at 08:48:46AM -0700, Junio C Hamano wrote:
>
> > I think the concensus was that we should squelch the false warning
> > on older compilers with -Wno-missing-braces, but then the discussion
> > has stalled by a suggestion to introduce a way to detect older
> > compilers that is different from how we do so at the same time, and
> > went nowhere.
> >
> > Hopefully we can add a simple -Wno-* without waiting for whole
> > config.mak thing getting revamped this time?
>
> Perhaps this?
>
> -- >8 --
> Subject: [PATCH] config.mak.dev: squelch -Wno-missing-braces for older gcc
>
> Versions of gcc prior to 4.9 complain about an initialization like:
>
> struct inner { int x; };
> struct outer { struct inner; };
> struct outer foo = { 0 };
>
> and insist on:
>
> struct outer foo = { { 0 } };
>
> Newer compilers handle this just fine. And ignoring the window even on
> older compilers is fine; the resulting code is correct, but we just get
> caught by -Werror.
>
> Let's relax this for older compilers to make developer lives easier (we
> don't care much about non-developers on old compilers; they may see a
> warning, but it won't stop compilation).
>
> Signed-off-by: Jeff King <peff@peff.net>
> ---
> Tested on a debian jessie chroot using gcc-4.8 and 4.9. Though note that
> you also need to manually specify -std=gnu99 to get it to work at all
> with those compilers these days! So I kind of wonder if it's even worth
> catering to their warnings automatically.Well, config.mak.uname automatically adds -std=c99 for RHEL 7 and CentOS7. Can we add the same things for Debian? Or should we just remove both?
-- Danh