Re: __attribute__ to selectively disable -Wmaybe-uninitialized

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

 



On Fri, Oct 23, 2020 at 01:01:13PM -0700, mark_at_yahoo via Gcc-help wrote:
> 3. I don't want to disable -Wmaybe-uninitialized globally, or for an 
> entire function. Warnings are "A Good Thing"(tm).

Yes.  And you usually should make trivial changes to your program if the
compiler warns, even if you consider that unnecessary -- just so that
you will not miss other warnings!

> 4. Please, no lectures on why local variables should always be 
> initialized at declaration.

No, but you can write your code so that it more obviously does not use
unitialised variables.  This is an Even Better Thing(tm).  The compiler
will understand it, but much more importantly, human readers will
understand it as well!

-Wmaybe-uninitialized has a LOT of false positives if you use anything
but the strictest, simplest control flow.  It's the nature of the beast.

> 5. I now see something similar was requested in 2012 in 
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55288 but seems to have 
> been dismissed with a variation of #4.

It wasn't dismissed, that PR is still open.


Segher



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux