From d89ec7629b8cafdc12e619cf5f07ceb5b0279275 Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Tue, 23 Oct 2012 08:36:42 -0400 Subject: [PATCH] Deprecate rculfstack Replaced by "lfstack", which has a less restrictive semantic, and covers rculfstack completely. Signed-off-by: Mathieu Desnoyers --- rculfstack.c | 3 +++ tests/test_urcu_lfs_rcu.c | 4 ++++ urcu/rculfstack.h | 45 ++++++++++++++++++++++++++++++++------- 3 files changed, 44 insertions(+), 8 deletions(-) diff --git a/rculfstack.c b/rculfstack.c index 574ea87..df5c547 100644 --- a/rculfstack.c +++ b/rculfstack.c @@ -20,6 +20,9 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +/* Remove deprecation warnings from LGPL wrapper build. */ +#define CDS_LFS_RCU_DEPRECATED + /* Do not #define _LGPL_SOURCE to ensure we can emit the wrapper symbols */ #undef _LGPL_SOURCE #include "urcu/rculfstack.h" diff --git a/tests/test_urcu_lfs_rcu.c b/tests/test_urcu_lfs_rcu.c index d1e0ee9..c356d1d 100644 --- a/tests/test_urcu_lfs_rcu.c +++ b/tests/test_urcu_lfs_rcu.c @@ -66,6 +66,10 @@ static inline pid_t gettid(void) #define _LGPL_SOURCE #endif #include + +/* Remove deprecation warnings from test build. */ +#define CDS_LFS_RCU_DEPRECATED + #include static volatile int test_go, test_stop; diff --git a/urcu/rculfstack.h b/urcu/rculfstack.h index 93c0bc9..2d1ecce 100644 --- a/urcu/rculfstack.h +++ b/urcu/rculfstack.h @@ -27,6 +27,11 @@ 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."))) +#endif + struct cds_lfs_node_rcu { struct cds_lfs_node_rcu *next; }; @@ -39,16 +44,39 @@ struct cds_lfs_stack_rcu { #include -#define cds_lfs_node_init_rcu _cds_lfs_node_init_rcu -#define cds_lfs_init_rcu _cds_lfs_init_rcu -#define cds_lfs_push_rcu _cds_lfs_push_rcu -#define cds_lfs_pop_rcu _cds_lfs_pop_rcu +static inline CDS_LFS_RCU_DEPRECATED +void cds_lfs_node_init_rcu(struct cds_lfs_node_rcu *node) +{ + _cds_lfs_node_init_rcu(node); +} + +static inline +void cds_lfs_init_rcu(struct cds_lfs_stack_rcu *s) +{ + _cds_lfs_init_rcu(s); +} + +static inline CDS_LFS_RCU_DEPRECATED +int cds_lfs_push_rcu(struct cds_lfs_stack_rcu *s, + struct cds_lfs_node_rcu *node) +{ + return _cds_lfs_push_rcu(s, node); +} + +static inline CDS_LFS_RCU_DEPRECATED +struct cds_lfs_node_rcu *cds_lfs_pop_rcu(struct cds_lfs_stack_rcu *s) +{ + return _cds_lfs_pop_rcu(s); +} #else /* !_LGPL_SOURCE */ -extern void cds_lfs_node_init_rcu(struct cds_lfs_node_rcu *node); -extern void cds_lfs_init_rcu(struct cds_lfs_stack_rcu *s); -extern int cds_lfs_push_rcu(struct cds_lfs_stack_rcu *s, +extern CDS_LFS_RCU_DEPRECATED +void cds_lfs_node_init_rcu(struct cds_lfs_node_rcu *node); +extern CDS_LFS_RCU_DEPRECATED +void cds_lfs_init_rcu(struct cds_lfs_stack_rcu *s); +extern CDS_LFS_RCU_DEPRECATED +int cds_lfs_push_rcu(struct cds_lfs_stack_rcu *s, struct cds_lfs_node_rcu *node); /* @@ -58,7 +86,8 @@ extern int cds_lfs_push_rcu(struct cds_lfs_stack_rcu *s, * node or modifying the cds_lfs_node_rcu structure. * Returns NULL if stack is empty. */ -extern struct cds_lfs_node_rcu *cds_lfs_pop_rcu(struct cds_lfs_stack_rcu *s); +extern CDS_LFS_RCU_DEPRECATED +struct cds_lfs_node_rcu *cds_lfs_pop_rcu(struct cds_lfs_stack_rcu *s); #endif /* !_LGPL_SOURCE */ -- 2.34.1