From 706d1165eaa3e58503be043f2545ee697443f5ca Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Tue, 23 Oct 2012 11:40:37 -0400 Subject: [PATCH] deprecation: fix build with gcc < 4.5 Signed-off-by: Mathieu Desnoyers --- urcu/compiler.h | 10 ++++++++++ urcu/rculfstack.h | 4 +++- urcu/wfqueue.h | 2 +- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/urcu/compiler.h b/urcu/compiler.h index cd4a49d..318ca65 100644 --- a/urcu/compiler.h +++ b/urcu/compiler.h @@ -91,4 +91,14 @@ #define caa_cast_long_keep_sign(v) \ (caa_is_signed_type(__typeof__(v)) ? (long) (v) : (unsigned long) (v)) +#if defined (__GNUC__) \ + && ((__GNUC_MAJOR__ == 4) && (__GNUC_MINOR__ >= 5) \ + || __GNUC_MAJOR__ >= 5) +#define CDS_DEPRECATED(msg) \ + __attribute__((deprecated(msg))) +#else +#define CDS_DEPRECATED(msg) \ + __attribute__((deprecated)) +#endif + #endif /* _URCU_COMPILER_H */ diff --git a/urcu/rculfstack.h b/urcu/rculfstack.h index 2d1ecce..c7e5599 100644 --- a/urcu/rculfstack.h +++ b/urcu/rculfstack.h @@ -23,13 +23,15 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include + #ifdef __cplusplus extern "C" { #endif #ifndef CDS_LFS_RCU_DEPRECATED #define CDS_LFS_RCU_DEPRECATED \ - __attribute__((deprecated("urcu/rculfstack.h is deprecated. Please use urcu/lfstack.h instead."))) + CDS_DEPRECATED("urcu/rculfstack.h is deprecated. Please use urcu/lfstack.h instead.") #endif struct cds_lfs_node_rcu { diff --git a/urcu/wfqueue.h b/urcu/wfqueue.h index 342ee48..4cd4b13 100644 --- a/urcu/wfqueue.h +++ b/urcu/wfqueue.h @@ -33,7 +33,7 @@ extern "C" { #ifndef CDS_WFQ_DEPRECATED #define CDS_WFQ_DEPRECATED \ - __attribute__((deprecated("urcu/wfqueue.h is deprecated. Please use urcu/wfcqueue.h instead."))) + CDS_DEPRECATED("urcu/wfqueue.h is deprecated. Please use urcu/wfcqueue.h instead.") #endif /* -- 2.34.1