c++ - How to disable a particular unknown #pragma warning? (GCC and/or clang) -


i know how disable all unknown #pragma warnings. answer given, example, here: so: how disable #pragma warnings?

my question - there way disable 'unknown pragma' warning 1 particular pragma? example, if disable warning #pragma ugubugu following code:

#pragma ugubugu #pragma untiunti    int main() {return 0;} 

when compiled either:

g++ pragma.cpp -wall clang++ pragma.cpp -wall 

should produce single warning:

warning: ignoring #pragma untiunti 

maybe, example, there simple way register custom pragma nothing?

would great know if there such option visual studio too, less important.

thank you!


"but why he's playing custom pragmas?"

my source parsed 2 compilers. in 1 of those, there special #pragma, unknown other. of course, put #ifdef compiler_identification_macro ... #endif around every instance of #pragma cumbersome.

i'm reasonably sure there isn't way this.

both gcc , clang have internal interfaces allow language frontend register #pragma handlers preprocessor - see gcc's libcpp/directives.c , clang's lib/lex/pragma.cpp - but, far can see, there nothing lets modify handlers registered (beyond implied language variant you're compiling for) based on command line options.

i know how disable all unknown #pragma warnings. answer given, example, here: so: how disable #pragma warnings?

note highest voted answer better accepted 1 there. -wno-unknown-pragmas can added on command line after (like -wall) turns warning on.

my source parsed 2 compilers. in 1 of those, there special #pragma, unknown other. of course, put #ifdef compiler_identification_macro ... #endif around every instance of #pragma cumbersome.

from more philisophical viewpoint, think right solution, cumbersome though may be!

it seems correct me hide #pragma compiler not expected understand in way intend, given whole point of #pragma provide mechanism invoking implementation-defined behaviour in compiler.

(if end doing this, note clang defines __clang__, both gcc , clang define __gnuc__.)


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -