[PATCH] core: Remove defined() check for OSMO_DEPRECATE

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/OpenBSC@lists.osmocom.org/.

Jacob Erlbeck jerlbeck at sysmocom.de
Thu Aug 15 08:38:05 UTC 2013


This reverts commit bf991bc0f3006eddf45d494ee7e476a75dbaf36e and
fixes the bug instead. It's just sufficient to remove the defined()
test, since identifiers that aren't macros are just considered as
0 when used with #if. (see cpp info page, section 4.2.2 'If'
in cpp-4.6.info)
---
 include/osmocom/core/defs.h |   16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)

diff --git a/include/osmocom/core/defs.h b/include/osmocom/core/defs.h
index ca12a80..5ffee04 100644
--- a/include/osmocom/core/defs.h
+++ b/include/osmocom/core/defs.h
@@ -27,22 +27,16 @@
 /*! \brief Set the deprecated attribute with a message.
  */
 #if defined(__clang__)
-# if __has_attribute(deprecated)
-#   define _OSMO_HAS_ATTRIBUTE_DEPRECATED 1
-# endif
-# if __has_extension(attribute_deprecated_with_message)
-#   define _OSMO_HAS_ATTRIBUTE_DEPRECATED_WITH_MESSAGE 1
-# endif
+# 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
-# if OSMO_GNUC_PREREQ(4,5)
-#   define _OSMO_HAS_ATTRIBUTE_DEPRECATED_WITH_MESSAGE 1
-# endif
+# define _OSMO_HAS_ATTRIBUTE_DEPRECATED_WITH_MESSAGE OSMO_GNUC_PREREQ(4,5)
 #endif
 
-#if defined(_OSMO_HAS_ATTRIBUTE_DEPRECATED_WITH_MESSAGE)
+#if _OSMO_HAS_ATTRIBUTE_DEPRECATED_WITH_MESSAGE
 # define OSMO_DEPRECATED(text)  __attribute__((__deprecated__(text)))
-#elif defined(_OSMO_HAS_ATTRIBUTE_DEPRECATED)
+#elif _OSMO_HAS_ATTRIBUTE_DEPRECATED
 # define OSMO_DEPRECATED(text)  __attribute__((__deprecated__))
 #else
 # define OSMO_DEPRECATED(text)
-- 
1.7.9.5





More information about the OpenBSC mailing list