aboutsummaryrefslogtreecommitdiffstats
path: root/include/osmocom/core
diff options
context:
space:
mode:
authorJacob Erlbeck <jerlbeck@sysmocom.de>2013-08-14 18:13:45 +0200
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2013-08-14 18:25:09 +0200
commit3f74d9e76795ef20ee401bbe712dd72733bfa77f (patch)
tree708b6c9c01b3e325496c6fc224b91641e80b7d96 /include/osmocom/core
parent3c761c8d8a3c7c2ebad6b088e3a8ddeec9d690e0 (diff)
core: Support clang with OSME_DEPRECATED
Separate feature checking from implementation. Supported are clang and gcc.
Diffstat (limited to 'include/osmocom/core')
-rw-r--r--include/osmocom/core/defs.h19
1 files changed, 15 insertions, 4 deletions
diff --git a/include/osmocom/core/defs.h b/include/osmocom/core/defs.h
index e3afbff2..917a8c3a 100644
--- a/include/osmocom/core/defs.h
+++ b/include/osmocom/core/defs.h
@@ -26,14 +26,25 @@
/*! \brief Set the deprecated attribute with a message.
*/
-#if ! defined(__GNUC__)
-# define OSMO_DEPRECATED(text)
-#elif OSMO_GNUC_PREREQ(4,5)
+#if defined(__clang__)
+# define _OSMO_HAS_ATTRIBUTE_DEPRECATED __has_attribute(deprecated)
+# define _OSMO_HAS_ATTRIBUTE_DEPRECATED_WITH_MESSAGE __has_extension(attribute_deprecated_with_message)
+#elif defined(__GNUC__)
+# define _OSMO_HAS_ATTRIBUTE_DEPRECATED 1
+# define _OSMO_HAS_ATTRIBUTE_DEPRECATED_WITH_MESSAGE OSMO_GNUC_PREREQ(4,5)
+#endif
+
+#if defined(_OSMO_HAS_ATTRIBUTE_DEPRECATED_WITH_MESSAGE)
# define OSMO_DEPRECATED(text) __attribute__((__deprecated__(text)))
-#else
+#elif defined(_OSMO_HAS_ATTRIBUTE_DEPRECATED)
# define OSMO_DEPRECATED(text) __attribute__((__deprecated__))
+#else
+# define OSMO_DEPRECATED(text)
#endif
+#undef _OSMO_HAS_ATTRIBUTE_DEPRECATED_WITH_MESSAGE
+#undef _OSMO_HAS_ATTRIBUTE_DEPRECATED
+
/*! @} */
#endif