+ __GNUC_PATCHLEVEL__)
#endif
+#ifndef __cplusplus
+#define caa_c_transparent_union __attribute__((__transparent_union__))
+#else
+#define caa_c_transparent_union
+#endif
+
#endif /* _URCU_COMPILER_H */
#include <stdbool.h>
#include <pthread.h>
+#include <urcu/compiler.h>
/*
* Lock-free stack.
* The transparent union allows calling functions that work on both
* struct cds_lfs_stack and struct __cds_lfs_stack on any of those two
* types.
+ *
+ * Avoid complaints from clang++ not knowing this attribute.
*/
typedef union {
struct __cds_lfs_stack *_s;
struct cds_lfs_stack *s;
-} __attribute__((__transparent_union__)) cds_lfs_stack_ptr_t;
+} caa_c_transparent_union cds_lfs_stack_ptr_t;
#ifdef _LGPL_SOURCE
_cds_lfs_pop_blocking(struct cds_lfs_stack *s)
{
struct cds_lfs_node *retnode;
+ cds_lfs_stack_ptr_t stack;
_cds_lfs_pop_lock(s);
- retnode = ___cds_lfs_pop(s);
+ stack.s = s;
+ retnode = ___cds_lfs_pop(stack);
_cds_lfs_pop_unlock(s);
return retnode;
}
_cds_lfs_pop_all_blocking(struct cds_lfs_stack *s)
{
struct cds_lfs_head *rethead;
+ cds_lfs_stack_ptr_t stack;
_cds_lfs_pop_lock(s);
- rethead = ___cds_lfs_pop_all(s);
+ stack.s = s;
+ rethead = ___cds_lfs_pop_all(stack);
_cds_lfs_pop_unlock(s);
return rethead;
}
{
struct cds_lfq_node_rcu_dummy *dummy;
- dummy = malloc(sizeof(struct cds_lfq_node_rcu_dummy));
+ dummy = (struct cds_lfq_node_rcu_dummy *)
+ malloc(sizeof(struct cds_lfq_node_rcu_dummy));
urcu_posix_assert(dummy);
dummy->parent.next = next;
dummy->parent.dummy = 1;
extern "C" {
#endif
-#define CDS_WFS_END ((void *) 0x1UL)
+#define CDS_WFS_END ((struct cds_wfs_head *) 0x1UL)
#define CDS_WFS_ADAPT_ATTEMPTS 10 /* Retry if being set */
#define CDS_WFS_WAIT 10 /* Wait 10 ms if being set */
_cds_wfs_pop_with_state_blocking(struct cds_wfs_stack *s, int *state)
{
struct cds_wfs_node *retnode;
+ cds_wfs_stack_ptr_t stack;
_cds_wfs_pop_lock(s);
- retnode = ___cds_wfs_pop_with_state_blocking(s, state);
+ stack.s = s;
+ retnode = ___cds_wfs_pop_with_state_blocking(stack, state);
_cds_wfs_pop_unlock(s);
return retnode;
}
_cds_wfs_pop_all_blocking(struct cds_wfs_stack *s)
{
struct cds_wfs_head *rethead;
+ cds_wfs_stack_ptr_t stack;
_cds_wfs_pop_lock(s);
- rethead = ___cds_wfs_pop_all(s);
+ stack.s = s;
+ rethead = ___cds_wfs_pop_all(stack);
_cds_wfs_pop_unlock(s);
return rethead;
}
* synchronization.
*/
-#define CDS_WFS_WOULDBLOCK ((void *) -1UL)
+#define CDS_WFS_WOULDBLOCK ((struct cds_wfs_node *) -1UL)
enum cds_wfs_state {
CDS_WFS_STATE_LAST = (1U << 0),
* The transparent union allows calling functions that work on both
* struct cds_wfs_stack and struct __cds_wfs_stack on any of those two
* types.
+ *
+ * Avoid complaints from clang++ not knowing this attribute.
*/
typedef union {
struct __cds_wfs_stack *_s;
struct cds_wfs_stack *s;
-} __attribute__((__transparent_union__)) cds_wfs_stack_ptr_t;
+} caa_c_transparent_union cds_wfs_stack_ptr_t;
#ifdef _LGPL_SOURCE
test_urcu_multiflavor_single_unit \
test_urcu_multiflavor_single_unit_cxx \
test_urcu_multiflavor_single_unit_dynlink \
- test_urcu_multiflavor_single_unit_dynlink_cxx
+ test_urcu_multiflavor_single_unit_dynlink_cxx \
+ test_build \
+ test_build_cxx \
+ test_build_dynlink \
+ test_build_dynlink_cxx
TESTS = $(noinst_PROGRAMS)
test_urcu_multiflavor_single_unit_dynlink_cxx_LDADD = $(URCU_LIB) $(URCU_MB_LIB) \
$(URCU_SIGNAL_LIB) $(URCU_QSBR_LIB) $(URCU_BP_LIB) $(TAP_LIB)
+test_build_SOURCES = \
+ test_build.c
+test_build_LDADD = $(URCU_COMMON_LIB) $(TAP_LIB)
+
+test_build_cxx_SOURCES = \
+ test_build_cxx.cpp
+test_build_cxx_LDADD = $(URCU_COMMON_LIB) $(TAP_LIB)
+
+test_build_dynlink_SOURCES = \
+ test_build.c
+test_build_dynlink_CFLAGS = -DDYNAMIC_LINK_TEST $(AM_CFLAGS)
+test_build_dynlink_LDADD = $(URCU_COMMON_LIB) $(TAP_LIB)
+
+test_build_dynlink_cxx_SOURCES = \
+ test_build_cxx.cpp
+test_build_dynlink_cxx_CXXFLAGS = -DDYNAMIC_LINK_TEST $(AM_CXXFLAGS)
+test_build_dynlink_cxx_LDADD = $(URCU_COMMON_LIB) $(TAP_LIB)
+
all-local:
@if [ x"$(srcdir)" != x"$(builddir)" ]; then \
for script in $(SCRIPT_LIST); do \
--- /dev/null
+/*
+ * Copyright 2021 Simon Marchi <simon.marchi@efficios.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+/*
+ * This file is meant to verify that headers are compatible with both C and
+ * C++. It includes all exported headers and is compiled as C and C++ source.
+ */
+
+#ifndef DYNAMIC_LINK_TEST
+# define _LGPL_SOURCE
+#endif
+
+#include <urcu/arch.h>
+#include <urcu/call-rcu.h>
+#include <urcu/cds.h>
+#include <urcu/compiler.h>
+#include <urcu/debug.h>
+#include <urcu/defer.h>
+#include <urcu/flavor.h>
+#include <urcu/futex.h>
+#include <urcu/hlist.h>
+#include <urcu/lfstack.h>
+#include <urcu/list.h>
+#include <urcu/pointer.h>
+#include <urcu/rcuhlist.h>
+#include <urcu/rculfhash.h>
+#include <urcu/rculfqueue.h>
+#include <urcu/rculfstack.h>
+#include <urcu/rculist.h>
+#include <urcu/ref.h>
+#include <urcu/syscall-compat.h>
+#include <urcu/system.h>
+#include <urcu/tls-compat.h>
+#include <urcu/uatomic.h>
+#include <urcu/urcu-bp.h>
+#include <urcu/urcu.h>
+#include <urcu/urcu-mb.h>
+#include <urcu/urcu-memb.h>
+#include <urcu/urcu-qsbr.h>
+#include <urcu/urcu-signal.h>
+#include <urcu/wfcqueue.h>
+#include <urcu/wfqueue.h>
+#include <urcu/wfstack.h>
+
+#include "tap.h"
+
+int main(void)
+{
+ /* Need at least 1 test to make a valid TAP test plan. */
+ plan_tests(1);
+ ok(1, "dummy");
+
+ return exit_status();
+}
--- /dev/null
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+
+#include "test_build.c"