I think it would be nice if there were a way of suppressing
the warning on a case-by-case basis, like with an
__attribute__((uninitialized)) or something. We could add
that annotation to places where we know not initializing
is safe, and treat the remaining cases as errors.

Cheers,
Botond

----- Original Message -----
> From: "L. David Baron" <dba...@dbaron.org>
> To: "Zack Weinberg" <za...@panix.com>
> Cc: dev-platform@lists.mozilla.org
> Sent: Thursday, February 27, 2014 3:57:56 PM
> Subject: Re: Fixing build warnings [was: Re: Always brace your ifs]
> 
> On Thursday 2014-02-27 15:44 -0500, Zack Weinberg wrote:
> > This is exactly the same thing dbaron said the last time I brought
> > this up (quite some time ago - 2010, maybe?)  I didn't buy it then and
> > I don't buy it now.  I think it is far more likely that a
> > maybe-used-uninitialized true positive will *go unnoticed* because
> > we've trained ourselves to ignore those warnings, and I don't think
> > better precision in a valgrind run is worth the risk of letting a true
> > positive slip through in a release build.  Those bugs tend to be
> > security critical.
> 
> I'm ok with it if you're initializing it to a value that's properly
> handled as a reasonable default by the later code.
> 
> But if you're initializing it to something that's arbitrary or
> useless (like, say, initializing an enumerated type to 0 so that
> you'll fall into whichever case that happens to be, whether it
> involves assuming a tagged pointer is of a certain type or not), I'm
> still against, and I'd rather see the valgrind warning.
> 
> But I'm ok with restructuring the code to avoid having either
> problem.
> 
> > I also defy anyone to demonstrate a measurable performance impact from
> > the tiny amount of additional machine code that might be emitted if we
> > added initializations to squelch all those warnings.
> 
> I'm not at all concerned about performance impact.
> 
> -David
> 
> --
> 𝄞   L. David Baron                         http://dbaron.org/   𝄂
> 𝄢   Mozilla                          https://www.mozilla.org/   𝄂
>              Before I built a wall I'd ask to know
>              What I was walling in or walling out,
>              And to whom I was like to give offense.
>                - Robert Frost, Mending Wall (1914)
> 
> _______________________________________________
> dev-platform mailing list
> dev-platform@lists.mozilla.org
> https://lists.mozilla.org/listinfo/dev-platform
> 
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to