views:

307

answers:

2

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.

+1  A: 

G'day,

Won't

-Wno-enum-promotion

get rid of that warning?

HTH

cheers,

Rob Wells
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
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