Re: [PATCH 3/5] reftable/stack: fix compiler warning due to missing braces

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

 



On Fri, Aug 01, 2025 at 03:19:52PM -0400, Eric Sunshine wrote:
> On Fri, Aug 1, 2025 at 10:48 AM Patrick Steinhardt <ps@xxxxxx> wrote:
> > While perfectly legal, older compiler toolchains complain when
> > zero-initializing structs that contain nested structs with `{0}`:
> > [...]
> > Silence this warning by using `{{0}}` instead.
> >
> > Signed-off-by: Patrick Steinhardt <ps@xxxxxx>
> > ---
> > diff --git a/reftable/stack.c b/reftable/stack.c
> > -#define REFTABLE_ADDITION_INIT {0}
> > +#define REFTABLE_ADDITION_INIT {{0}}
> 
> For what it's worth, the last time this sort of issue came up[*], I
> believe the ultimate response was that the project ought not pander to
> this particular instance of buggy compiler and that, instead, an
> individual developer should, if bothered by the warning, use the
> appropriate compiler option to suppress the warning. Whether or not
> that attitude should apply also to the reftable code which is meant to
> be shareable, is a separate question, but at least that previous
> discussion thread provides some background regarding how different
> developers feel or felt about the issue.
> 
> [*]: https://lore.kernel.org/git/20220710081135.74964-1-sunshine@xxxxxxxxxxxxxx/T/

Yeah, in general I'm also of the opinion that we shouldn't bother. But
in libgit2 we have pipelines that use such older compilers, and we don't
want to drop those for now. So I think we should treat the reftable
library specially, doubly so as this is the only instance that causes
problems.

Thanks for digging up that old thread!

Patrick




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux