On Thu, May 26, 2011 at 12:06:18PM +0200, Matthias Kretz wrote: > suggested solution > ================== > GCC should provide (an) additional predefined macro(s) to distinguish a > patched GCC from vanilla GCC. This/These macro(s) should be sufficient to > uniquely identify every released GCC from each other. This must also include > updates to distribution packages, which could fix or introduce a problem.
We (Fedora/RHEL) already use something like that, in particular #define __GNUC__ 4 #define __GNUC_MINOR__ 6 #define __GNUC_PATCHLEVEL__ 0 #define __GNUC_RH_RELEASE__ 7 means GCC 4.6-RH 4.6.0-7 (like SUSE, we decrease patchlevel version to the last released version if any, so 4.6.0 with non-zero __GNUC_RH_RELEASE__ means based on 4.6 branch after 4.6.0 release (which normally presents itself as 4.6.1 prerelease). We've used it a couple of times e.g. in our glibc headers, so that we could start earlier using backported features like _FORTIFY_SOURCE, warning/error attributes, gnu_inline including C++, __builtin_va_arg_pack etc. Jakub