Possible Duplicate:
Selectively disable GCC warnings for only part of a translation unit?
How to enable a specific gcc warnings for a specific directory or file ?
I want to enable -Wsign-conversion for my own files not for any other system headers
This line should do it: (see here)
#pragma GCC diagnostic warning "-Wsign-conversion"
Put it in the affected files or in a header that is included in all you files
If you want to do it outside of your source file, then you need to reference your build system. E.g. in make you can always specify a direct target in the Makefile:
foo.o: foo.c
$(CC) -o $> -Wsign-conversion $<
This will take precedence to a general .c->.o
rule as it is more more specific.
Other build systems have other methods of achieving the same rule.
In short, your question is really about your build system, and not about gcc.
精彩评论