Re: any way to disable a single *instance* of a GCC warning?

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

 



> <http://gcc.gnu.org/onlinedocs/gcc/Diagnostic-Pragmas.html>
says:
"while it is syntactically valid to put these pragmas anywhere in your
sources, the only supported location for them is before any data or
functions are defined"

so what you are doing is already "illegal" so to speak :)

I would guess that the reason such information cannot be localised to
a single line is that the compiler is free to re-order the code to
optimise it, so the code no longer exists in a line-by-line form by
the time the checks are applied (if, indeed, it ever did except in the
preprocessor). In other words, what you are trying to do is not
possible due to the way code gets munged in the compiler.
   Syntactically, it may seem to "only apply to that line" but in
reality that line and the other lines in that function are part of a
code soup that get gently stirred throughout the compilation process;
only externally-visible (non-static) functions remain separate
entities (and maybe not even them due to the possibility common code
sharing).
  I supose that is why is is generous enough to work for you at a
function level.

More generally, obsessing over compiling warnings is not too good a
thing. The recent debacle whereby Debian bods had removed the random
seeding from openssl, thereby making it generate breakable keys for
the entire universe for several years, was caused by a well-meaning
but ill-considered attempt to quiet a compiler warning. Surely there
are more important issues to be dealt with...

     M

[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