I keep getting this warning from a third-party library (which I don't want to debug), so I'd really appreciate a way to suppress this specific warning. Google failed me, so here I am.
views:
307answers:
2
+1
A:
G'day,
Won't
-Wno-enum-promotion
get rid of that warning?
HTH
cheers,
Rob Wells
2009-06-19 14:35:18
Nope. In fact, gcc doesn't even seem to recognize this option. Where did you find out about this option? It's not listed on http://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html
Sasa
2009-06-20 00:51:13
A:
Well, since I couldn't find a way to disable this specific warning, I resorted to using gcc's #pragma system_header. Basically, I wrapped the problematic header like this:
#if defined __GNUC__ #pragma GCC system_header #elif defined __SUNPRO_CC #pragma disable_warn #elif defined _MSC_VER #pragma warning(push, 1) #endif #include "foo.h" #if defined __SUNPRO_CC #pragma enable_warn #elif defined _MSC_VER #pragma warning(pop) #endif
where foo.h was the problematic header. Now I just include this fooWrapper.h and the problem goes away. Note that this should work for some other compilers too (MSC and SUNPRO), but I didn't test it.
Sasa
2009-06-20 09:15:20