diff options
author | David Schleef <ds@schleef.org> | 2001-05-25 23:22:25 +0000 |
---|---|---|
committer | David Schleef <ds@schleef.org> | 2001-05-25 23:22:25 +0000 |
commit | 6395e85878894f3c0ad8a05b3aec66e514591959 (patch) | |
tree | 3a279d3aa7e8ad4776a4956cf045d78d996dd9e7 /include | |
parent | 6072c7f7eabbf6b6f81aa1ee339f4966d0dd9235 (diff) |
added __GNUC_PREREQ() macro
Diffstat (limited to 'include')
-rw-r--r-- | include/features.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/include/features.h b/include/features.h index 880cd36ef..54330dae9 100644 --- a/include/features.h +++ b/include/features.h @@ -26,6 +26,20 @@ #define __attribute(foo) /* Ignore */ #endif +/* Convenience macro to test the version of gcc. + * Use it like this: + * #if __GNUC_PREREQ (2,8) + * ... code requiring gcc 2.8 or later ... + * #endif + * Note - they won't work for gcc1, since the _MINOR macros + * were not defined then. */ +#if defined __GNUC__ && defined __GNUC_MINOR__ +#define __GNUC_PREREQ(maj, min) \ + ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min)) +#else +#define __GNUC_PREREQ(maj,min) 0 +#endif + /* __restrict is known in EGCS 1.2 and above. */ #if !defined __GNUC__ || __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 92) # define __restrict /* Ignore */ |