This piece of code:
Int32 status;
printf("status : %x", status)
gives me the following warning:
jpegthread.c:157: warning: format '%x' expects type 'unsigned int', but argument 3 has type 'Int32'
I know I can get rid of it by casting the type, but is it possible with a GCC compiler flag to get rid of that particular type of warning, and still use -Wall
?
I presume you are looking for the
Equivalent in GCC....
You can search for options such as -Wno-conversion -Wno-format-security that do the job here
http://gcc.gnu.org/onlinedocs/gcc-4.0.0/gcc/Warning-Options.html
But in terms of the #pragma directive:
I Quote from the GCC mailing list from Google:
So currently no, there is no #pragma directive to disable specific warnings. Rather than using -Wall you could turn on as many warnings as you can minus specific ones.
http://www.network-theory.co.uk/docs/gccintro/gccintro_31.html
or fix the code
I used the following CFLAGS :
It looks like the GCC manual does provide a way to do this with a #pragma, actually. (contrary to what Aiden Bell says in another answer here)
http://gcc.gnu.org/onlinedocs/gcc/Diagnostic-Pragmas.html
e.g. for the -Wuninitialized warning, you can do...
... to suppress the warning, or...
... to treat it as a warning (not an error) even if you're building with -Werror.
If you need that code to work portable then you should cast the argument to unsigned int, as the int type may have a different size than Int32 on some platforms.
To answer your question about disabling specific warnings in gcc, you can enable specific warnings in gcc with -Wxxxx and disable them with -Wno-xxxx.
From the GCC Warning Options:
For your case the warning in question is
-Wformat