I'm trying to write a macro similar to the following:
#ifndef DEPRECATED_ATTRIBUTE_MESSAGE
#define DEPRECATED_ATTRIBUTE_MESSAGE(message) __attribute__((deprecated (message)))
#endif
And this works, but only with the Apple LLVM 3.0 compiler. It breaks at compile time for anything else meaning I have to strip it down to
#ifndef DEPRECATED_ATTRIBUTE_MESSAGE
#define DEPRECATED_ATTRIBUTE_MESSAGE(message) __attribute__((deprecated))
#endif
which is much less useful.
My question:
I think the solution is to apply some macro to identify the version of the compiler at compile time. Is there a way to identify the Apple LLVM 3.0 compiler versus LLVM GCC 4.2 or GCC 4.2 (or anything else)?
Ideally, I'd like to work out something like this, but I can't find the right macro to figure it out:
#ifdef [Apple LLVM 3.0]
#ifndef DEPRECATED_ATTRIBUTE_MESSAGE
#define DEPRECATED_ATTRIBUTE_MESSAGE(message) __attribute__((deprecated (message)))
#endif
#else
#ifndef DEPRECATED_ATTRIBUTE_MESSAGE
#define DEPRECATED_ATTRIBUTE_MESSAGE(message) __attribute__((deprecated))
#endif
#endif