This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Add a __nowarn__ keyword
On Wed, 8 Aug 2007, Kaveh R. GHAZI wrote:
| On Wed, 8 Aug 2007, Gabriel Dos Reis wrote:
|
| > | I am not sure whether this is a good idea since we already have the
| > | #pragma GCC diagnostics. But yes, the pragma does not work (yet) at
| > | the statement level.
| >
| > If I understand DJ correctly, they worked at the function definition level;
| > that is all we need. Kaveh, did that not work?
| > -- Gaby
|
| I tried using the #pragma on an inline CONST_CAST function, it did not
| work for -Wcast-qual warnings. I didn't bother trying to see if it worked
| for any others.
|
| #pragma GCC diagnostic ignored "-Wcast-qual"
| extern __inline void *CONST_CAST(const void *cv)
| {
| return (void *)cv;
| }
|
| % gcc foo.c -Wcast-qual -c
| nw.c: In function 'CONST_CAST':
| nw.c:4: warning: cast discards qualifiers from pointer target type
I believe you have discovered a bug in the compiler :-)
-- Gaby