This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Is it possible for a macro to tell file/namespace scope from other scopes?
On the subject of the difference in behavior in #pragma GCC diagnostic
before 4.6 when they had to be at file/namespace scope, and 4.6 and
later when they could be included at any scope, is there any way to
determine if you are or are not at file/namespace scope in a test from a
preprocessor macro? I'm guessing not, but if there was it could make
for a beautiful solution to using these things, in that you could have
GCC_DIAG_ON/OFF(x) macros that would have appropriate implementations
for appropriate scopes automagically. So, anyone able to dispel my
preconceptions and tell me it's possible?
Patrick