On 02/05/2019 05:07 PM, Jeff Law wrote:
> FWIW, I've been doing Fedora rawhide builds with gcc-9 since early Jan.
>  Not everything builds with -Wall -Werror, but lots of packages do.
> I've only seen one maybe-uninit warning cause problems -- it was
> spurious and for a memory object.  I didn't dig into it at all.

Do you have insight into how many Fedora packages explicitly disable
maybe-uninit?  I really don't know the answer to that, but I'd at least
keep that in mind as a possible reason for the warning seemingly
not causing trouble often.

GDB disables it (or rather, removes it from -Werror), and I wouldn't be
surprised if other C++ programs do the same, when they start using
std::optional more.  Since boost::optional also triggers the same warnings,
set may be even larger than C++11-or-later programs.

I don't know how to search the Fedora codebase, but a github search
for "-Wno-maybe-uninitialized" shows > 100k hits:

 https://github.com/search?q=-Wno-maybe-uninitialized&type=Code

and a search for -Wno-error=maybe-uninitialized shows >10k:

 https://github.com/search?q=-Wno-error%3Dmaybe-uninitialized&type=Code

That's a much higher hit rate than say -Wno-array-bounds or 
-Wno-format-overflow, or -Wno-stringop-overflow, which were some
searches I tried.

> 
> In contrast things like the missing NUL termination warnings, buffer
> overflow warnings, NULL strings to *printf* warnings, etc all caught
> numerous (dozens) of real bugs.  I mention it because it's one of the
> ways I know packages are building with -Wall -Werror :-)

Thanks,
Pedro Alves

Reply via email to