summaryrefslogtreecommitdiff
path: root/defines.h
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@zip.com.au>2014-05-01 02:24:35 +1000
committerDarren Tucker <dtucker@zip.com.au>2014-05-01 02:24:35 +1000
commitf028460d0b2e5a584355321015cde69bf6fd933e (patch)
treed8e5d436741d71782dedf498317b52ce5888ed70 /defines.h
parentb628cc4c3e4a842bab5e4584d18c2bc5fa4d0edf (diff)
- (dtucker) [defines.h] Define __GNUC_PREREQ__ macro if we don't already
have it. Only attempt to use __attribute__(__bounded__) for gcc.
Diffstat (limited to 'defines.h')
-rw-r--r--defines.h12
1 files changed, 10 insertions, 2 deletions
diff --git a/defines.h b/defines.h
index 41861fbb..928bd9b0 100644
--- a/defines.h
+++ b/defines.h
@@ -25,7 +25,7 @@
#ifndef _DEFINES_H
#define _DEFINES_H
-/* $Id: defines.h,v 1.177 2014/04/20 03:21:23 djm Exp $ */
+/* $Id: defines.h,v 1.178 2014/04/30 16:24:35 dtucker Exp $ */
/* Constants */
@@ -826,9 +826,17 @@ struct winsize {
# define arc4random_stir()
#endif
+/* Macro to test if we're using a specific version of gcc or later. */
+#if defined(__GNUC__) && !defined(__GNUC_PREREQ__)
+#define __GNUC_PREREQ__(ma, mi) \
+ ((__GNUC__ > (ma)) || (__GNUC__ == (ma) && __GNUC_MINOR__ >= (mi)))
+#else
+#define __GNUC_PREREQ__(ma, mi) 0
+#endif
+
/* __bounded macro */
#ifndef __bounded
-# if __GNUC_PREREQ__(3,3) && !defined(__clang__)
+# if defined(__GNUC__) && __GNUC_PREREQ__(3,3) && !defined(__clang__)
# define __bounded(args) __attribute__ ((__bounded__ args ))
# else
# define __bounded(args) /* delete */