Re: gcc warning with "some variable may be used uninitialized in this function [-Wmaybe-uninitialized]" when building under msys

Tom Tromey <[email protected]>
Newsgroups gmane.comp.gdb.devel
Message-ID <[email protected]>
>>>>> "Pedro" == Pedro Alves <[email protected]> writes:

Pedro> If the warnings confuse people too much, I'd be OK with
Pedro> disabling -Wmaybe-uninitlized completely.  I left it as a
Pedro> -Wno-error warning because even though it produces false positives,
Pedro> it also helps catch bugs earlier in the compile-edit cycle,
Pedro> when you're hacking some code, when you're introducing
Pedro> uninitialized uses, and "make" ends up compiling just a few
Pedro> files.

It caught a bug in the -Wshadow=local series; and I think in most cases
the false reports are easily handled with an initialization.  I suppose
in theory these initializations could themselves mask bugs, but I don't
recall that ever actually happening (or at least being noticed).

It would be good if gcc could recognize std::optional and not issue the
warning when it is used.  Perhaps gdb could then just always use
optional for the maybe-not-initialized cases.

Tom
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.