99ddbcdd2ac4b9dfa3f84a563e5fa3eb90c0cdea
1 // SPDX-FileCopyrightText: 2021 Simon Marchi <simon.marchi@efficios.com>
3 // SPDX-License-Identifier: GPL-2.0-or-later
6 * This file is meant to verify that headers are compatible with both C and
7 * C++. It includes all exported headers and is compiled as C and C++ source.
10 #ifndef DYNAMIC_LINK_TEST
14 #include <urcu/arch.h>
15 #include <urcu/call-rcu.h>
17 #include <urcu/compiler.h>
18 #include <urcu/debug.h>
19 #include <urcu/defer.h>
20 #include <urcu/flavor.h>
21 #include <urcu/futex.h>
22 #include <urcu/hlist.h>
23 #include <urcu/lfstack.h>
24 #include <urcu/list.h>
25 #include <urcu/pointer.h>
26 #include <urcu/rcuhlist.h>
27 #include <urcu/rculfhash.h>
28 #include <urcu/rculfqueue.h>
29 #include <urcu/rculfstack.h>
30 #include <urcu/rculist.h>
32 #include <urcu/syscall-compat.h>
33 #include <urcu/system.h>
34 #include <urcu/tls-compat.h>
35 #include <urcu/uatomic.h>
36 #include <urcu/urcu-bp.h>
37 #include <urcu/urcu.h>
38 #include <urcu/urcu-mb.h>
39 #include <urcu/urcu-memb.h>
40 #include <urcu/urcu-qsbr.h>
41 #include <urcu/wfcqueue.h>
42 #include <urcu/wfqueue.h>
43 #include <urcu/wfstack.h>
47 struct my_tls_struct
{
53 static DEFINE_URCU_TLS(int, my_tls_int
);
54 static DEFINE_URCU_TLS(struct my_tls_struct
, my_tls_struct
);
56 static void test_lfstack(void)
58 struct cds_lfs_stack s
;
61 ok(cds_lfs_empty(&s
), "cds_lfs_empty");
64 static void test_wfstack(void)
66 struct cds_wfs_stack s
;
69 ok(cds_wfs_empty(&s
), "cds_lfs_empty");
72 static void test_wfcqueue(void)
74 struct cds_wfcq_head head
;
75 struct cds_wfcq_tail tail
;
77 cds_wfcq_init(&head
, &tail
);
78 ok(cds_wfcq_empty(&head
, &tail
), "cds_wfcq_empty");
82 void test_build_cds_list_head_init(void)
84 /* Test that the CDS_LIST_HEAD_INIT macro builds correctly. */
85 struct struct_with_list
{
86 struct cds_list_head head
;
89 struct struct_with_list list
= {
90 .head
= CDS_LIST_HEAD_INIT(list
.head
),
95 void test_urcu_tls(void)
97 URCU_TLS(my_tls_int
) = 1;
98 URCU_TLS(my_tls_struct
).int1
= 1;
99 URCU_TLS(my_tls_struct
).char1
= 'a';
100 URCU_TLS(my_tls_struct
).void1
= NULL
;
103 struct an_opaque_struct
;
104 struct a_clear_struct
110 void test_build_rcu_dereference(void)
112 static struct an_opaque_struct
*opaque
= NULL
;
113 static struct an_opaque_struct
*const opaque_const
= NULL
;
114 static struct a_clear_struct
*clear
= NULL
;
115 static struct a_clear_struct
*const clear_const
= NULL
;
117 (void) rcu_dereference(opaque
);
118 (void) rcu_dereference(opaque_const
);
119 (void) rcu_dereference(clear
);
120 (void) rcu_dereference(clear_const
);
130 test_build_cds_list_head_init();
132 test_build_rcu_dereference();
134 return exit_status();
This page took 0.034435 seconds and 5 git commands to generate.