Nick,
I don't think it is as nefarious as you think.
I think you have stumbled on a legitimate compiler bug or at least something that
needs clarification in the gcc documentation.
I was unaware of the pragmas to alter the diagnostic messages (I seldom use pragmas as they are so unportable)
However, if this worked it would be exactly what the OP was looking for.
According to the gcc documentation:
http://gcc.gnu.org/onlinedocs/gcc/Diagnostic-Pragmas.html#Diagnostic-PragmasThe pragmas are supposed to override any command line options. (from the current documentation):
Note that these pragmas override any command-line options.
In this case, the offending commandline option is "-w" (set by the Arduino IDE) which disables all warnings.
See documentation:
http://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html
What wasn't clear in the gcc documentation is that "-w" cannot be overridden by the pragmas.
While I believe that the overriding of -w with pragmas could be argued either way,
(personally I think pragmas should be allowed to override -w)
the way it currently works (you can't override it with a #pragma),
definitely could use a comment about this in the section about the diagnostic pragmas
indicating that no warnings can be enabled if the -w command line option was used
to disable all warnings.
Note: The pragma does work if the -w command line option is not used.
(at least in avr-gcc version 4.3.4 which is what I'm using on linux)
Windows may be running an older version and if so, the pragmas may not be supported.
But unfortunately, currently the only way to get rid of the -w command line option
being passed to gcc from the IDE is to patch the java code and rebuild the IDE.
What would be nice is if the Arduino guys would update the IDE to allow overriding the commandline options.
As an alternative they could remove the -w option from the compiler commandline
and use a pragma to disable warnings in WProgram.h
That way users that want/need to see warnings could turn them back on by simply inserting
a pragma in their code.
It would be the best of all worlds. Naive users never get warnings and more advanced users
could easily turn them back on.
--- bill