Bump to m4 1.4.19
[platform/upstream/m4.git] / tests / test-pthread-c++.cc
1 /* Test of <pthread.h> substitute in C++ mode.
2    Copyright (C) 2019-2021 Free Software Foundation, Inc.
3
4    This program is free software: you can redistribute it and/or modify
5    it under the terms of the GNU General Public License as published by
6    the Free Software Foundation; either version 3 of the License, or
7    (at your option) any later version.
8
9    This program is distributed in the hope that it will be useful,
10    but WITHOUT ANY WARRANTY; without even the implied warranty of
11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12    GNU General Public License for more details.
13
14    You should have received a copy of the GNU General Public License
15    along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
16
17 /* Written by Bruno Haible <bruno@clisp.org>, 2019.  */
18
19 #define GNULIB_NAMESPACE gnulib
20 #include <config.h>
21
22 #include <pthread.h>
23
24 #include "signature.h"
25
26
27 /* =========== Thread functions =========== */
28
29 #if GNULIB_TEST_PTHREAD_THREAD
30 SIGNATURE_CHECK (GNULIB_NAMESPACE::pthread_create, int,
31                  (pthread_t *, const pthread_attr_t *,
32                   void * (*) (void*), void *));
33 #endif
34
35 #if GNULIB_TEST_PTHREAD_THREAD
36 SIGNATURE_CHECK (GNULIB_NAMESPACE::pthread_attr_init, int, (pthread_attr_t *));
37 #endif
38
39 #if GNULIB_TEST_PTHREAD_THREAD
40 SIGNATURE_CHECK (GNULIB_NAMESPACE::pthread_attr_getdetachstate, int,
41                  (const pthread_attr_t *, int *));
42 #endif
43
44 #if GNULIB_TEST_PTHREAD_THREAD
45 SIGNATURE_CHECK (GNULIB_NAMESPACE::pthread_attr_setdetachstate, int,
46                  (pthread_attr_t *, int));
47 #endif
48
49 #if GNULIB_TEST_PTHREAD_THREAD
50 SIGNATURE_CHECK (GNULIB_NAMESPACE::pthread_attr_destroy, int,
51                  (pthread_attr_t *));
52 #endif
53
54 #if GNULIB_TEST_PTHREAD_THREAD
55 SIGNATURE_CHECK (GNULIB_NAMESPACE::pthread_self, pthread_t, (void));
56 #endif
57
58 #if GNULIB_TEST_PTHREAD_THREAD
59 SIGNATURE_CHECK (GNULIB_NAMESPACE::pthread_equal, int, (pthread_t, pthread_t));
60 #endif
61
62 #if GNULIB_TEST_PTHREAD_THREAD
63 SIGNATURE_CHECK (GNULIB_NAMESPACE::pthread_detach, int, (pthread_t));
64 #endif
65
66 #if GNULIB_TEST_PTHREAD_THREAD
67 SIGNATURE_CHECK (GNULIB_NAMESPACE::pthread_join, int, (pthread_t, void **));
68 #endif
69
70 #if GNULIB_TEST_PTHREAD_THREAD
71 SIGNATURE_CHECK (GNULIB_NAMESPACE::pthread_exit, void, (void *));
72 #endif
73
74 /* =========== Once-only control (initialization) functions =========== */
75
76 #if GNULIB_TEST_PTHREAD_ONCE
77 SIGNATURE_CHECK (GNULIB_NAMESPACE::pthread_once, int,
78                  (pthread_once_t *, void (*) (void)));
79 #endif
80
81 /* =========== Mutex functions =========== */
82
83 #if GNULIB_TEST_PTHREAD_MUTEX
84 SIGNATURE_CHECK (GNULIB_NAMESPACE::pthread_mutex_init, int,
85                  (pthread_mutex_t *, const pthread_mutexattr_t *));
86 #endif
87
88 #if GNULIB_TEST_PTHREAD_MUTEX
89 SIGNATURE_CHECK (GNULIB_NAMESPACE::pthread_mutexattr_init, int,
90                  (pthread_mutexattr_t *));
91 #endif
92
93 #if GNULIB_TEST_PTHREAD_MUTEX
94 SIGNATURE_CHECK (GNULIB_NAMESPACE::pthread_mutexattr_gettype, int,
95                  (const pthread_mutexattr_t *, int *));
96 #endif
97
98 #if GNULIB_TEST_PTHREAD_MUTEX
99 SIGNATURE_CHECK (GNULIB_NAMESPACE::pthread_mutexattr_settype, int,
100                  (pthread_mutexattr_t *, int));
101 #endif
102
103 #if GNULIB_TEST_PTHREAD_MUTEX
104 SIGNATURE_CHECK (GNULIB_NAMESPACE::pthread_mutexattr_getrobust, int,
105                  (const pthread_mutexattr_t *, int *));
106 #endif
107
108 #if GNULIB_TEST_PTHREAD_MUTEX
109 SIGNATURE_CHECK (GNULIB_NAMESPACE::pthread_mutexattr_setrobust, int,
110                  (pthread_mutexattr_t *, int));
111 #endif
112
113 #if GNULIB_TEST_PTHREAD_MUTEX
114 SIGNATURE_CHECK (GNULIB_NAMESPACE::pthread_mutexattr_destroy, int,
115                  (pthread_mutexattr_t *));
116 #endif
117
118 #if GNULIB_TEST_PTHREAD_MUTEX
119 SIGNATURE_CHECK (GNULIB_NAMESPACE::pthread_mutex_lock, int,
120                  (pthread_mutex_t *));
121 #endif
122
123 #if GNULIB_TEST_PTHREAD_MUTEX
124 SIGNATURE_CHECK (GNULIB_NAMESPACE::pthread_mutex_trylock, int,
125                  (pthread_mutex_t *));
126 #endif
127
128 #if GNULIB_TEST_PTHREAD_MUTEX_TIMEDLOCK
129 SIGNATURE_CHECK (GNULIB_NAMESPACE::pthread_mutex_timedlock, int,
130                  (pthread_mutex_t *, const struct timespec *));
131 #endif
132
133 #if GNULIB_TEST_PTHREAD_MUTEX
134 SIGNATURE_CHECK (GNULIB_NAMESPACE::pthread_mutex_unlock, int,
135                  (pthread_mutex_t *));
136 #endif
137
138 #if GNULIB_TEST_PTHREAD_MUTEX
139 SIGNATURE_CHECK (GNULIB_NAMESPACE::pthread_mutex_destroy, int,
140                  (pthread_mutex_t *));
141 #endif
142
143 /* =========== Read-write lock functions =========== */
144
145 #if GNULIB_TEST_PTHREAD_RWLOCK
146 SIGNATURE_CHECK (GNULIB_NAMESPACE::pthread_rwlock_init, int,
147                  (pthread_rwlock_t *, const pthread_rwlockattr_t *));
148 #endif
149
150 #if GNULIB_TEST_PTHREAD_RWLOCK
151 SIGNATURE_CHECK (GNULIB_NAMESPACE::pthread_rwlockattr_init, int,
152                  (pthread_rwlockattr_t *));
153 #endif
154
155 #if GNULIB_TEST_PTHREAD_RWLOCK
156 SIGNATURE_CHECK (GNULIB_NAMESPACE::pthread_rwlockattr_destroy, int,
157                  (pthread_rwlockattr_t *));
158 #endif
159
160 #if GNULIB_TEST_PTHREAD_RWLOCK
161 SIGNATURE_CHECK (GNULIB_NAMESPACE::pthread_rwlock_rdlock, int,
162                  (pthread_rwlock_t *));
163 #endif
164
165 #if GNULIB_TEST_PTHREAD_RWLOCK
166 SIGNATURE_CHECK (GNULIB_NAMESPACE::pthread_rwlock_wrlock, int,
167                  (pthread_rwlock_t *));
168 #endif
169
170 #if GNULIB_TEST_PTHREAD_RWLOCK
171 SIGNATURE_CHECK (GNULIB_NAMESPACE::pthread_rwlock_tryrdlock, int,
172                  (pthread_rwlock_t *));
173 #endif
174
175 #if GNULIB_TEST_PTHREAD_RWLOCK
176 SIGNATURE_CHECK (GNULIB_NAMESPACE::pthread_rwlock_trywrlock, int,
177                  (pthread_rwlock_t *));
178 #endif
179
180 #if GNULIB_TEST_PTHREAD_RWLOCK
181 SIGNATURE_CHECK (GNULIB_NAMESPACE::pthread_rwlock_timedrdlock, int,
182                  (pthread_rwlock_t *, const struct timespec *));
183 #endif
184
185 #if GNULIB_TEST_PTHREAD_RWLOCK
186 SIGNATURE_CHECK (GNULIB_NAMESPACE::pthread_rwlock_timedwrlock, int,
187                  (pthread_rwlock_t *, const struct timespec *));
188 #endif
189
190 #if GNULIB_TEST_PTHREAD_RWLOCK
191 SIGNATURE_CHECK (GNULIB_NAMESPACE::pthread_rwlock_unlock, int,
192                  (pthread_rwlock_t *));
193 #endif
194
195 #if GNULIB_TEST_PTHREAD_RWLOCK
196 SIGNATURE_CHECK (GNULIB_NAMESPACE::pthread_rwlock_destroy, int,
197                  (pthread_rwlock_t *));
198 #endif
199
200 /* =========== Condition variable functions =========== */
201
202 #if GNULIB_TEST_PTHREAD_COND
203 SIGNATURE_CHECK (GNULIB_NAMESPACE::pthread_cond_init, int,
204                  (pthread_cond_t *, const pthread_condattr_t *));
205 #endif
206
207 #if GNULIB_TEST_PTHREAD_COND
208 SIGNATURE_CHECK (GNULIB_NAMESPACE::pthread_condattr_init, int,
209                  (pthread_condattr_t *));
210 #endif
211
212 #if GNULIB_TEST_PTHREAD_COND
213 SIGNATURE_CHECK (GNULIB_NAMESPACE::pthread_condattr_destroy, int,
214                  (pthread_condattr_t *));
215 #endif
216
217 #if GNULIB_TEST_PTHREAD_COND
218 SIGNATURE_CHECK (GNULIB_NAMESPACE::pthread_cond_wait, int,
219                  (pthread_cond_t *, pthread_mutex_t *));
220 #endif
221
222 #if GNULIB_TEST_PTHREAD_COND
223 SIGNATURE_CHECK (GNULIB_NAMESPACE::pthread_cond_timedwait, int,
224                  (pthread_cond_t *, pthread_mutex_t *,
225                   const struct timespec *));
226 #endif
227
228 #if GNULIB_TEST_PTHREAD_COND
229 SIGNATURE_CHECK (GNULIB_NAMESPACE::pthread_cond_signal, int,
230                  (pthread_cond_t *));
231 #endif
232
233 #if GNULIB_TEST_PTHREAD_COND
234 SIGNATURE_CHECK (GNULIB_NAMESPACE::pthread_cond_broadcast, int,
235                  (pthread_cond_t *));
236 #endif
237
238 #if GNULIB_TEST_PTHREAD_COND
239 SIGNATURE_CHECK (GNULIB_NAMESPACE::pthread_cond_destroy, int,
240                  (pthread_cond_t *));
241 #endif
242
243 /* =========== Thread-specific storage functions =========== */
244
245 #if GNULIB_TEST_PTHREAD_TSS
246 SIGNATURE_CHECK (GNULIB_NAMESPACE::pthread_key_create, int,
247                  (pthread_key_t *, void (*) (void *)));
248 #endif
249
250 #if GNULIB_TEST_PTHREAD_TSS
251 SIGNATURE_CHECK (GNULIB_NAMESPACE::pthread_setspecific, int,
252                  (pthread_key_t, const void *));
253 #endif
254
255 #if GNULIB_TEST_PTHREAD_TSS
256 SIGNATURE_CHECK (GNULIB_NAMESPACE::pthread_getspecific, void *,
257                  (pthread_key_t));
258 #endif
259
260 #if GNULIB_TEST_PTHREAD_TSS
261 SIGNATURE_CHECK (GNULIB_NAMESPACE::pthread_key_delete, int, (pthread_key_t));
262 #endif
263
264 /* =========== Spinlock functions =========== */
265
266 #if GNULIB_TEST_PTHREAD_SPIN
267 SIGNATURE_CHECK (GNULIB_NAMESPACE::pthread_spin_init, int,
268                  (pthread_spinlock_t *, int));
269 #endif
270
271 #if GNULIB_TEST_PTHREAD_SPIN
272 SIGNATURE_CHECK (GNULIB_NAMESPACE::pthread_spin_lock, int,
273                  (pthread_spinlock_t *));
274 #endif
275
276 #if GNULIB_TEST_PTHREAD_SPIN
277 SIGNATURE_CHECK (GNULIB_NAMESPACE::pthread_spin_trylock, int,
278                  (pthread_spinlock_t *));
279 #endif
280
281 #if GNULIB_TEST_PTHREAD_SPIN
282 SIGNATURE_CHECK (GNULIB_NAMESPACE::pthread_spin_unlock, int,
283                  (pthread_spinlock_t *));
284 #endif
285
286 #if GNULIB_TEST_PTHREAD_SPIN
287 SIGNATURE_CHECK (GNULIB_NAMESPACE::pthread_spin_destroy, int,
288                  (pthread_spinlock_t *));
289 #endif
290
291
292 int
293 main ()
294 {
295 }