summaryrefslogtreecommitdiff
path: root/gnuradio-runtime/include/gnuradio/attributes.h
diff options
context:
space:
mode:
authorMichael Dickens <michael.dickens@ettus.com>2020-01-08 10:46:59 -0500
committerMartin Braun <martin.braun@ettus.com>2020-01-08 10:19:19 -0800
commit90c49ef6d4d215f1db01f591d682947fea727655 (patch)
tree9cac6ef2d7eca4057d8a7196ff411ddf1e127928 /gnuradio-runtime/include/gnuradio/attributes.h
parent92cfdf722f5f41169bd2bbbe83f08d43b917bee2 (diff)
runtime: fixup attributes for Clang, GNUC, and MSC
1) put clang before GNUC, to keep their settings separate, because some clang defines GNUC. 2) change from clang to "clang but not MSC", because MSC attributes are covered in a later clause.
Diffstat (limited to 'gnuradio-runtime/include/gnuradio/attributes.h')
-rw-r--r--gnuradio-runtime/include/gnuradio/attributes.h17
1 files changed, 10 insertions, 7 deletions
diff --git a/gnuradio-runtime/include/gnuradio/attributes.h b/gnuradio-runtime/include/gnuradio/attributes.h
index e5b2f98f03..4690dff68d 100644
--- a/gnuradio-runtime/include/gnuradio/attributes.h
+++ b/gnuradio-runtime/include/gnuradio/attributes.h
@@ -25,25 +25,28 @@
////////////////////////////////////////////////////////////////////////
// Cross-platform attribute macros
////////////////////////////////////////////////////////////////////////
-#if defined __GNUC__
+#if defined(__clang__) && (!defined(_MSC_VER))
+// AppleClang also defines __GNUC__, so do this check first. These
+// will probably be the same as for __GNUC__, but let's keep them
+// separate just to be safe.
#define __GR_ATTR_ALIGNED(x) __attribute__((aligned(x)))
#define __GR_ATTR_UNUSED __attribute__((unused))
#define __GR_ATTR_INLINE __attribute__((always_inline))
#define __GR_ATTR_DEPRECATED __attribute__((deprecated))
-#if __GNUC__ >= 4
#define __GR_ATTR_EXPORT __attribute__((visibility("default")))
#define __GR_ATTR_IMPORT __attribute__((visibility("default")))
-#else
-#define __GR_ATTR_EXPORT
-#define __GR_ATTR_IMPORT
-#endif
-#elif defined __clang__
+#elif defined __GNUC__
#define __GR_ATTR_ALIGNED(x) __attribute__((aligned(x)))
#define __GR_ATTR_UNUSED __attribute__((unused))
#define __GR_ATTR_INLINE __attribute__((always_inline))
#define __GR_ATTR_DEPRECATED __attribute__((deprecated))
+#if __GNUC__ >= 4
#define __GR_ATTR_EXPORT __attribute__((visibility("default")))
#define __GR_ATTR_IMPORT __attribute__((visibility("default")))
+#else
+#define __GR_ATTR_EXPORT
+#define __GR_ATTR_IMPORT
+#endif
#elif _MSC_VER
#define __GR_ATTR_ALIGNED(x) __declspec(align(x))
#define __GR_ATTR_UNUSED