summaryrefslogtreecommitdiffstats
path: root/gl/pthread.h
diff options
context:
space:
mode:
Diffstat (limited to 'gl/pthread.h')
-rw-r--r--gl/pthread.h2571
1 files changed, 2571 insertions, 0 deletions
diff --git a/gl/pthread.h b/gl/pthread.h
new file mode 100644
index 00000000..599f1633
--- /dev/null
+++ b/gl/pthread.h
@@ -0,0 +1,2571 @@
1/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
2/* Implement the most essential subset of POSIX pthread.h.
3
4 Copyright (C) 2009-2025 Free Software Foundation, Inc.
5
6 This file is free software: you can redistribute it and/or modify
7 it under the terms of the GNU Lesser General Public License as
8 published by the Free Software Foundation; either version 2.1 of the
9 License, or (at your option) any later version.
10
11 This file is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU Lesser General Public License for more details.
15
16 You should have received a copy of the GNU Lesser General Public License
17 along with this program. If not, see <https://www.gnu.org/licenses/>. */
18
19/* Written by Paul Eggert, Glen Lenker, and Bruno Haible. */
20
21#if __GNUC__ >= 3
22#pragma GCC system_header
23#endif
24
25
26#if defined _GL_ALREADY_INCLUDING_PTHREAD_H
27/* Special invocation convention:
28 On Android, we have a sequence of nested includes
29 <pthread.h> -> <time.h> -> <sys/time.h> -> <sys/select.h> ->
30 <signal.h> -> <pthread.h>.
31 In this situation, PTHREAD_COND_INITIALIZER is not yet defined,
32 therefore we should not attempt to define PTHREAD_MUTEX_NORMAL etc. */
33
34#include_next <pthread.h>
35
36#else
37/* Normal invocation convention. */
38
39#ifndef _GL_PTHREAD_H_
40
41#if 1
42
43# define _GL_ALREADY_INCLUDING_PTHREAD_H
44
45/* The include_next requires a split double-inclusion guard. */
46# include_next <pthread.h>
47
48# undef _GL_ALREADY_INCLUDING_PTHREAD_H
49
50#endif
51
52#ifndef _GL_PTHREAD_H_
53#define _GL_PTHREAD_H_
54
55/* This file uses _Noreturn, _GL_ATTRIBUTE_PURE, GNULIB_POSIXCHECK,
56 HAVE_RAW_DECL_*. */
57#if !_GL_CONFIG_H_INCLUDED
58 #error "Please include config.h first."
59#endif
60
61#define __need_system_stdlib_h
62#include <stdlib.h>
63#undef __need_system_stdlib_h
64
65
66/* The pthreads-win32 <pthread.h> defines a couple of broken macros. */
67#undef asctime_r
68#undef ctime_r
69#undef gmtime_r
70#undef localtime_r
71#undef rand_r
72#undef strtok_r
73
74#include <errno.h>
75#include <sched.h>
76#include <sys/types.h>
77#include <time.h>
78
79/* The __attribute__ feature is available in gcc versions 2.5 and later.
80 The attribute __pure__ was added in gcc 2.96. */
81#ifndef _GL_ATTRIBUTE_PURE
82# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) || defined __clang__
83# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
84# else
85# define _GL_ATTRIBUTE_PURE /* empty */
86# endif
87#endif
88
89/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
90/* C++ compatible function declaration macros.
91 Copyright (C) 2010-2025 Free Software Foundation, Inc.
92
93 This program is free software: you can redistribute it and/or modify it
94 under the terms of the GNU Lesser General Public License as published
95 by the Free Software Foundation; either version 2 of the License, or
96 (at your option) any later version.
97
98 This program is distributed in the hope that it will be useful,
99 but WITHOUT ANY WARRANTY; without even the implied warranty of
100 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
101 Lesser General Public License for more details.
102
103 You should have received a copy of the GNU Lesser General Public License
104 along with this program. If not, see <https://www.gnu.org/licenses/>. */
105
106#ifndef _GL_CXXDEFS_H
107#define _GL_CXXDEFS_H
108
109/* Begin/end the GNULIB_NAMESPACE namespace. */
110#if defined __cplusplus && defined GNULIB_NAMESPACE
111# define _GL_BEGIN_NAMESPACE namespace GNULIB_NAMESPACE {
112# define _GL_END_NAMESPACE }
113#else
114# define _GL_BEGIN_NAMESPACE
115# define _GL_END_NAMESPACE
116#endif
117
118/* The three most frequent use cases of these macros are:
119
120 * For providing a substitute for a function that is missing on some
121 platforms, but is declared and works fine on the platforms on which
122 it exists:
123
124 #if @GNULIB_FOO@
125 # if !@HAVE_FOO@
126 _GL_FUNCDECL_SYS (foo, ...);
127 # endif
128 _GL_CXXALIAS_SYS (foo, ...);
129 _GL_CXXALIASWARN (foo);
130 #elif defined GNULIB_POSIXCHECK
131 ...
132 #endif
133
134 * For providing a replacement for a function that exists on all platforms,
135 but is broken/insufficient and needs to be replaced on some platforms:
136
137 #if @GNULIB_FOO@
138 # if @REPLACE_FOO@
139 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
140 # undef foo
141 # define foo rpl_foo
142 # endif
143 _GL_FUNCDECL_RPL (foo, ...);
144 _GL_CXXALIAS_RPL (foo, ...);
145 # else
146 _GL_CXXALIAS_SYS (foo, ...);
147 # endif
148 _GL_CXXALIASWARN (foo);
149 #elif defined GNULIB_POSIXCHECK
150 ...
151 #endif
152
153 * For providing a replacement for a function that exists on some platforms
154 but is broken/insufficient and needs to be replaced on some of them and
155 is additionally either missing or undeclared on some other platforms:
156
157 #if @GNULIB_FOO@
158 # if @REPLACE_FOO@
159 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
160 # undef foo
161 # define foo rpl_foo
162 # endif
163 _GL_FUNCDECL_RPL (foo, ...);
164 _GL_CXXALIAS_RPL (foo, ...);
165 # else
166 # if !@HAVE_FOO@ or if !@HAVE_DECL_FOO@
167 _GL_FUNCDECL_SYS (foo, ...);
168 # endif
169 _GL_CXXALIAS_SYS (foo, ...);
170 # endif
171 _GL_CXXALIASWARN (foo);
172 #elif defined GNULIB_POSIXCHECK
173 ...
174 #endif
175*/
176
177/* _GL_EXTERN_C declaration;
178 performs the declaration with C linkage. */
179#if defined __cplusplus
180# define _GL_EXTERN_C extern "C"
181#else
182# define _GL_EXTERN_C extern
183#endif
184
185/* _GL_EXTERN_C_FUNC declaration;
186 performs the declaration of a function with C linkage. */
187#if defined __cplusplus
188# define _GL_EXTERN_C_FUNC extern "C"
189#else
190/* In C mode, omit the 'extern' keyword, because attributes in bracket syntax
191 are not allowed between 'extern' and the return type (see gnulib-common.m4).
192 */
193# define _GL_EXTERN_C_FUNC
194#endif
195
196/* _GL_FUNCDECL_RPL (func, rettype, parameters, [attributes]);
197 declares a replacement function, named rpl_func, with the given prototype,
198 consisting of return type, parameters, and attributes.
199 Although attributes are optional, the comma before them is required
200 for portability to C17 and earlier. The attribute _GL_ATTRIBUTE_NOTHROW,
201 if needed, must be placed after the _GL_FUNCDECL_RPL invocation,
202 at the end of the declaration.
203 Examples:
204 _GL_FUNCDECL_RPL (free, void, (void *ptr), ) _GL_ATTRIBUTE_NOTHROW;
205 _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...),
206 _GL_ARG_NONNULL ((1)));
207
208 Note: Attributes, such as _GL_ATTRIBUTE_DEPRECATED, are supported in front
209 of a _GL_FUNCDECL_RPL invocation only in C mode, not in C++ mode. (That's
210 because
211 [[...]] extern "C" <declaration>;
212 is invalid syntax in C++.)
213 */
214#define _GL_FUNCDECL_RPL(func,rettype,parameters,...) \
215 _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters, __VA_ARGS__)
216#define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters,...) \
217 _GL_EXTERN_C_FUNC __VA_ARGS__ rettype rpl_func parameters
218
219/* _GL_FUNCDECL_SYS_NAME (func) expands to plain func if C++, and to
220 parenthesized func otherwise. Parenthesization is needed in C23 if
221 the function is like strchr and so is a qualifier-generic macro
222 that expands to something more complicated. */
223#ifdef __cplusplus
224# define _GL_FUNCDECL_SYS_NAME(func) func
225#else
226# define _GL_FUNCDECL_SYS_NAME(func) (func)
227#endif
228
229/* _GL_FUNCDECL_SYS (func, rettype, parameters, [attributes]);
230 declares the system function, named func, with the given prototype,
231 consisting of return type, parameters, and attributes.
232 Although attributes are optional, the comma before them is required
233 for portability to C17 and earlier. The attribute _GL_ATTRIBUTE_NOTHROW,
234 if needed, must be placed after the _GL_FUNCDECL_RPL invocation,
235 at the end of the declaration.
236 Examples:
237 _GL_FUNCDECL_SYS (getumask, mode_t, (void), ) _GL_ATTRIBUTE_NOTHROW;
238 _GL_FUNCDECL_SYS (posix_openpt, int, (int flags), _GL_ATTRIBUTE_NODISCARD);
239 */
240#define _GL_FUNCDECL_SYS(func,rettype,parameters,...) \
241 _GL_EXTERN_C_FUNC __VA_ARGS__ rettype _GL_FUNCDECL_SYS_NAME (func) parameters
242
243/* _GL_CXXALIAS_RPL (func, rettype, parameters);
244 declares a C++ alias called GNULIB_NAMESPACE::func
245 that redirects to rpl_func, if GNULIB_NAMESPACE is defined.
246 Example:
247 _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...));
248
249 Wrapping rpl_func in an object with an inline conversion operator
250 avoids a reference to rpl_func unless GNULIB_NAMESPACE::func is
251 actually used in the program. */
252#define _GL_CXXALIAS_RPL(func,rettype,parameters) \
253 _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters)
254#if defined __cplusplus && defined GNULIB_NAMESPACE
255# define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
256 namespace GNULIB_NAMESPACE \
257 { \
258 static const struct _gl_ ## func ## _wrapper \
259 { \
260 typedef rettype (*type) parameters; \
261 \
262 inline operator type () const \
263 { \
264 return ::rpl_func; \
265 } \
266 } func = {}; \
267 } \
268 _GL_EXTERN_C int _gl_cxxalias_dummy
269#else
270# define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
271 _GL_EXTERN_C int _gl_cxxalias_dummy
272#endif
273
274/* _GL_CXXALIAS_MDA (func, rettype, parameters);
275 is to be used when func is a Microsoft deprecated alias, on native Windows.
276 It declares a C++ alias called GNULIB_NAMESPACE::func
277 that redirects to _func, if GNULIB_NAMESPACE is defined.
278 Example:
279 _GL_CXXALIAS_MDA (open, int, (const char *filename, int flags, ...));
280 */
281#define _GL_CXXALIAS_MDA(func,rettype,parameters) \
282 _GL_CXXALIAS_RPL_1 (func, _##func, rettype, parameters)
283
284/* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters);
285 is like _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters);
286 except that the C function rpl_func may have a slightly different
287 declaration. A cast is used to silence the "invalid conversion" error
288 that would otherwise occur. */
289#if defined __cplusplus && defined GNULIB_NAMESPACE
290# define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
291 namespace GNULIB_NAMESPACE \
292 { \
293 static const struct _gl_ ## func ## _wrapper \
294 { \
295 typedef rettype (*type) parameters; \
296 \
297 inline operator type () const \
298 { \
299 return reinterpret_cast<type>(::rpl_func); \
300 } \
301 } func = {}; \
302 } \
303 _GL_EXTERN_C int _gl_cxxalias_dummy
304#else
305# define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
306 _GL_EXTERN_C int _gl_cxxalias_dummy
307#endif
308
309/* _GL_CXXALIAS_MDA_CAST (func, rettype, parameters);
310 is like _GL_CXXALIAS_MDA (func, rettype, parameters);
311 except that the C function func may have a slightly different declaration.
312 A cast is used to silence the "invalid conversion" error that would
313 otherwise occur. */
314#define _GL_CXXALIAS_MDA_CAST(func,rettype,parameters) \
315 _GL_CXXALIAS_RPL_CAST_1 (func, _##func, rettype, parameters)
316
317/* _GL_CXXALIAS_SYS (func, rettype, parameters);
318 declares a C++ alias called GNULIB_NAMESPACE::func
319 that redirects to the system provided function func, if GNULIB_NAMESPACE
320 is defined.
321 Example:
322 _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...));
323
324 Wrapping func in an object with an inline conversion operator
325 avoids a reference to func unless GNULIB_NAMESPACE::func is
326 actually used in the program. */
327#if defined __cplusplus && defined GNULIB_NAMESPACE
328# define _GL_CXXALIAS_SYS(func,rettype,parameters) \
329 namespace GNULIB_NAMESPACE \
330 { \
331 static const struct _gl_ ## func ## _wrapper \
332 { \
333 typedef rettype (*type) parameters; \
334 \
335 inline operator type () const \
336 { \
337 return ::func; \
338 } \
339 } func = {}; \
340 } \
341 _GL_EXTERN_C int _gl_cxxalias_dummy
342#else
343# define _GL_CXXALIAS_SYS(func,rettype,parameters) \
344 _GL_EXTERN_C int _gl_cxxalias_dummy
345#endif
346
347/* _GL_CXXALIAS_SYS_CAST (func, rettype, parameters);
348 is like _GL_CXXALIAS_SYS (func, rettype, parameters);
349 except that the C function func may have a slightly different declaration.
350 A cast is used to silence the "invalid conversion" error that would
351 otherwise occur. */
352#if defined __cplusplus && defined GNULIB_NAMESPACE
353# define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
354 namespace GNULIB_NAMESPACE \
355 { \
356 static const struct _gl_ ## func ## _wrapper \
357 { \
358 typedef rettype (*type) parameters; \
359 \
360 inline operator type () const \
361 { \
362 return reinterpret_cast<type>(::func); \
363 } \
364 } func = {}; \
365 } \
366 _GL_EXTERN_C int _gl_cxxalias_dummy
367#else
368# define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
369 _GL_EXTERN_C int _gl_cxxalias_dummy
370#endif
371
372/* _GL_CXXALIAS_SYS_CAST2 (func, rettype, parameters, rettype2, parameters2);
373 is like _GL_CXXALIAS_SYS (func, rettype, parameters);
374 except that the C function is picked among a set of overloaded functions,
375 namely the one with rettype2 and parameters2. Two consecutive casts
376 are used to silence the "cannot find a match" and "invalid conversion"
377 errors that would otherwise occur. */
378#if defined __cplusplus && defined GNULIB_NAMESPACE
379 /* The outer cast must be a reinterpret_cast.
380 The inner cast: When the function is defined as a set of overloaded
381 functions, it works as a static_cast<>, choosing the designated variant.
382 When the function is defined as a single variant, it works as a
383 reinterpret_cast<>. The parenthesized cast syntax works both ways. */
384# define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
385 namespace GNULIB_NAMESPACE \
386 { \
387 static const struct _gl_ ## func ## _wrapper \
388 { \
389 typedef rettype (*type) parameters; \
390 \
391 inline operator type () const \
392 { \
393 return reinterpret_cast<type>((rettype2 (*) parameters2)(::func)); \
394 } \
395 } func = {}; \
396 } \
397 _GL_EXTERN_C int _gl_cxxalias_dummy
398#else
399# define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
400 _GL_EXTERN_C int _gl_cxxalias_dummy
401#endif
402
403/* _GL_CXXALIASWARN (func);
404 causes a warning to be emitted when ::func is used but not when
405 GNULIB_NAMESPACE::func is used. func must be defined without overloaded
406 variants. */
407#if defined __cplusplus && defined GNULIB_NAMESPACE
408# define _GL_CXXALIASWARN(func) \
409 _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE)
410# define _GL_CXXALIASWARN_1(func,namespace) \
411 _GL_CXXALIASWARN_2 (func, namespace)
412/* To work around GCC bug <https://gcc.gnu.org/PR43881>,
413 we enable the warning only when not optimizing. */
414# if !(defined __GNUC__ && !defined __clang__ && __OPTIMIZE__)
415# define _GL_CXXALIASWARN_2(func,namespace) \
416 _GL_WARN_ON_USE (func, \
417 "The symbol ::" #func " refers to the system function. " \
418 "Use " #namespace "::" #func " instead.")
419# elif (__GNUC__ >= 3 || defined __clang__) && GNULIB_STRICT_CHECKING
420# define _GL_CXXALIASWARN_2(func,namespace) \
421 extern __typeof__ (func) func
422# else
423# define _GL_CXXALIASWARN_2(func,namespace) \
424 _GL_EXTERN_C int _gl_cxxalias_dummy
425# endif
426#else
427# define _GL_CXXALIASWARN(func) \
428 _GL_EXTERN_C int _gl_cxxalias_dummy
429#endif
430
431/* _GL_CXXALIASWARN1 (func, rettype, parameters_and_attributes);
432 causes a warning to be emitted when the given overloaded variant of ::func
433 is used but not when GNULIB_NAMESPACE::func is used. */
434#if defined __cplusplus && defined GNULIB_NAMESPACE
435# define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
436 _GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \
437 GNULIB_NAMESPACE)
438# define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \
439 _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace)
440/* To work around GCC bug <https://gcc.gnu.org/PR43881>,
441 we enable the warning only when not optimizing. */
442# if !(defined __GNUC__ && !defined __clang__ && __OPTIMIZE__)
443# define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
444 _GL_WARN_ON_USE_CXX (func, rettype, rettype, parameters_and_attributes, \
445 "The symbol ::" #func " refers to the system function. " \
446 "Use " #namespace "::" #func " instead.")
447# else
448# define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
449 _GL_EXTERN_C int _gl_cxxalias_dummy
450# endif
451#else
452# define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
453 _GL_EXTERN_C int _gl_cxxalias_dummy
454#endif
455
456#endif /* _GL_CXXDEFS_H */
457
458/* The definition of _Noreturn is copied here. */
459/* A C macro for declaring that a function does not return.
460 Copyright (C) 2011-2025 Free Software Foundation, Inc.
461
462 This program is free software: you can redistribute it and/or modify it
463 under the terms of the GNU Lesser General Public License as published
464 by the Free Software Foundation; either version 2 of the License, or
465 (at your option) any later version.
466
467 This program is distributed in the hope that it will be useful,
468 but WITHOUT ANY WARRANTY; without even the implied warranty of
469 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
470 Lesser General Public License for more details.
471
472 You should have received a copy of the GNU Lesser General Public License
473 along with this program. If not, see <https://www.gnu.org/licenses/>. */
474
475/* The _Noreturn keyword of C11.
476 Do not use [[noreturn]], because with it the syntax
477 extern _Noreturn void func (...);
478 would not be valid; such a declaration would be valid only with 'extern'
479 and '_Noreturn' swapped, or without the 'extern' keyword. However, some
480 AIX system header files and several gnulib header files use precisely
481 this syntax with 'extern'. So even though C23 deprecates _Noreturn,
482 it is currently more portable to prefer it to [[noreturn]].
483
484 Also, do not try to work around LLVM bug 59792 (clang 15 or earlier).
485 This rare bug can be worked around by compiling with 'clang -D_Noreturn=',
486 though the workaround may generate many false-alarm warnings. */
487#ifndef _Noreturn
488# if ((!defined __cplusplus || defined __clang__) \
489 && (201112 <= (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0)))
490 /* _Noreturn works as-is. */
491# elif (2 < __GNUC__ + (8 <= __GNUC_MINOR__) || defined __clang__ \
492 || 0x5110 <= __SUNPRO_C)
493 /* Prefer __attribute__ ((__noreturn__)) to plain _Noreturn even if the
494 latter works, as 'gcc -std=gnu99 -Wpedantic' warns about _Noreturn. */
495# define _Noreturn __attribute__ ((__noreturn__))
496# elif 1200 <= (defined _MSC_VER ? _MSC_VER : 0)
497# define _Noreturn __declspec (noreturn)
498# else
499# define _Noreturn
500# endif
501#endif
502
503/* The definition of _GL_ARG_NONNULL is copied here. */
504/* A C macro for declaring that specific arguments must not be NULL.
505 Copyright (C) 2009-2025 Free Software Foundation, Inc.
506
507 This program is free software: you can redistribute it and/or modify it
508 under the terms of the GNU Lesser General Public License as published
509 by the Free Software Foundation; either version 2 of the License, or
510 (at your option) any later version.
511
512 This program is distributed in the hope that it will be useful,
513 but WITHOUT ANY WARRANTY; without even the implied warranty of
514 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
515 Lesser General Public License for more details.
516
517 You should have received a copy of the GNU Lesser General Public License
518 along with this program. If not, see <https://www.gnu.org/licenses/>. */
519
520/* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools
521 that the values passed as arguments n, ..., m must be non-NULL pointers.
522 n = 1 stands for the first argument, n = 2 for the second argument etc. */
523#ifndef _GL_ARG_NONNULL
524# if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || defined __clang__
525# define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params))
526# else
527# define _GL_ARG_NONNULL(params)
528# endif
529#endif
530
531/* The definition of _GL_WARN_ON_USE is copied here. */
532/* A C macro for emitting warnings if a function is used.
533 Copyright (C) 2010-2025 Free Software Foundation, Inc.
534
535 This program is free software: you can redistribute it and/or modify it
536 under the terms of the GNU Lesser General Public License as published
537 by the Free Software Foundation; either version 2 of the License, or
538 (at your option) any later version.
539
540 This program is distributed in the hope that it will be useful,
541 but WITHOUT ANY WARRANTY; without even the implied warranty of
542 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
543 Lesser General Public License for more details.
544
545 You should have received a copy of the GNU Lesser General Public License
546 along with this program. If not, see <https://www.gnu.org/licenses/>. */
547
548/* _GL_WARN_ON_USE (function, "literal string") issues a declaration
549 for FUNCTION which will then trigger a compiler warning containing
550 the text of "literal string" anywhere that function is called, if
551 supported by the compiler. If the compiler does not support this
552 feature, the macro expands to an unused extern declaration.
553
554 _GL_WARN_ON_USE_ATTRIBUTE ("literal string") expands to the
555 attribute used in _GL_WARN_ON_USE. If the compiler does not support
556 this feature, it expands to empty.
557
558 These macros are useful for marking a function as a potential
559 portability trap, with the intent that "literal string" include
560 instructions on the replacement function that should be used
561 instead.
562 _GL_WARN_ON_USE is for functions with 'extern' linkage.
563 _GL_WARN_ON_USE_ATTRIBUTE is for functions with 'static' or 'inline'
564 linkage.
565
566 _GL_WARN_ON_USE should not be used more than once for a given function
567 in a given compilation unit (because this may generate a warning even
568 if the function is never called).
569
570 However, one of the reasons that a function is a portability trap is
571 if it has the wrong signature. Declaring FUNCTION with a different
572 signature in C is a compilation error, so this macro must use the
573 same type as any existing declaration so that programs that avoid
574 the problematic FUNCTION do not fail to compile merely because they
575 included a header that poisoned the function. But this implies that
576 _GL_WARN_ON_USE is only safe to use if FUNCTION is known to already
577 have a declaration. Use of this macro implies that there must not
578 be any other macro hiding the declaration of FUNCTION; but
579 undefining FUNCTION first is part of the poisoning process anyway
580 (although for symbols that are provided only via a macro, the result
581 is a compilation error rather than a warning containing
582 "literal string"). Also note that in C++, it is only safe to use if
583 FUNCTION has no overloads.
584
585 For an example, it is possible to poison 'getline' by:
586 - adding a call to gl_WARN_ON_USE_PREPARE([[#include <stdio.h>]],
587 [getline]) in configure.ac, which potentially defines
588 HAVE_RAW_DECL_GETLINE
589 - adding this code to a header that wraps the system <stdio.h>:
590 #undef getline
591 #if HAVE_RAW_DECL_GETLINE
592 _GL_WARN_ON_USE (getline, "getline is required by POSIX 2008, but"
593 "not universally present; use the gnulib module getline");
594 #endif
595
596 It is not possible to directly poison global variables. But it is
597 possible to write a wrapper accessor function, and poison that
598 (less common usage, like &environ, will cause a compilation error
599 rather than issue the nice warning, but the end result of informing
600 the developer about their portability problem is still achieved):
601 #if HAVE_RAW_DECL_ENVIRON
602 static char ***
603 rpl_environ (void) { return &environ; }
604 _GL_WARN_ON_USE (rpl_environ, "environ is not always properly declared");
605 # undef environ
606 # define environ (*rpl_environ ())
607 #endif
608 or better (avoiding contradictory use of 'static' and 'extern'):
609 #if HAVE_RAW_DECL_ENVIRON
610 static char ***
611 _GL_WARN_ON_USE_ATTRIBUTE ("environ is not always properly declared")
612 rpl_environ (void) { return &environ; }
613 # undef environ
614 # define environ (*rpl_environ ())
615 #endif
616 */
617#ifndef _GL_WARN_ON_USE
618
619# if (4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)) && !defined __clang__
620/* A compiler attribute is available in gcc versions 4.3.0 and later. */
621# define _GL_WARN_ON_USE(function, message) \
622_GL_WARN_EXTERN_C __typeof__ (function) function __attribute__ ((__warning__ (message)))
623# define _GL_WARN_ON_USE_ATTRIBUTE(message) \
624 __attribute__ ((__warning__ (message)))
625# elif __clang_major__ >= 4
626/* Another compiler attribute is available in clang. */
627# define _GL_WARN_ON_USE(function, message) \
628_GL_WARN_EXTERN_C __typeof__ (function) function \
629 __attribute__ ((__diagnose_if__ (1, message, "warning")))
630# define _GL_WARN_ON_USE_ATTRIBUTE(message) \
631 __attribute__ ((__diagnose_if__ (1, message, "warning")))
632# elif (__GNUC__ >= 3 || defined __clang__) && GNULIB_STRICT_CHECKING
633/* Verify the existence of the function. */
634# define _GL_WARN_ON_USE(function, message) \
635_GL_WARN_EXTERN_C __typeof__ (function) function
636# define _GL_WARN_ON_USE_ATTRIBUTE(message)
637# else /* Unsupported. */
638# define _GL_WARN_ON_USE(function, message) \
639_GL_WARN_EXTERN_C int _gl_warn_on_use
640# define _GL_WARN_ON_USE_ATTRIBUTE(message)
641# endif
642#endif
643
644/* _GL_WARN_ON_USE_CXX (function, rettype_gcc, rettype_clang, parameters_and_attributes, "message")
645 is like _GL_WARN_ON_USE (function, "message"), except that in C++ mode the
646 function is declared with the given prototype, consisting of return type,
647 parameters, and attributes.
648 This variant is useful for overloaded functions in C++. _GL_WARN_ON_USE does
649 not work in this case. */
650#ifndef _GL_WARN_ON_USE_CXX
651# if !defined __cplusplus
652# define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \
653 _GL_WARN_ON_USE (function, msg)
654# else
655# if (4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)) && !defined __clang__
656/* A compiler attribute is available in gcc versions 4.3.0 and later. */
657# define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \
658extern rettype_gcc function parameters_and_attributes \
659 __attribute__ ((__warning__ (msg)))
660# elif __clang_major__ >= 4
661/* Another compiler attribute is available in clang. */
662# define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \
663extern rettype_clang function parameters_and_attributes \
664 __attribute__ ((__diagnose_if__ (1, msg, "warning")))
665# elif (__GNUC__ >= 3 || defined __clang__) && GNULIB_STRICT_CHECKING
666/* Verify the existence of the function. */
667# define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \
668extern rettype_gcc function parameters_and_attributes
669# else /* Unsupported. */
670# define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \
671_GL_WARN_EXTERN_C int _gl_warn_on_use
672# endif
673# endif
674#endif
675
676/* _GL_WARN_EXTERN_C declaration;
677 performs the declaration with C linkage. */
678#ifndef _GL_WARN_EXTERN_C
679# if defined __cplusplus
680# define _GL_WARN_EXTERN_C extern "C"
681# else
682# define _GL_WARN_EXTERN_C extern
683# endif
684#endif
685
686/* =========== Thread types and macros =========== */
687
688#if (defined _WIN32 && ! defined __CYGWIN__) && USE_WINDOWS_THREADS
689# if 0
690# include "windows-thread.h"
691# if 1
692# define pthread_t rpl_pthread_t
693# define pthread_attr_t rpl_pthread_attr_t
694# endif
695# if !GNULIB_defined_pthread_thread_types
696typedef glwthread_thread_t pthread_t;
697typedef unsigned int pthread_attr_t;
698# define GNULIB_defined_pthread_thread_types 1
699# endif
700# else
701# if 1
702# define pthread_t rpl_pthread_t
703# define pthread_attr_t rpl_pthread_attr_t
704# endif
705# if !GNULIB_defined_pthread_thread_types
706typedef int pthread_t;
707typedef unsigned int pthread_attr_t;
708# define GNULIB_defined_pthread_thread_types 1
709# endif
710# endif
711# undef PTHREAD_CREATE_JOINABLE
712# undef PTHREAD_CREATE_DETACHED
713# define PTHREAD_CREATE_JOINABLE 0
714# define PTHREAD_CREATE_DETACHED 1
715#else
716# if !1
717# if !GNULIB_defined_pthread_thread_types
718typedef int pthread_t;
719typedef unsigned int pthread_attr_t;
720# define GNULIB_defined_pthread_thread_types 1
721# endif
722# endif
723# if !1
724# define PTHREAD_CREATE_JOINABLE 0
725# define PTHREAD_CREATE_DETACHED 1
726# endif
727#endif
728
729/* =========== Once-only control (initialization) types and macros ========== */
730
731#if (defined _WIN32 && ! defined __CYGWIN__) && USE_WINDOWS_THREADS
732# if 1
733# include "windows-once.h"
734# if 1
735# define pthread_once_t rpl_pthread_once_t
736# endif
737# if !GNULIB_defined_pthread_once_types
738typedef glwthread_once_t pthread_once_t;
739# define GNULIB_defined_pthread_once_types 1
740# endif
741# undef PTHREAD_ONCE_INIT
742# define PTHREAD_ONCE_INIT GLWTHREAD_ONCE_INIT
743# else
744# if 1
745# define pthread_once_t rpl_pthread_once_t
746# endif
747# if !GNULIB_defined_pthread_once_types
748typedef int pthread_once_t;
749# define GNULIB_defined_pthread_once_types 1
750# endif
751# undef PTHREAD_ONCE_INIT
752# define PTHREAD_ONCE_INIT { 0 }
753# endif
754#else
755# if !1
756# if !GNULIB_defined_pthread_once_types
757typedef int pthread_once_t;
758# define GNULIB_defined_pthread_once_types 1
759# endif
760# undef PTHREAD_ONCE_INIT
761# define PTHREAD_ONCE_INIT { 0 }
762# endif
763#endif
764
765/* =========== Mutex types and macros =========== */
766
767#if (defined _WIN32 && ! defined __CYGWIN__) && USE_WINDOWS_THREADS
768# if 0
769# include "windows-timedmutex.h"
770# include "windows-timedrecmutex.h"
771# if 1
772# define pthread_mutex_t rpl_pthread_mutex_t
773# define pthread_mutexattr_t rpl_pthread_mutexattr_t
774# endif
775# if !GNULIB_defined_pthread_mutex_types
776typedef struct
777 {
778 int type;
779 union
780 {
781 glwthread_timedmutex_t u_timedmutex;
782 glwthread_timedrecmutex_t u_timedrecmutex;
783 }
784 u;
785 }
786 pthread_mutex_t;
787typedef unsigned int pthread_mutexattr_t;
788# define GNULIB_defined_pthread_mutex_types 1
789# endif
790# undef PTHREAD_MUTEX_INITIALIZER
791# define PTHREAD_MUTEX_INITIALIZER { 1, { GLWTHREAD_TIMEDMUTEX_INIT } }
792# else
793# if 1
794# define pthread_mutex_t rpl_pthread_mutex_t
795# define pthread_mutexattr_t rpl_pthread_mutexattr_t
796# endif
797# if !GNULIB_defined_pthread_mutex_types
798typedef int pthread_mutex_t;
799typedef unsigned int pthread_mutexattr_t;
800# define GNULIB_defined_pthread_mutex_types 1
801# endif
802# undef PTHREAD_MUTEX_INITIALIZER
803# define PTHREAD_MUTEX_INITIALIZER { 0 }
804# endif
805# undef PTHREAD_MUTEX_DEFAULT
806# undef PTHREAD_MUTEX_NORMAL
807# undef PTHREAD_MUTEX_ERRORCHECK
808# undef PTHREAD_MUTEX_RECURSIVE
809# define PTHREAD_MUTEX_DEFAULT PTHREAD_MUTEX_NORMAL
810# define PTHREAD_MUTEX_NORMAL 0
811# define PTHREAD_MUTEX_ERRORCHECK 1
812# define PTHREAD_MUTEX_RECURSIVE 2
813# undef PTHREAD_MUTEX_STALLED
814# undef PTHREAD_MUTEX_ROBUST
815# define PTHREAD_MUTEX_STALLED 0
816# define PTHREAD_MUTEX_ROBUST 1
817#else
818# if !1
819# if !GNULIB_defined_pthread_mutex_types
820typedef int pthread_mutex_t;
821typedef unsigned int pthread_mutexattr_t;
822# define GNULIB_defined_pthread_mutex_types 1
823# endif
824# undef PTHREAD_MUTEX_INITIALIZER
825# define PTHREAD_MUTEX_INITIALIZER { 0 }
826# endif
827# if !1
828# define PTHREAD_MUTEX_DEFAULT PTHREAD_MUTEX_NORMAL
829# define PTHREAD_MUTEX_NORMAL 0
830# define PTHREAD_MUTEX_ERRORCHECK 1
831# define PTHREAD_MUTEX_RECURSIVE 2
832# endif
833# if !1
834# define PTHREAD_MUTEX_STALLED 0
835# define PTHREAD_MUTEX_ROBUST 1
836# endif
837#endif
838
839/* =========== Read-write lock types and macros =========== */
840
841#if (defined _WIN32 && ! defined __CYGWIN__) && USE_WINDOWS_THREADS
842# if 0
843# include "windows-timedrwlock.h"
844# if 1
845# define pthread_rwlock_t rpl_pthread_rwlock_t
846# define pthread_rwlockattr_t rpl_pthread_rwlockattr_t
847# endif
848# if !GNULIB_defined_pthread_rwlock_types
849typedef glwthread_timedrwlock_t pthread_rwlock_t;
850typedef unsigned int pthread_rwlockattr_t;
851# define GNULIB_defined_pthread_rwlock_types 1
852# endif
853# undef PTHREAD_RWLOCK_INITIALIZER
854# define PTHREAD_RWLOCK_INITIALIZER GLWTHREAD_TIMEDRWLOCK_INIT
855# else
856# if 1
857# define pthread_rwlock_t rpl_pthread_rwlock_t
858# define pthread_rwlockattr_t rpl_pthread_rwlockattr_t
859# endif
860# if !GNULIB_defined_pthread_rwlock_types
861typedef int pthread_rwlock_t;
862typedef unsigned int pthread_rwlockattr_t;
863# define GNULIB_defined_pthread_rwlock_types 1
864# endif
865# undef PTHREAD_RWLOCK_INITIALIZER
866# define PTHREAD_RWLOCK_INITIALIZER { 0 }
867# endif
868#elif 0 && 0 /* i.e. PTHREAD_RWLOCK_UNIMPLEMENTED */
869# if 1
870# define pthread_rwlock_t rpl_pthread_rwlock_t
871# define pthread_rwlockattr_t rpl_pthread_rwlockattr_t
872# endif
873# if !GNULIB_defined_pthread_rwlock_types
874typedef struct
875 {
876 pthread_mutex_t lock; /* protects the remaining fields */
877 pthread_cond_t waiting_readers; /* waiting readers */
878 pthread_cond_t waiting_writers; /* waiting writers */
879 unsigned int waiting_writers_count; /* number of waiting writers */
880 int runcount; /* number of readers running, or -1 when a writer runs */
881 }
882 pthread_rwlock_t;
883typedef unsigned int pthread_rwlockattr_t;
884# define GNULIB_defined_pthread_rwlock_types 1
885# endif
886# undef PTHREAD_RWLOCK_INITIALIZER
887# define PTHREAD_RWLOCK_INITIALIZER \
888 { PTHREAD_MUTEX_INITIALIZER, PTHREAD_COND_INITIALIZER, PTHREAD_COND_INITIALIZER, 0, 0 }
889#elif 0 && 0 /* i.e. PTHREAD_RWLOCK_BAD_WAITQUEUE */
890/* Use rwlocks of kind PREFER_WRITER or PREFER_WRITER_NONRECURSIVE instead of
891 the DEFAULT. */
892# undef PTHREAD_RWLOCK_INITIALIZER
893# define PTHREAD_RWLOCK_INITIALIZER PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP
894#else
895# if 1
896# if !defined PTHREAD_RWLOCK_INITIALIZER && defined PTHREAD_RWLOCK_INITIALIZER_NP /* z/OS */
897# define PTHREAD_RWLOCK_INITIALIZER PTHREAD_RWLOCK_INITIALIZER_NP
898# endif
899# else
900# if !GNULIB_defined_pthread_rwlock_types
901typedef int pthread_rwlock_t;
902typedef unsigned int pthread_rwlockattr_t;
903# define GNULIB_defined_pthread_rwlock_types 1
904# endif
905# undef PTHREAD_RWLOCK_INITIALIZER
906# define PTHREAD_RWLOCK_INITIALIZER { 0 }
907# endif
908#endif
909
910/* =========== Condition variable types and macros =========== */
911
912#if (defined _WIN32 && ! defined __CYGWIN__) && USE_WINDOWS_THREADS
913# if 0
914# include "windows-cond.h"
915# if 1
916# define pthread_cond_t rpl_pthread_cond_t
917# define pthread_condattr_t rpl_pthread_condattr_t
918# endif
919# if !GNULIB_defined_pthread_cond_types
920typedef glwthread_cond_t pthread_cond_t;
921typedef unsigned int pthread_condattr_t;
922# define GNULIB_defined_pthread_cond_types 1
923# endif
924# undef PTHREAD_COND_INITIALIZER
925# define PTHREAD_COND_INITIALIZER GLWTHREAD_COND_INIT
926# else
927# if 1
928# define pthread_cond_t rpl_pthread_cond_t
929# define pthread_condattr_t rpl_pthread_condattr_t
930# endif
931# if !GNULIB_defined_pthread_cond_types
932typedef int pthread_cond_t;
933typedef unsigned int pthread_condattr_t;
934# define GNULIB_defined_pthread_cond_types 1
935# endif
936# undef PTHREAD_COND_INITIALIZER
937# define PTHREAD_COND_INITIALIZER { 0 }
938# endif
939#else
940# if !1
941# if !GNULIB_defined_pthread_cond_types
942typedef int pthread_cond_t;
943typedef unsigned int pthread_condattr_t;
944# define GNULIB_defined_pthread_cond_types 1
945# endif
946# undef PTHREAD_COND_INITIALIZER
947# define PTHREAD_COND_INITIALIZER { 0 }
948# endif
949#endif
950
951/* =========== Thread-specific storage types and macros =========== */
952
953#if (defined _WIN32 && ! defined __CYGWIN__) && USE_WINDOWS_THREADS
954# if 0
955# include "windows-tls.h"
956# if 1
957# define pthread_key_t rpl_pthread_key_t
958# endif
959# if !GNULIB_defined_pthread_tss_types
960typedef glwthread_tls_key_t pthread_key_t;
961# define GNULIB_defined_pthread_tss_types 1
962# endif
963# undef PTHREAD_DESTRUCTOR_ITERATIONS
964# define PTHREAD_DESTRUCTOR_ITERATIONS GLWTHREAD_DESTRUCTOR_ITERATIONS
965# else
966# if 1
967# define pthread_key_t rpl_pthread_key_t
968# endif
969# if !GNULIB_defined_pthread_tss_types
970typedef void ** pthread_key_t;
971# define GNULIB_defined_pthread_tss_types 1
972# endif
973# undef PTHREAD_DESTRUCTOR_ITERATIONS
974# define PTHREAD_DESTRUCTOR_ITERATIONS 0
975# endif
976#else
977# if !1
978# if !GNULIB_defined_pthread_tss_types
979typedef void ** pthread_key_t;
980# define GNULIB_defined_pthread_tss_types 1
981# endif
982# undef PTHREAD_DESTRUCTOR_ITERATIONS
983# define PTHREAD_DESTRUCTOR_ITERATIONS 0
984# endif
985#endif
986
987/* =========== Spinlock types and macros =========== */
988
989#if (defined _WIN32 && ! defined __CYGWIN__) && USE_WINDOWS_THREADS
990# if 0
991# include "windows-spin.h"
992# if 1
993# define pthread_spinlock_t rpl_pthread_spinlock_t
994# endif
995# if !GNULIB_defined_pthread_spin_types
996typedef glwthread_spinlock_t pthread_spinlock_t;
997# define GNULIB_defined_pthread_spin_types 1
998# endif
999# else
1000# if 1
1001# define pthread_spinlock_t rpl_pthread_spinlock_t
1002# endif
1003# if !GNULIB_defined_pthread_spin_types
1004typedef pthread_mutex_t pthread_spinlock_t;
1005# define GNULIB_defined_pthread_spin_types 1
1006# endif
1007# endif
1008# undef PTHREAD_PROCESS_PRIVATE
1009# undef PTHREAD_PROCESS_SHARED
1010# define PTHREAD_PROCESS_PRIVATE 0
1011# define PTHREAD_PROCESS_SHARED 1
1012#else
1013# if 1
1014/* <pthread.h> exists and defines pthread_spinlock_t. */
1015# if !1 || 0
1016/* If the 'pthread-spin' module is in use, it defines all the pthread_spin*
1017 functions. Prepare for it by overriding pthread_spinlock_t if that might
1018 be needed. */
1019# if !(((__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7) \
1020 || __clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >= 1)) \
1021 || (((__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1)) \
1022 && !defined __ANDROID__) \
1023 || __clang_major__ >= 3)) \
1024 && !defined __ibmxl__)
1025/* We can't use GCC built-ins. Approximate spinlocks with mutexes. */
1026# if !GNULIB_defined_pthread_spin_types
1027# define pthread_spinlock_t pthread_mutex_t
1028# define GNULIB_defined_pthread_spin_types 1
1029# endif
1030# endif
1031# endif
1032# else
1033/* Approximate spinlocks with mutexes. */
1034# if !GNULIB_defined_pthread_spin_types
1035typedef pthread_mutex_t pthread_spinlock_t;
1036# define GNULIB_defined_pthread_spin_types 1
1037# endif
1038# endif
1039# if !1
1040# define PTHREAD_PROCESS_PRIVATE 0
1041# define PTHREAD_PROCESS_SHARED 1
1042# endif
1043#endif
1044
1045/* =========== Other types and macros =========== */
1046
1047#if !1
1048# if !GNULIB_defined_other_pthread_types
1049typedef int pthread_barrier_t;
1050typedef unsigned int pthread_barrierattr_t;
1051# define GNULIB_defined_other_pthread_types 1
1052# endif
1053#endif
1054
1055#if !defined PTHREAD_CANCELED
1056
1057# define PTHREAD_BARRIER_SERIAL_THREAD (-1)
1058
1059# define PTHREAD_CANCEL_DEFERRED 0
1060# define PTHREAD_CANCEL_ASYNCHRONOUS 1
1061
1062# define PTHREAD_CANCEL_ENABLE 0
1063# define PTHREAD_CANCEL_DISABLE 1
1064
1065# define PTHREAD_CANCELED ((void *) -1)
1066
1067# define PTHREAD_INHERIT_SCHED 0
1068# define PTHREAD_EXPLICIT_SCHED 1
1069
1070# define PTHREAD_PRIO_NONE 0
1071# define PTHREAD_PRIO_INHERIT 1
1072# define PTHREAD_PRIO_PROTECT 2
1073
1074# define PTHREAD_SCOPE_SYSTEM 0
1075# define PTHREAD_SCOPE_PROCESS 1
1076
1077#endif
1078
1079/* =========== Thread functions =========== */
1080
1081#if 0
1082/* The 'restrict' qualifier on ARG is nonsense, but POSIX specifies it this way.
1083 Sigh. */
1084# if 0
1085# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1086# undef pthread_create
1087# define pthread_create rpl_pthread_create
1088# endif
1089_GL_FUNCDECL_RPL (pthread_create, int,
1090 (pthread_t *restrict threadp,
1091 const pthread_attr_t *restrict attr,
1092 void * (*mainfunc) (void *), void *restrict arg),
1093 _GL_ARG_NONNULL ((1, 3)));
1094_GL_CXXALIAS_RPL (pthread_create, int,
1095 (pthread_t *restrict threadp,
1096 const pthread_attr_t *restrict attr,
1097 void * (*mainfunc) (void *), void *restrict arg));
1098# else
1099# if !1
1100_GL_FUNCDECL_SYS (pthread_create, int,
1101 (pthread_t *restrict threadp,
1102 const pthread_attr_t *restrict attr,
1103 void * (*mainfunc) (void *), void *restrict arg),
1104 _GL_ARG_NONNULL ((1, 3)));
1105# endif
1106_GL_CXXALIAS_SYS_CAST (pthread_create, int,
1107 (pthread_t *restrict threadp,
1108 const pthread_attr_t *restrict attr,
1109 void * (*mainfunc) (void *), void *restrict arg));
1110# endif
1111# if __GLIBC__ >= 2
1112_GL_CXXALIASWARN (pthread_create);
1113# endif
1114#elif defined GNULIB_POSIXCHECK
1115# if HAVE_RAW_DECL_PTHREAD_CREATE
1116_GL_WARN_ON_USE (pthread_create, "pthread_create is not portable - "
1117 "use gnulib module pthread-thread for portability");
1118# endif
1119#endif
1120
1121#if 0
1122# if 0
1123# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1124# undef pthread_attr_init
1125# define pthread_attr_init rpl_pthread_attr_init
1126# endif
1127_GL_FUNCDECL_RPL (pthread_attr_init, int, (pthread_attr_t *attr),
1128 _GL_ARG_NONNULL ((1)));
1129_GL_CXXALIAS_RPL (pthread_attr_init, int, (pthread_attr_t *attr));
1130# else
1131# if !1
1132_GL_FUNCDECL_SYS (pthread_attr_init, int, (pthread_attr_t *attr),
1133 _GL_ARG_NONNULL ((1)));
1134# endif
1135_GL_CXXALIAS_SYS (pthread_attr_init, int, (pthread_attr_t *attr));
1136# endif
1137# if __GLIBC__ >= 2
1138_GL_CXXALIASWARN (pthread_attr_init);
1139# endif
1140#elif defined GNULIB_POSIXCHECK
1141# if HAVE_RAW_DECL_PTHREAD_ATTR_INIT
1142_GL_WARN_ON_USE (pthread_attr_init, "pthread_attr_init is not portable - "
1143 "use gnulib module pthread-thread for portability");
1144# endif
1145#endif
1146
1147#if 0
1148# if 0
1149# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1150# undef pthread_attr_getdetachstate
1151# define pthread_attr_getdetachstate rpl_pthread_attr_getdetachstate
1152# endif
1153_GL_FUNCDECL_RPL (pthread_attr_getdetachstate, int,
1154 (const pthread_attr_t *attr, int *detachstatep),
1155 _GL_ARG_NONNULL ((1, 2)));
1156_GL_CXXALIAS_RPL (pthread_attr_getdetachstate, int,
1157 (const pthread_attr_t *attr, int *detachstatep));
1158# else
1159# if !1
1160_GL_FUNCDECL_SYS (pthread_attr_getdetachstate, int,
1161 (const pthread_attr_t *attr, int *detachstatep),
1162 _GL_ARG_NONNULL ((1, 2)));
1163# endif
1164_GL_CXXALIAS_SYS (pthread_attr_getdetachstate, int,
1165 (const pthread_attr_t *attr, int *detachstatep));
1166# endif
1167# if __GLIBC__ >= 2
1168_GL_CXXALIASWARN (pthread_attr_getdetachstate);
1169# endif
1170#elif defined GNULIB_POSIXCHECK
1171# if HAVE_RAW_DECL_PTHREAD_ATTR_GETDETACHSTATE
1172_GL_WARN_ON_USE (pthread_attr_getdetachstate, "pthread_attr_getdetachstate is not portable - "
1173 "use gnulib module pthread-thread for portability");
1174# endif
1175#endif
1176
1177#if 0
1178# if 0
1179# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1180# undef pthread_attr_setdetachstate
1181# define pthread_attr_setdetachstate rpl_pthread_attr_setdetachstate
1182# endif
1183_GL_FUNCDECL_RPL (pthread_attr_setdetachstate, int,
1184 (pthread_attr_t *attr, int detachstate),
1185 _GL_ARG_NONNULL ((1)));
1186_GL_CXXALIAS_RPL (pthread_attr_setdetachstate, int,
1187 (pthread_attr_t *attr, int detachstate));
1188# else
1189# if !1
1190_GL_FUNCDECL_SYS (pthread_attr_setdetachstate, int,
1191 (pthread_attr_t *attr, int detachstate),
1192 _GL_ARG_NONNULL ((1)));
1193# endif
1194_GL_CXXALIAS_SYS (pthread_attr_setdetachstate, int,
1195 (pthread_attr_t *attr, int detachstate));
1196# endif
1197# if __GLIBC__ >= 2
1198_GL_CXXALIASWARN (pthread_attr_setdetachstate);
1199# endif
1200#elif defined GNULIB_POSIXCHECK
1201# if HAVE_RAW_DECL_PTHREAD_ATTR_SETDETACHSTATE
1202_GL_WARN_ON_USE (pthread_attr_setdetachstate, "pthread_attr_setdetachstate is not portable - "
1203 "use gnulib module pthread-thread for portability");
1204# endif
1205#endif
1206
1207#if 0
1208# if 0
1209# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1210# undef pthread_attr_destroy
1211# define pthread_attr_destroy rpl_pthread_attr_destroy
1212# endif
1213_GL_FUNCDECL_RPL (pthread_attr_destroy, int, (pthread_attr_t *attr),
1214 _GL_ARG_NONNULL ((1)));
1215_GL_CXXALIAS_RPL (pthread_attr_destroy, int, (pthread_attr_t *attr));
1216# else
1217# if !1
1218_GL_FUNCDECL_SYS (pthread_attr_destroy, int, (pthread_attr_t *attr),
1219 _GL_ARG_NONNULL ((1)));
1220# endif
1221_GL_CXXALIAS_SYS (pthread_attr_destroy, int, (pthread_attr_t *attr));
1222# endif
1223# if __GLIBC__ >= 2
1224_GL_CXXALIASWARN (pthread_attr_destroy);
1225# endif
1226#elif defined GNULIB_POSIXCHECK
1227# if HAVE_RAW_DECL_PTHREAD_ATTR_DESTROY
1228_GL_WARN_ON_USE (pthread_attr_destroy, "pthread_attr_destroy is not portable - "
1229 "use gnulib module pthread-thread for portability");
1230# endif
1231#endif
1232
1233#if 0
1234# if 0
1235# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1236# undef pthread_self
1237# define pthread_self rpl_pthread_self
1238# endif
1239_GL_FUNCDECL_RPL (pthread_self, pthread_t, (void), _GL_ATTRIBUTE_PURE);
1240_GL_CXXALIAS_RPL (pthread_self, pthread_t, (void));
1241# else
1242# if !1
1243_GL_FUNCDECL_SYS (pthread_self, pthread_t, (void), _GL_ATTRIBUTE_PURE);
1244# endif
1245_GL_CXXALIAS_SYS (pthread_self, pthread_t, (void));
1246# endif
1247# if __GLIBC__ >= 2
1248_GL_CXXALIASWARN (pthread_self);
1249# endif
1250#elif defined GNULIB_POSIXCHECK
1251# if HAVE_RAW_DECL_PTHREAD_SELF
1252_GL_WARN_ON_USE (pthread_self, "pthread_self is not portable - "
1253 "use gnulib module pthread-thread for portability");
1254# endif
1255#endif
1256
1257#if 0
1258# if 0
1259# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1260# undef pthread_equal
1261# define pthread_equal rpl_pthread_equal
1262# endif
1263_GL_FUNCDECL_RPL (pthread_equal, int, (pthread_t thread1, pthread_t thread2), );
1264_GL_CXXALIAS_RPL (pthread_equal, int, (pthread_t thread1, pthread_t thread2));
1265# else
1266# if !1
1267_GL_FUNCDECL_SYS (pthread_equal, int, (pthread_t thread1, pthread_t thread2), );
1268# endif
1269_GL_CXXALIAS_SYS (pthread_equal, int, (pthread_t thread1, pthread_t thread2));
1270# endif
1271# if __GLIBC__ >= 2
1272_GL_CXXALIASWARN (pthread_equal);
1273# endif
1274#elif defined GNULIB_POSIXCHECK
1275# if HAVE_RAW_DECL_PTHREAD_EQUAL
1276_GL_WARN_ON_USE (pthread_equal, "pthread_equal is not portable - "
1277 "use gnulib module pthread-thread for portability");
1278# endif
1279#endif
1280
1281#if 0
1282# if 0
1283# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1284# undef pthread_detach
1285# define pthread_detach rpl_pthread_detach
1286# endif
1287_GL_FUNCDECL_RPL (pthread_detach, int, (pthread_t thread), );
1288_GL_CXXALIAS_RPL (pthread_detach, int, (pthread_t thread));
1289# else
1290# if !1
1291_GL_FUNCDECL_SYS (pthread_detach, int, (pthread_t thread), );
1292# endif
1293_GL_CXXALIAS_SYS (pthread_detach, int, (pthread_t thread));
1294# endif
1295# if __GLIBC__ >= 2
1296_GL_CXXALIASWARN (pthread_detach);
1297# endif
1298#elif defined GNULIB_POSIXCHECK
1299# if HAVE_RAW_DECL_PTHREAD_DETACH
1300_GL_WARN_ON_USE (pthread_detach, "pthread_detach is not portable - "
1301 "use gnulib module pthread-thread for portability");
1302# endif
1303#endif
1304
1305#if 0
1306# if 0
1307# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1308# undef pthread_join
1309# define pthread_join rpl_pthread_join
1310# endif
1311_GL_FUNCDECL_RPL (pthread_join, int, (pthread_t thread, void **valuep), );
1312_GL_CXXALIAS_RPL (pthread_join, int, (pthread_t thread, void **valuep));
1313# else
1314# if !1
1315_GL_FUNCDECL_SYS (pthread_join, int, (pthread_t thread, void **valuep), );
1316# endif
1317_GL_CXXALIAS_SYS (pthread_join, int, (pthread_t thread, void **valuep));
1318# endif
1319# if __GLIBC__ >= 2
1320_GL_CXXALIASWARN (pthread_join);
1321# endif
1322#elif defined GNULIB_POSIXCHECK
1323# if HAVE_RAW_DECL_PTHREAD_JOIN
1324_GL_WARN_ON_USE (pthread_join, "pthread_join is not portable - "
1325 "use gnulib module pthread-thread for portability");
1326# endif
1327#endif
1328
1329#if 0
1330# if 0
1331# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1332# undef pthread_exit
1333# define pthread_exit rpl_pthread_exit
1334# endif
1335_GL_FUNCDECL_RPL (pthread_exit, _Noreturn void, (void *value), );
1336_GL_CXXALIAS_RPL (pthread_exit, void, (void *value));
1337# else
1338# if !1
1339_GL_FUNCDECL_SYS (pthread_exit, _Noreturn void, (void *value), );
1340# endif
1341/* Need to cast because of AIX with xlclang++. */
1342_GL_CXXALIAS_SYS_CAST (pthread_exit, void, (void *value));
1343# endif
1344# if __GLIBC__ >= 2
1345_GL_CXXALIASWARN (pthread_exit);
1346# endif
1347#elif defined GNULIB_POSIXCHECK
1348# if HAVE_RAW_DECL_PTHREAD_EXIT
1349_GL_WARN_ON_USE (pthread_exit, "pthread_exit is not portable - "
1350 "use gnulib module pthread-thread for portability");
1351# endif
1352#endif
1353
1354/* =========== Once-only control (initialization) functions =========== */
1355
1356#if 1
1357# if 0
1358# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1359# undef pthread_once
1360# define pthread_once rpl_pthread_once
1361# endif
1362_GL_FUNCDECL_RPL (pthread_once, int,
1363 (pthread_once_t *once_control, void (*initfunction) (void)),
1364 _GL_ARG_NONNULL ((1, 2)));
1365_GL_CXXALIAS_RPL (pthread_once, int,
1366 (pthread_once_t *once_control, void (*initfunction) (void)));
1367# else
1368# if !1
1369_GL_FUNCDECL_SYS (pthread_once, int,
1370 (pthread_once_t *once_control, void (*initfunction) (void)),
1371 _GL_ARG_NONNULL ((1, 2)));
1372# endif
1373_GL_CXXALIAS_SYS_CAST (pthread_once, int,
1374 (pthread_once_t *once_control,
1375 void (*initfunction) (void)));
1376# endif
1377# if __GLIBC__ >= 2
1378_GL_CXXALIASWARN (pthread_once);
1379# endif
1380#elif defined GNULIB_POSIXCHECK
1381# if HAVE_RAW_DECL_PTHREAD_ONCE
1382_GL_WARN_ON_USE (pthread_once, "pthread_once is not portable - "
1383 "use gnulib module pthread-once for portability");
1384# endif
1385#endif
1386
1387/* =========== Mutex functions =========== */
1388
1389#if 0
1390# if 0
1391# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1392# undef pthread_mutex_init
1393# define pthread_mutex_init rpl_pthread_mutex_init
1394# endif
1395_GL_FUNCDECL_RPL (pthread_mutex_init, int,
1396 (pthread_mutex_t *restrict mutex,
1397 const pthread_mutexattr_t *restrict attr),
1398 _GL_ARG_NONNULL ((1)));
1399_GL_CXXALIAS_RPL (pthread_mutex_init, int,
1400 (pthread_mutex_t *restrict mutex,
1401 const pthread_mutexattr_t *restrict attr));
1402# else
1403# if !1
1404_GL_FUNCDECL_SYS (pthread_mutex_init, int,
1405 (pthread_mutex_t *restrict mutex,
1406 const pthread_mutexattr_t *restrict attr),
1407 _GL_ARG_NONNULL ((1)));
1408# endif
1409_GL_CXXALIAS_SYS (pthread_mutex_init, int,
1410 (pthread_mutex_t *restrict mutex,
1411 const pthread_mutexattr_t *restrict attr));
1412# endif
1413# if __GLIBC__ >= 2
1414_GL_CXXALIASWARN (pthread_mutex_init);
1415# endif
1416#elif defined GNULIB_POSIXCHECK
1417# if HAVE_RAW_DECL_PTHREAD_MUTEX_INIT
1418_GL_WARN_ON_USE (pthread_mutex_init, "pthread_mutex_init is not portable - "
1419 "use gnulib module pthread-mutex for portability");
1420# endif
1421#endif
1422
1423#if 0
1424# if 0
1425# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1426# undef pthread_mutexattr_init
1427# define pthread_mutexattr_init rpl_pthread_mutexattr_init
1428# endif
1429_GL_FUNCDECL_RPL (pthread_mutexattr_init, int, (pthread_mutexattr_t *attr),
1430 _GL_ARG_NONNULL ((1)));
1431_GL_CXXALIAS_RPL (pthread_mutexattr_init, int, (pthread_mutexattr_t *attr));
1432# else
1433# if !1
1434_GL_FUNCDECL_SYS (pthread_mutexattr_init, int, (pthread_mutexattr_t *attr),
1435 _GL_ARG_NONNULL ((1)));
1436# endif
1437_GL_CXXALIAS_SYS (pthread_mutexattr_init, int, (pthread_mutexattr_t *attr));
1438# endif
1439# if __GLIBC__ >= 2
1440_GL_CXXALIASWARN (pthread_mutexattr_init);
1441# endif
1442#elif defined GNULIB_POSIXCHECK
1443# if HAVE_RAW_DECL_PTHREAD_MUTEXATTR_INIT
1444_GL_WARN_ON_USE (pthread_mutexattr_init, "pthread_mutexattr_init is not portable - "
1445 "use gnulib module pthread-mutex for portability");
1446# endif
1447#endif
1448
1449#if 0
1450# if 0
1451# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1452# undef pthread_mutexattr_gettype
1453# define pthread_mutexattr_gettype rpl_pthread_mutexattr_gettype
1454# endif
1455_GL_FUNCDECL_RPL (pthread_mutexattr_gettype, int,
1456 (const pthread_mutexattr_t *restrict attr,
1457 int *restrict typep),
1458 _GL_ARG_NONNULL ((1, 2)));
1459_GL_CXXALIAS_RPL (pthread_mutexattr_gettype, int,
1460 (const pthread_mutexattr_t *restrict attr,
1461 int *restrict typep));
1462# else
1463# if !1
1464_GL_FUNCDECL_SYS (pthread_mutexattr_gettype, int,
1465 (const pthread_mutexattr_t *restrict attr,
1466 int *restrict typep),
1467 _GL_ARG_NONNULL ((1, 2)));
1468# endif
1469/* Need to cast, because on FreeBSD the first parameter is
1470 pthread_mutexattr_t *attr. */
1471_GL_CXXALIAS_SYS_CAST (pthread_mutexattr_gettype, int,
1472 (const pthread_mutexattr_t *restrict attr,
1473 int *restrict typep));
1474# endif
1475# if __GLIBC__ >= 2
1476_GL_CXXALIASWARN (pthread_mutexattr_gettype);
1477# endif
1478#elif defined GNULIB_POSIXCHECK
1479# if HAVE_RAW_DECL_PTHREAD_MUTEXATTR_GETTYPE
1480_GL_WARN_ON_USE (pthread_mutexattr_gettype, "pthread_mutexattr_gettype is not portable - "
1481 "use gnulib module pthread-mutex for portability");
1482# endif
1483#endif
1484
1485#if 0
1486# if 0
1487# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1488# undef pthread_mutexattr_settype
1489# define pthread_mutexattr_settype rpl_pthread_mutexattr_settype
1490# endif
1491_GL_FUNCDECL_RPL (pthread_mutexattr_settype, int,
1492 (pthread_mutexattr_t *attr, int type), _GL_ARG_NONNULL ((1)));
1493_GL_CXXALIAS_RPL (pthread_mutexattr_settype, int,
1494 (pthread_mutexattr_t *attr, int type));
1495# else
1496# if !1
1497_GL_FUNCDECL_SYS (pthread_mutexattr_settype, int,
1498 (pthread_mutexattr_t *attr, int type), _GL_ARG_NONNULL ((1)));
1499# endif
1500_GL_CXXALIAS_SYS (pthread_mutexattr_settype, int,
1501 (pthread_mutexattr_t *attr, int type));
1502# endif
1503# if __GLIBC__ >= 2
1504_GL_CXXALIASWARN (pthread_mutexattr_settype);
1505# endif
1506#elif defined GNULIB_POSIXCHECK
1507# if HAVE_RAW_DECL_PTHREAD_MUTEXATTR_SETTYPE
1508_GL_WARN_ON_USE (pthread_mutexattr_settype, "pthread_mutexattr_settype is not portable - "
1509 "use gnulib module pthread-mutex for portability");
1510# endif
1511#endif
1512
1513#if 0
1514# if 0
1515# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1516# undef pthread_mutexattr_getrobust
1517# define pthread_mutexattr_getrobust rpl_pthread_mutexattr_getrobust
1518# endif
1519_GL_FUNCDECL_RPL (pthread_mutexattr_getrobust, int,
1520 (const pthread_mutexattr_t *restrict attr,
1521 int *restrict robustp),
1522 _GL_ARG_NONNULL ((1, 2)));
1523_GL_CXXALIAS_RPL (pthread_mutexattr_getrobust, int,
1524 (const pthread_mutexattr_t *restrict attr,
1525 int *restrict robustp));
1526# else
1527# if !1
1528_GL_FUNCDECL_SYS (pthread_mutexattr_getrobust, int,
1529 (const pthread_mutexattr_t *restrict attr,
1530 int *restrict robustp),
1531 _GL_ARG_NONNULL ((1, 2)));
1532# endif
1533/* Need to cast, because on FreeBSD the first parameter is
1534 pthread_mutexattr_t *attr. */
1535_GL_CXXALIAS_SYS_CAST (pthread_mutexattr_getrobust, int,
1536 (const pthread_mutexattr_t *restrict attr,
1537 int *restrict robustp));
1538# endif
1539# if __GLIBC__ >= 2
1540_GL_CXXALIASWARN (pthread_mutexattr_getrobust);
1541# endif
1542#elif defined GNULIB_POSIXCHECK
1543# if HAVE_RAW_DECL_PTHREAD_MUTEXATTR_GETROBUST
1544_GL_WARN_ON_USE (pthread_mutexattr_getrobust, "pthread_mutexattr_getrobust is not portable - "
1545 "use gnulib module pthread-mutex for portability");
1546# endif
1547#endif
1548
1549#if 0
1550# if 0
1551# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1552# undef pthread_mutexattr_setrobust
1553# define pthread_mutexattr_setrobust rpl_pthread_mutexattr_setrobust
1554# endif
1555_GL_FUNCDECL_RPL (pthread_mutexattr_setrobust, int,
1556 (pthread_mutexattr_t *attr, int robust),
1557 _GL_ARG_NONNULL ((1)));
1558_GL_CXXALIAS_RPL (pthread_mutexattr_setrobust, int,
1559 (pthread_mutexattr_t *attr, int robust));
1560# else
1561# if !1
1562_GL_FUNCDECL_SYS (pthread_mutexattr_setrobust, int,
1563 (pthread_mutexattr_t *attr, int robust),
1564 _GL_ARG_NONNULL ((1)));
1565# endif
1566_GL_CXXALIAS_SYS (pthread_mutexattr_setrobust, int,
1567 (pthread_mutexattr_t *attr, int robust));
1568# endif
1569# if __GLIBC__ >= 2
1570_GL_CXXALIASWARN (pthread_mutexattr_setrobust);
1571# endif
1572#elif defined GNULIB_POSIXCHECK
1573# if HAVE_RAW_DECL_PTHREAD_MUTEXATTR_SETROBUST
1574_GL_WARN_ON_USE (pthread_mutexattr_setrobust, "pthread_mutexattr_setrobust is not portable - "
1575 "use gnulib module pthread-mutex for portability");
1576# endif
1577#endif
1578
1579#if 0
1580# if 0
1581# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1582# undef pthread_mutexattr_destroy
1583# define pthread_mutexattr_destroy rpl_pthread_mutexattr_destroy
1584# endif
1585_GL_FUNCDECL_RPL (pthread_mutexattr_destroy, int, (pthread_mutexattr_t *attr),
1586 _GL_ARG_NONNULL ((1)));
1587_GL_CXXALIAS_RPL (pthread_mutexattr_destroy, int, (pthread_mutexattr_t *attr));
1588# else
1589# if !1
1590_GL_FUNCDECL_SYS (pthread_mutexattr_destroy, int, (pthread_mutexattr_t *attr),
1591 _GL_ARG_NONNULL ((1)));
1592# endif
1593_GL_CXXALIAS_SYS (pthread_mutexattr_destroy, int, (pthread_mutexattr_t *attr));
1594# endif
1595# if __GLIBC__ >= 2
1596_GL_CXXALIASWARN (pthread_mutexattr_destroy);
1597# endif
1598#elif defined GNULIB_POSIXCHECK
1599# if HAVE_RAW_DECL_PTHREAD_MUTEXATTR_DESTROY
1600_GL_WARN_ON_USE (pthread_mutexattr_destroy, "pthread_mutexattr_destroy is not portable - "
1601 "use gnulib module pthread-mutex for portability");
1602# endif
1603#endif
1604
1605#if 0
1606# if 0
1607# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1608# undef pthread_mutex_lock
1609# define pthread_mutex_lock rpl_pthread_mutex_lock
1610# endif
1611_GL_FUNCDECL_RPL (pthread_mutex_lock, int, (pthread_mutex_t *mutex),
1612 _GL_ARG_NONNULL ((1)));
1613_GL_CXXALIAS_RPL (pthread_mutex_lock, int, (pthread_mutex_t *mutex));
1614# else
1615# if !1
1616_GL_FUNCDECL_SYS (pthread_mutex_lock, int, (pthread_mutex_t *mutex),
1617 _GL_ARG_NONNULL ((1)));
1618# endif
1619_GL_CXXALIAS_SYS (pthread_mutex_lock, int, (pthread_mutex_t *mutex));
1620# endif
1621# if __GLIBC__ >= 2
1622_GL_CXXALIASWARN (pthread_mutex_lock);
1623# endif
1624#elif defined GNULIB_POSIXCHECK
1625# if HAVE_RAW_DECL_PTHREAD_MUTEX_LOCK
1626_GL_WARN_ON_USE (pthread_mutex_lock, "pthread_mutex_lock is not portable - "
1627 "use gnulib module pthread-mutex for portability");
1628# endif
1629#endif
1630
1631#if 0
1632# if 0
1633# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1634# undef pthread_mutex_trylock
1635# define pthread_mutex_trylock rpl_pthread_mutex_trylock
1636# endif
1637_GL_FUNCDECL_RPL (pthread_mutex_trylock, int, (pthread_mutex_t *mutex),
1638 _GL_ARG_NONNULL ((1)));
1639_GL_CXXALIAS_RPL (pthread_mutex_trylock, int, (pthread_mutex_t *mutex));
1640# else
1641# if !1
1642_GL_FUNCDECL_SYS (pthread_mutex_trylock, int, (pthread_mutex_t *mutex),
1643 _GL_ARG_NONNULL ((1)));
1644# endif
1645_GL_CXXALIAS_SYS (pthread_mutex_trylock, int, (pthread_mutex_t *mutex));
1646# endif
1647# if __GLIBC__ >= 2
1648_GL_CXXALIASWARN (pthread_mutex_trylock);
1649# endif
1650#elif defined GNULIB_POSIXCHECK
1651# if HAVE_RAW_DECL_PTHREAD_MUTEX_TRYLOCK
1652_GL_WARN_ON_USE (pthread_mutex_trylock, "pthread_mutex_trylock is not portable - "
1653 "use gnulib module pthread-mutex for portability");
1654# endif
1655#endif
1656
1657#if 0
1658# if 0
1659# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1660# undef pthread_mutex_timedlock
1661# define pthread_mutex_timedlock rpl_pthread_mutex_timedlock
1662# endif
1663_GL_FUNCDECL_RPL (pthread_mutex_timedlock, int,
1664 (pthread_mutex_t *restrict mutex,
1665 const struct timespec *restrict abstime),
1666 _GL_ARG_NONNULL ((1, 2)));
1667_GL_CXXALIAS_RPL (pthread_mutex_timedlock, int,
1668 (pthread_mutex_t *restrict mutex,
1669 const struct timespec *restrict abstime));
1670# else
1671# if !1
1672_GL_FUNCDECL_SYS (pthread_mutex_timedlock, int,
1673 (pthread_mutex_t *restrict mutex,
1674 const struct timespec *restrict abstime),
1675 _GL_ARG_NONNULL ((1, 2)));
1676# endif
1677_GL_CXXALIAS_SYS (pthread_mutex_timedlock, int,
1678 (pthread_mutex_t *restrict mutex,
1679 const struct timespec *restrict abstime));
1680# endif
1681# if __GLIBC__ >= 2
1682_GL_CXXALIASWARN (pthread_mutex_timedlock);
1683# endif
1684#elif defined GNULIB_POSIXCHECK
1685# if HAVE_RAW_DECL_PTHREAD_MUTEX_TIMEDLOCK
1686_GL_WARN_ON_USE (pthread_mutex_timedlock, "pthread_mutex_timedlock is not portable - "
1687 "use gnulib module pthread_mutex_timedlock for portability");
1688# endif
1689#endif
1690
1691#if 0
1692# if 0
1693# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1694# undef pthread_mutex_unlock
1695# define pthread_mutex_unlock rpl_pthread_mutex_unlock
1696# endif
1697_GL_FUNCDECL_RPL (pthread_mutex_unlock, int, (pthread_mutex_t *mutex),
1698 _GL_ARG_NONNULL ((1)));
1699_GL_CXXALIAS_RPL (pthread_mutex_unlock, int, (pthread_mutex_t *mutex));
1700# else
1701# if !1
1702_GL_FUNCDECL_SYS (pthread_mutex_unlock, int, (pthread_mutex_t *mutex),
1703 _GL_ARG_NONNULL ((1)));
1704# endif
1705_GL_CXXALIAS_SYS (pthread_mutex_unlock, int, (pthread_mutex_t *mutex));
1706# endif
1707# if __GLIBC__ >= 2
1708_GL_CXXALIASWARN (pthread_mutex_unlock);
1709# endif
1710#elif defined GNULIB_POSIXCHECK
1711# if HAVE_RAW_DECL_PTHREAD_MUTEX_UNLOCK
1712_GL_WARN_ON_USE (pthread_mutex_unlock, "pthread_mutex_unlock is not portable - "
1713 "use gnulib module pthread-mutex for portability");
1714# endif
1715#endif
1716
1717#if 0
1718# if 0
1719# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1720# undef pthread_mutex_destroy
1721# define pthread_mutex_destroy rpl_pthread_mutex_destroy
1722# endif
1723_GL_FUNCDECL_RPL (pthread_mutex_destroy, int, (pthread_mutex_t *mutex),
1724 _GL_ARG_NONNULL ((1)));
1725_GL_CXXALIAS_RPL (pthread_mutex_destroy, int, (pthread_mutex_t *mutex));
1726# else
1727# if !1
1728_GL_FUNCDECL_SYS (pthread_mutex_destroy, int, (pthread_mutex_t *mutex),
1729 _GL_ARG_NONNULL ((1)));
1730# endif
1731_GL_CXXALIAS_SYS (pthread_mutex_destroy, int, (pthread_mutex_t *mutex));
1732# endif
1733# if __GLIBC__ >= 2
1734_GL_CXXALIASWARN (pthread_mutex_destroy);
1735# endif
1736#elif defined GNULIB_POSIXCHECK
1737# if HAVE_RAW_DECL_PTHREAD_MUTEX_DESTROY
1738_GL_WARN_ON_USE (pthread_mutex_destroy, "pthread_mutex_destroy is not portable - "
1739 "use gnulib module pthread-mutex for portability");
1740# endif
1741#endif
1742
1743/* =========== Read-write lock functions =========== */
1744
1745#if 0
1746# if 0
1747# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1748# undef pthread_rwlock_init
1749# define pthread_rwlock_init rpl_pthread_rwlock_init
1750# endif
1751_GL_FUNCDECL_RPL (pthread_rwlock_init, int,
1752 (pthread_rwlock_t *restrict lock,
1753 const pthread_rwlockattr_t *restrict attr),
1754 _GL_ARG_NONNULL ((1)));
1755_GL_CXXALIAS_RPL (pthread_rwlock_init, int,
1756 (pthread_rwlock_t *restrict lock,
1757 const pthread_rwlockattr_t *restrict attr));
1758# else
1759# if !1
1760_GL_FUNCDECL_SYS (pthread_rwlock_init, int,
1761 (pthread_rwlock_t *restrict lock,
1762 const pthread_rwlockattr_t *restrict attr),
1763 _GL_ARG_NONNULL ((1)));
1764# endif
1765_GL_CXXALIAS_SYS (pthread_rwlock_init, int,
1766 (pthread_rwlock_t *restrict lock,
1767 const pthread_rwlockattr_t *restrict attr));
1768# endif
1769# if __GLIBC__ >= 2
1770_GL_CXXALIASWARN (pthread_rwlock_init);
1771# endif
1772#elif defined GNULIB_POSIXCHECK
1773# if HAVE_RAW_DECL_PTHREAD_RWLOCK_INIT
1774_GL_WARN_ON_USE (pthread_rwlock_init, "pthread_rwlock_init is not portable - "
1775 "use gnulib module pthread-rwlock for portability");
1776# endif
1777#endif
1778
1779#if 0
1780# if 0
1781# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1782# undef pthread_rwlockattr_init
1783# define pthread_rwlockattr_init rpl_pthread_rwlockattr_init
1784# endif
1785_GL_FUNCDECL_RPL (pthread_rwlockattr_init, int, (pthread_rwlockattr_t *attr),
1786 _GL_ARG_NONNULL ((1)));
1787_GL_CXXALIAS_RPL (pthread_rwlockattr_init, int, (pthread_rwlockattr_t *attr));
1788# else
1789# if !1
1790_GL_FUNCDECL_SYS (pthread_rwlockattr_init, int, (pthread_rwlockattr_t *attr),
1791 _GL_ARG_NONNULL ((1)));
1792# endif
1793_GL_CXXALIAS_SYS (pthread_rwlockattr_init, int, (pthread_rwlockattr_t *attr));
1794# endif
1795# if __GLIBC__ >= 2
1796_GL_CXXALIASWARN (pthread_rwlockattr_init);
1797# endif
1798#elif defined GNULIB_POSIXCHECK
1799# if HAVE_RAW_DECL_PTHREAD_RWLOCKATTR_INIT
1800_GL_WARN_ON_USE (pthread_rwlockattr_init, "pthread_rwlockattr_init is not portable - "
1801 "use gnulib module pthread-rwlock for portability");
1802# endif
1803#endif
1804
1805#if 0
1806# if 0
1807# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1808# undef pthread_rwlockattr_destroy
1809# define pthread_rwlockattr_destroy rpl_pthread_rwlockattr_destroy
1810# endif
1811_GL_FUNCDECL_RPL (pthread_rwlockattr_destroy, int,
1812 (pthread_rwlockattr_t *attr), _GL_ARG_NONNULL ((1)));
1813_GL_CXXALIAS_RPL (pthread_rwlockattr_destroy, int,
1814 (pthread_rwlockattr_t *attr));
1815# else
1816# if !1
1817_GL_FUNCDECL_SYS (pthread_rwlockattr_destroy, int,
1818 (pthread_rwlockattr_t *attr), _GL_ARG_NONNULL ((1)));
1819# endif
1820_GL_CXXALIAS_SYS (pthread_rwlockattr_destroy, int,
1821 (pthread_rwlockattr_t *attr));
1822# endif
1823# if __GLIBC__ >= 2
1824_GL_CXXALIASWARN (pthread_rwlockattr_destroy);
1825# endif
1826#elif defined GNULIB_POSIXCHECK
1827# if HAVE_RAW_DECL_PTHREAD_RWLOCKATTR_DESTROY
1828_GL_WARN_ON_USE (pthread_rwlockattr_destroy, "pthread_rwlockattr_destroy is not portable - "
1829 "use gnulib module pthread-rwlock for portability");
1830# endif
1831#endif
1832
1833#if 0
1834# if 0
1835# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1836# undef pthread_rwlock_rdlock
1837# define pthread_rwlock_rdlock rpl_pthread_rwlock_rdlock
1838# endif
1839_GL_FUNCDECL_RPL (pthread_rwlock_rdlock, int, (pthread_rwlock_t *lock),
1840 _GL_ARG_NONNULL ((1)));
1841_GL_CXXALIAS_RPL (pthread_rwlock_rdlock, int, (pthread_rwlock_t *lock));
1842# else
1843# if !1
1844_GL_FUNCDECL_SYS (pthread_rwlock_rdlock, int, (pthread_rwlock_t *lock),
1845 _GL_ARG_NONNULL ((1)));
1846# endif
1847_GL_CXXALIAS_SYS (pthread_rwlock_rdlock, int, (pthread_rwlock_t *lock));
1848# endif
1849# if __GLIBC__ >= 2
1850_GL_CXXALIASWARN (pthread_rwlock_rdlock);
1851# endif
1852#elif defined GNULIB_POSIXCHECK
1853# if HAVE_RAW_DECL_PTHREAD_RWLOCK_RDLOCK
1854_GL_WARN_ON_USE (pthread_rwlock_rdlock, "pthread_rwlock_rdlock is not portable - "
1855 "use gnulib module pthread-rwlock for portability");
1856# endif
1857#endif
1858
1859#if 0
1860# if 0
1861# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1862# undef pthread_rwlock_wrlock
1863# define pthread_rwlock_wrlock rpl_pthread_rwlock_wrlock
1864# endif
1865_GL_FUNCDECL_RPL (pthread_rwlock_wrlock, int, (pthread_rwlock_t *lock),
1866 _GL_ARG_NONNULL ((1)));
1867_GL_CXXALIAS_RPL (pthread_rwlock_wrlock, int, (pthread_rwlock_t *lock));
1868# else
1869# if !1
1870_GL_FUNCDECL_SYS (pthread_rwlock_wrlock, int, (pthread_rwlock_t *lock),
1871 _GL_ARG_NONNULL ((1)));
1872# endif
1873_GL_CXXALIAS_SYS (pthread_rwlock_wrlock, int, (pthread_rwlock_t *lock));
1874# endif
1875# if __GLIBC__ >= 2
1876_GL_CXXALIASWARN (pthread_rwlock_wrlock);
1877# endif
1878#elif defined GNULIB_POSIXCHECK
1879# if HAVE_RAW_DECL_PTHREAD_RWLOCK_WRLOCK
1880_GL_WARN_ON_USE (pthread_rwlock_wrlock, "pthread_rwlock_wrlock is not portable - "
1881 "use gnulib module pthread-rwlock for portability");
1882# endif
1883#endif
1884
1885#if 0
1886# if 0
1887# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1888# undef pthread_rwlock_tryrdlock
1889# define pthread_rwlock_tryrdlock rpl_pthread_rwlock_tryrdlock
1890# endif
1891_GL_FUNCDECL_RPL (pthread_rwlock_tryrdlock, int, (pthread_rwlock_t *lock),
1892 _GL_ARG_NONNULL ((1)));
1893_GL_CXXALIAS_RPL (pthread_rwlock_tryrdlock, int, (pthread_rwlock_t *lock));
1894# else
1895# if !1
1896_GL_FUNCDECL_SYS (pthread_rwlock_tryrdlock, int, (pthread_rwlock_t *lock),
1897 _GL_ARG_NONNULL ((1)));
1898# endif
1899_GL_CXXALIAS_SYS (pthread_rwlock_tryrdlock, int, (pthread_rwlock_t *lock));
1900# endif
1901# if __GLIBC__ >= 2
1902_GL_CXXALIASWARN (pthread_rwlock_tryrdlock);
1903# endif
1904#elif defined GNULIB_POSIXCHECK
1905# if HAVE_RAW_DECL_PTHREAD_RWLOCK_TRYRDLOCK
1906_GL_WARN_ON_USE (pthread_rwlock_tryrdlock, "pthread_rwlock_tryrdlock is not portable - "
1907 "use gnulib module pthread-rwlock for portability");
1908# endif
1909#endif
1910
1911#if 0
1912# if 0
1913# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1914# undef pthread_rwlock_trywrlock
1915# define pthread_rwlock_trywrlock rpl_pthread_rwlock_trywrlock
1916# endif
1917_GL_FUNCDECL_RPL (pthread_rwlock_trywrlock, int, (pthread_rwlock_t *lock),
1918 _GL_ARG_NONNULL ((1)));
1919_GL_CXXALIAS_RPL (pthread_rwlock_trywrlock, int, (pthread_rwlock_t *lock));
1920# else
1921# if !1
1922_GL_FUNCDECL_SYS (pthread_rwlock_trywrlock, int, (pthread_rwlock_t *lock),
1923 _GL_ARG_NONNULL ((1)));
1924# endif
1925_GL_CXXALIAS_SYS (pthread_rwlock_trywrlock, int, (pthread_rwlock_t *lock));
1926# endif
1927# if __GLIBC__ >= 2
1928_GL_CXXALIASWARN (pthread_rwlock_trywrlock);
1929# endif
1930#elif defined GNULIB_POSIXCHECK
1931# if HAVE_RAW_DECL_PTHREAD_RWLOCK_TRYWRLOCK
1932_GL_WARN_ON_USE (pthread_rwlock_trywrlock, "pthread_rwlock_trywrlock is not portable - "
1933 "use gnulib module pthread-rwlock for portability");
1934# endif
1935#endif
1936
1937#if 0
1938# if 0
1939# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1940# undef pthread_rwlock_timedrdlock
1941# define pthread_rwlock_timedrdlock rpl_pthread_rwlock_timedrdlock
1942# endif
1943_GL_FUNCDECL_RPL (pthread_rwlock_timedrdlock, int,
1944 (pthread_rwlock_t *restrict lock,
1945 const struct timespec *restrict abstime),
1946 _GL_ARG_NONNULL ((1, 2)));
1947_GL_CXXALIAS_RPL (pthread_rwlock_timedrdlock, int,
1948 (pthread_rwlock_t *restrict lock,
1949 const struct timespec *restrict abstime));
1950# else
1951# if !1
1952_GL_FUNCDECL_SYS (pthread_rwlock_timedrdlock, int,
1953 (pthread_rwlock_t *restrict lock,
1954 const struct timespec *restrict abstime),
1955 _GL_ARG_NONNULL ((1, 2)));
1956# endif
1957_GL_CXXALIAS_SYS (pthread_rwlock_timedrdlock, int,
1958 (pthread_rwlock_t *restrict lock,
1959 const struct timespec *restrict abstime));
1960# endif
1961# if __GLIBC__ >= 2
1962_GL_CXXALIASWARN (pthread_rwlock_timedrdlock);
1963# endif
1964#elif defined GNULIB_POSIXCHECK
1965# if HAVE_RAW_DECL_PTHREAD_RWLOCK_TIMEDRDLOCK
1966_GL_WARN_ON_USE (pthread_rwlock_timedrdlock, "pthread_rwlock_timedrdlock is not portable - "
1967 "use gnulib module pthread-rwlock for portability");
1968# endif
1969#endif
1970
1971#if 0
1972# if 0
1973# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1974# undef pthread_rwlock_timedwrlock
1975# define pthread_rwlock_timedwrlock rpl_pthread_rwlock_timedwrlock
1976# endif
1977_GL_FUNCDECL_RPL (pthread_rwlock_timedwrlock, int,
1978 (pthread_rwlock_t *restrict lock,
1979 const struct timespec *restrict abstime),
1980 _GL_ARG_NONNULL ((1, 2)));
1981_GL_CXXALIAS_RPL (pthread_rwlock_timedwrlock, int,
1982 (pthread_rwlock_t *restrict lock,
1983 const struct timespec *restrict abstime));
1984# else
1985# if !1
1986_GL_FUNCDECL_SYS (pthread_rwlock_timedwrlock, int,
1987 (pthread_rwlock_t *restrict lock,
1988 const struct timespec *restrict abstime),
1989 _GL_ARG_NONNULL ((1, 2)));
1990# endif
1991_GL_CXXALIAS_SYS (pthread_rwlock_timedwrlock, int,
1992 (pthread_rwlock_t *restrict lock,
1993 const struct timespec *restrict abstime));
1994# endif
1995# if __GLIBC__ >= 2
1996_GL_CXXALIASWARN (pthread_rwlock_timedwrlock);
1997# endif
1998#elif defined GNULIB_POSIXCHECK
1999# if HAVE_RAW_DECL_PTHREAD_RWLOCK_TIMEDWRLOCK
2000_GL_WARN_ON_USE (pthread_rwlock_timedwrlock, "pthread_rwlock_timedwrlock is not portable - "
2001 "use gnulib module pthread-rwlock for portability");
2002# endif
2003#endif
2004
2005#if 0
2006# if 0
2007# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
2008# undef pthread_rwlock_unlock
2009# define pthread_rwlock_unlock rpl_pthread_rwlock_unlock
2010# endif
2011_GL_FUNCDECL_RPL (pthread_rwlock_unlock, int, (pthread_rwlock_t *lock),
2012 _GL_ARG_NONNULL ((1)));
2013_GL_CXXALIAS_RPL (pthread_rwlock_unlock, int, (pthread_rwlock_t *lock));
2014# else
2015# if !1
2016_GL_FUNCDECL_SYS (pthread_rwlock_unlock, int, (pthread_rwlock_t *lock),
2017 _GL_ARG_NONNULL ((1)));
2018# endif
2019_GL_CXXALIAS_SYS (pthread_rwlock_unlock, int, (pthread_rwlock_t *lock));
2020# endif
2021# if __GLIBC__ >= 2
2022_GL_CXXALIASWARN (pthread_rwlock_unlock);
2023# endif
2024#elif defined GNULIB_POSIXCHECK
2025# if HAVE_RAW_DECL_PTHREAD_RWLOCK_UNLOCK
2026_GL_WARN_ON_USE (pthread_rwlock_unlock, "pthread_rwlock_unlock is not portable - "
2027 "use gnulib module pthread-rwlock for portability");
2028# endif
2029#endif
2030
2031#if 0
2032# if 0
2033# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
2034# undef pthread_rwlock_destroy
2035# define pthread_rwlock_destroy rpl_pthread_rwlock_destroy
2036# endif
2037_GL_FUNCDECL_RPL (pthread_rwlock_destroy, int, (pthread_rwlock_t *lock),
2038 _GL_ARG_NONNULL ((1)));
2039_GL_CXXALIAS_RPL (pthread_rwlock_destroy, int, (pthread_rwlock_t *lock));
2040# else
2041# if !1
2042_GL_FUNCDECL_SYS (pthread_rwlock_destroy, int, (pthread_rwlock_t *lock),
2043 _GL_ARG_NONNULL ((1)));
2044# endif
2045_GL_CXXALIAS_SYS (pthread_rwlock_destroy, int, (pthread_rwlock_t *lock));
2046# endif
2047# if __GLIBC__ >= 2
2048_GL_CXXALIASWARN (pthread_rwlock_destroy);
2049# endif
2050#elif defined GNULIB_POSIXCHECK
2051# if HAVE_RAW_DECL_PTHREAD_RWLOCK_DESTROY
2052_GL_WARN_ON_USE (pthread_rwlock_destroy, "pthread_rwlock_destroy is not portable - "
2053 "use gnulib module pthread-rwlock for portability");
2054# endif
2055#endif
2056
2057/* =========== Condition variable functions =========== */
2058
2059#if 0
2060# if 0
2061# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
2062# undef pthread_cond_init
2063# define pthread_cond_init rpl_pthread_cond_init
2064# endif
2065_GL_FUNCDECL_RPL (pthread_cond_init, int,
2066 (pthread_cond_t *restrict cond,
2067 const pthread_condattr_t *restrict attr),
2068 _GL_ARG_NONNULL ((1)));
2069_GL_CXXALIAS_RPL (pthread_cond_init, int,
2070 (pthread_cond_t *restrict cond,
2071 const pthread_condattr_t *restrict attr));
2072# else
2073# if !1
2074_GL_FUNCDECL_SYS (pthread_cond_init, int,
2075 (pthread_cond_t *restrict cond,
2076 const pthread_condattr_t *restrict attr),
2077 _GL_ARG_NONNULL ((1)));
2078# endif
2079_GL_CXXALIAS_SYS (pthread_cond_init, int,
2080 (pthread_cond_t *restrict cond,
2081 const pthread_condattr_t *restrict attr));
2082# endif
2083# if __GLIBC__ >= 2
2084_GL_CXXALIASWARN (pthread_cond_init);
2085# endif
2086#elif defined GNULIB_POSIXCHECK
2087# if HAVE_RAW_DECL_PTHREAD_COND_INIT
2088_GL_WARN_ON_USE (pthread_cond_init, "pthread_cond_init is not portable - "
2089 "use gnulib module pthread-cond for portability");
2090# endif
2091#endif
2092
2093#if 0
2094# if 0
2095# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
2096# undef pthread_condattr_init
2097# define pthread_condattr_init rpl_pthread_condattr_init
2098# endif
2099_GL_FUNCDECL_RPL (pthread_condattr_init, int, (pthread_condattr_t *attr),
2100 _GL_ARG_NONNULL ((1)));
2101_GL_CXXALIAS_RPL (pthread_condattr_init, int, (pthread_condattr_t *attr));
2102# else
2103# if !1
2104_GL_FUNCDECL_SYS (pthread_condattr_init, int, (pthread_condattr_t *attr),
2105 _GL_ARG_NONNULL ((1)));
2106# endif
2107_GL_CXXALIAS_SYS (pthread_condattr_init, int, (pthread_condattr_t *attr));
2108# endif
2109# if __GLIBC__ >= 2
2110_GL_CXXALIASWARN (pthread_condattr_init);
2111# endif
2112#elif defined GNULIB_POSIXCHECK
2113# if HAVE_RAW_DECL_PTHREAD_CONDATTR_INIT
2114_GL_WARN_ON_USE (pthread_condattr_init, "pthread_condattr_init is not portable - "
2115 "use gnulib module pthread-cond for portability");
2116# endif
2117#endif
2118
2119#if 0
2120# if 0
2121# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
2122# undef pthread_condattr_destroy
2123# define pthread_condattr_destroy rpl_pthread_condattr_destroy
2124# endif
2125_GL_FUNCDECL_RPL (pthread_condattr_destroy, int, (pthread_condattr_t *attr),
2126 _GL_ARG_NONNULL ((1)));
2127_GL_CXXALIAS_RPL (pthread_condattr_destroy, int, (pthread_condattr_t *attr));
2128# else
2129# if !1
2130_GL_FUNCDECL_SYS (pthread_condattr_destroy, int, (pthread_condattr_t *attr),
2131 _GL_ARG_NONNULL ((1)));
2132# endif
2133_GL_CXXALIAS_SYS (pthread_condattr_destroy, int, (pthread_condattr_t *attr));
2134# endif
2135# if __GLIBC__ >= 2
2136_GL_CXXALIASWARN (pthread_condattr_destroy);
2137# endif
2138#elif defined GNULIB_POSIXCHECK
2139# if HAVE_RAW_DECL_PTHREAD_CONDATTR_DESTROY
2140_GL_WARN_ON_USE (pthread_condattr_destroy, "pthread_condattr_destroy is not portable - "
2141 "use gnulib module pthread-cond for portability");
2142# endif
2143#endif
2144
2145#if 0
2146# if 0
2147# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
2148# undef pthread_cond_wait
2149# define pthread_cond_wait rpl_pthread_cond_wait
2150# endif
2151_GL_FUNCDECL_RPL (pthread_cond_wait, int,
2152 (pthread_cond_t *restrict cond,
2153 pthread_mutex_t *restrict mutex),
2154 _GL_ARG_NONNULL ((1, 2)));
2155_GL_CXXALIAS_RPL (pthread_cond_wait, int,
2156 (pthread_cond_t *restrict cond,
2157 pthread_mutex_t *restrict mutex));
2158# else
2159# if !1
2160_GL_FUNCDECL_SYS (pthread_cond_wait, int,
2161 (pthread_cond_t *restrict cond,
2162 pthread_mutex_t *restrict mutex),
2163 _GL_ARG_NONNULL ((1, 2)));
2164# endif
2165_GL_CXXALIAS_SYS (pthread_cond_wait, int,
2166 (pthread_cond_t *restrict cond,
2167 pthread_mutex_t *restrict mutex));
2168# endif
2169# if __GLIBC__ >= 2
2170_GL_CXXALIASWARN (pthread_cond_wait);
2171# endif
2172#elif defined GNULIB_POSIXCHECK
2173# if HAVE_RAW_DECL_PTHREAD_COND_WAIT
2174_GL_WARN_ON_USE (pthread_cond_wait, "pthread_cond_wait is not portable - "
2175 "use gnulib module pthread-cond for portability");
2176# endif
2177#endif
2178
2179#if 0
2180# if 0
2181# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
2182# undef pthread_cond_timedwait
2183# define pthread_cond_timedwait rpl_pthread_cond_timedwait
2184# endif
2185_GL_FUNCDECL_RPL (pthread_cond_timedwait, int,
2186 (pthread_cond_t *restrict cond,
2187 pthread_mutex_t *restrict mutex,
2188 const struct timespec *restrict abstime),
2189 _GL_ARG_NONNULL ((1, 2, 3)));
2190_GL_CXXALIAS_RPL (pthread_cond_timedwait, int,
2191 (pthread_cond_t *restrict cond,
2192 pthread_mutex_t *restrict mutex,
2193 const struct timespec *restrict abstime));
2194# else
2195# if !1
2196_GL_FUNCDECL_SYS (pthread_cond_timedwait, int,
2197 (pthread_cond_t *restrict cond,
2198 pthread_mutex_t *restrict mutex,
2199 const struct timespec *restrict abstime),
2200 _GL_ARG_NONNULL ((1, 2, 3)));
2201# endif
2202_GL_CXXALIAS_SYS (pthread_cond_timedwait, int,
2203 (pthread_cond_t *restrict cond,
2204 pthread_mutex_t *restrict mutex,
2205 const struct timespec *restrict abstime));
2206# endif
2207# if __GLIBC__ >= 2
2208_GL_CXXALIASWARN (pthread_cond_timedwait);
2209# endif
2210#elif defined GNULIB_POSIXCHECK
2211# if HAVE_RAW_DECL_PTHREAD_COND_TIMEDWAIT
2212_GL_WARN_ON_USE (pthread_cond_timedwait, "pthread_cond_timedwait is not portable - "
2213 "use gnulib module pthread-cond for portability");
2214# endif
2215#endif
2216
2217#if 0
2218# if 0
2219# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
2220# undef pthread_cond_signal
2221# define pthread_cond_signal rpl_pthread_cond_signal
2222# endif
2223_GL_FUNCDECL_RPL (pthread_cond_signal, int, (pthread_cond_t *cond),
2224 _GL_ARG_NONNULL ((1)));
2225_GL_CXXALIAS_RPL (pthread_cond_signal, int, (pthread_cond_t *cond));
2226# else
2227# if !1
2228_GL_FUNCDECL_SYS (pthread_cond_signal, int, (pthread_cond_t *cond),
2229 _GL_ARG_NONNULL ((1)));
2230# endif
2231_GL_CXXALIAS_SYS (pthread_cond_signal, int, (pthread_cond_t *cond));
2232# endif
2233# if __GLIBC__ >= 2
2234_GL_CXXALIASWARN (pthread_cond_signal);
2235# endif
2236#elif defined GNULIB_POSIXCHECK
2237# if HAVE_RAW_DECL_PTHREAD_COND_SIGNAL
2238_GL_WARN_ON_USE (pthread_cond_signal, "pthread_cond_signal is not portable - "
2239 "use gnulib module pthread-cond for portability");
2240# endif
2241#endif
2242
2243#if 0
2244# if 0
2245# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
2246# undef pthread_cond_broadcast
2247# define pthread_cond_broadcast rpl_pthread_cond_broadcast
2248# endif
2249_GL_FUNCDECL_RPL (pthread_cond_broadcast, int, (pthread_cond_t *cond),
2250 _GL_ARG_NONNULL ((1)));
2251_GL_CXXALIAS_RPL (pthread_cond_broadcast, int, (pthread_cond_t *cond));
2252# else
2253# if !1
2254_GL_FUNCDECL_SYS (pthread_cond_broadcast, int, (pthread_cond_t *cond),
2255 _GL_ARG_NONNULL ((1)));
2256# endif
2257_GL_CXXALIAS_SYS (pthread_cond_broadcast, int, (pthread_cond_t *cond));
2258# endif
2259# if __GLIBC__ >= 2
2260_GL_CXXALIASWARN (pthread_cond_broadcast);
2261# endif
2262#elif defined GNULIB_POSIXCHECK
2263# if HAVE_RAW_DECL_PTHREAD_COND_BROADCAST
2264_GL_WARN_ON_USE (pthread_cond_broadcast, "pthread_cond_broadcast is not portable - "
2265 "use gnulib module pthread-cond for portability");
2266# endif
2267#endif
2268
2269#if 0
2270# if 0
2271# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
2272# undef pthread_cond_destroy
2273# define pthread_cond_destroy rpl_pthread_cond_destroy
2274# endif
2275_GL_FUNCDECL_RPL (pthread_cond_destroy, int, (pthread_cond_t *cond),
2276 _GL_ARG_NONNULL ((1)));
2277_GL_CXXALIAS_RPL (pthread_cond_destroy, int, (pthread_cond_t *cond));
2278# else
2279# if !1
2280_GL_FUNCDECL_SYS (pthread_cond_destroy, int, (pthread_cond_t *cond),
2281 _GL_ARG_NONNULL ((1)));
2282# endif
2283_GL_CXXALIAS_SYS (pthread_cond_destroy, int, (pthread_cond_t *cond));
2284# endif
2285# if __GLIBC__ >= 2
2286_GL_CXXALIASWARN (pthread_cond_destroy);
2287# endif
2288#elif defined GNULIB_POSIXCHECK
2289# if HAVE_RAW_DECL_PTHREAD_COND_DESTROY
2290_GL_WARN_ON_USE (pthread_cond_destroy, "pthread_cond_destroy is not portable - "
2291 "use gnulib module pthread-cond for portability");
2292# endif
2293#endif
2294
2295/* =========== Thread-specific storage functions =========== */
2296
2297#if 0
2298# if 0
2299# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
2300# undef pthread_key_create
2301# define pthread_key_create rpl_pthread_key_create
2302# endif
2303_GL_FUNCDECL_RPL (pthread_key_create, int,
2304 (pthread_key_t *keyp, void (*destructor) (void *)),
2305 _GL_ARG_NONNULL ((1)));
2306_GL_CXXALIAS_RPL (pthread_key_create, int,
2307 (pthread_key_t *keyp, void (*destructor) (void *)));
2308# else
2309# if !1
2310_GL_FUNCDECL_SYS (pthread_key_create, int,
2311 (pthread_key_t *keyp, void (*destructor) (void *)),
2312 _GL_ARG_NONNULL ((1)));
2313# endif
2314_GL_CXXALIAS_SYS_CAST (pthread_key_create, int,
2315 (pthread_key_t *keyp, void (*destructor) (void *)));
2316# endif
2317# if __GLIBC__ >= 2
2318_GL_CXXALIASWARN (pthread_key_create);
2319# endif
2320#elif defined GNULIB_POSIXCHECK
2321# if HAVE_RAW_DECL_PTHREAD_KEY_CREATE
2322_GL_WARN_ON_USE (pthread_key_create, "pthread_key_create is not portable - "
2323 "use gnulib module pthread-tss for portability");
2324# endif
2325#endif
2326
2327#if 0
2328# if 0
2329# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
2330# undef pthread_setspecific
2331# define pthread_setspecific rpl_pthread_setspecific
2332# endif
2333_GL_FUNCDECL_RPL (pthread_setspecific, int,
2334 (pthread_key_t key, const void *value), );
2335_GL_CXXALIAS_RPL (pthread_setspecific, int,
2336 (pthread_key_t key, const void *value));
2337# else
2338# if !1
2339_GL_FUNCDECL_SYS (pthread_setspecific, int,
2340 (pthread_key_t key, const void *value), );
2341# endif
2342_GL_CXXALIAS_SYS (pthread_setspecific, int,
2343 (pthread_key_t key, const void *value));
2344# endif
2345# if __GLIBC__ >= 2
2346_GL_CXXALIASWARN (pthread_setspecific);
2347# endif
2348#elif defined GNULIB_POSIXCHECK
2349# if HAVE_RAW_DECL_PTHREAD_SETSPECIFIC
2350_GL_WARN_ON_USE (pthread_setspecific, "pthread_setspecific is not portable - "
2351 "use gnulib module pthread-tss for portability");
2352# endif
2353#endif
2354
2355#if 0
2356# if 0
2357# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
2358# undef pthread_getspecific
2359# define pthread_getspecific rpl_pthread_getspecific
2360# endif
2361_GL_FUNCDECL_RPL (pthread_getspecific, void *, (pthread_key_t key), );
2362_GL_CXXALIAS_RPL (pthread_getspecific, void *, (pthread_key_t key));
2363# else
2364# if !1
2365_GL_FUNCDECL_SYS (pthread_getspecific, void *, (pthread_key_t key), );
2366# endif
2367_GL_CXXALIAS_SYS (pthread_getspecific, void *, (pthread_key_t key));
2368# endif
2369# if __GLIBC__ >= 2
2370_GL_CXXALIASWARN (pthread_getspecific);
2371# endif
2372#elif defined GNULIB_POSIXCHECK
2373# if HAVE_RAW_DECL_PTHREAD_GETSPECIFIC
2374_GL_WARN_ON_USE (pthread_getspecific, "pthread_getspecific is not portable - "
2375 "use gnulib module pthread-tss for portability");
2376# endif
2377#endif
2378
2379#if 0
2380# if 0
2381# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
2382# undef pthread_key_delete
2383# define pthread_key_delete rpl_pthread_key_delete
2384# endif
2385_GL_FUNCDECL_RPL (pthread_key_delete, int, (pthread_key_t key), );
2386_GL_CXXALIAS_RPL (pthread_key_delete, int, (pthread_key_t key));
2387# else
2388# if !1
2389_GL_FUNCDECL_SYS (pthread_key_delete, int, (pthread_key_t key), );
2390# endif
2391_GL_CXXALIAS_SYS (pthread_key_delete, int, (pthread_key_t key));
2392# endif
2393# if __GLIBC__ >= 2
2394_GL_CXXALIASWARN (pthread_key_delete);
2395# endif
2396#elif defined GNULIB_POSIXCHECK
2397# if HAVE_RAW_DECL_PTHREAD_KEY_DELETE
2398_GL_WARN_ON_USE (pthread_key_delete, "pthread_key_delete is not portable - "
2399 "use gnulib module pthread-tss for portability");
2400# endif
2401#endif
2402
2403/* =========== Spinlock functions =========== */
2404
2405#if 0
2406# if 0
2407# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
2408# undef pthread_spin_init
2409# define pthread_spin_init rpl_pthread_spin_init
2410# endif
2411_GL_FUNCDECL_RPL (pthread_spin_init, int,
2412 (pthread_spinlock_t *lock, int shared_across_processes),
2413 _GL_ARG_NONNULL ((1)));
2414_GL_CXXALIAS_RPL (pthread_spin_init, int,
2415 (pthread_spinlock_t *lock, int shared_across_processes));
2416# else
2417# if !1
2418_GL_FUNCDECL_SYS (pthread_spin_init, int,
2419 (pthread_spinlock_t *lock, int shared_across_processes),
2420 _GL_ARG_NONNULL ((1)));
2421# endif
2422_GL_CXXALIAS_SYS (pthread_spin_init, int,
2423 (pthread_spinlock_t *lock, int shared_across_processes));
2424# endif
2425# if __GLIBC__ >= 2
2426_GL_CXXALIASWARN (pthread_spin_init);
2427# endif
2428#elif defined GNULIB_POSIXCHECK
2429# if HAVE_RAW_DECL_PTHREAD_SPIN_INIT
2430_GL_WARN_ON_USE (pthread_spin_init, "pthread_spin_init is not portable - "
2431 "use gnulib module pthread-spin for portability");
2432# endif
2433#endif
2434
2435#if 0
2436# if 0
2437# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
2438# undef pthread_spin_lock
2439# define pthread_spin_lock rpl_pthread_spin_lock
2440# endif
2441_GL_FUNCDECL_RPL (pthread_spin_lock, int, (pthread_spinlock_t *lock),
2442 _GL_ARG_NONNULL ((1)));
2443_GL_CXXALIAS_RPL (pthread_spin_lock, int, (pthread_spinlock_t *lock));
2444# else
2445# if !1
2446_GL_FUNCDECL_SYS (pthread_spin_lock, int, (pthread_spinlock_t *lock),
2447 _GL_ARG_NONNULL ((1)));
2448# endif
2449_GL_CXXALIAS_SYS (pthread_spin_lock, int, (pthread_spinlock_t *lock));
2450# endif
2451# if __GLIBC__ >= 2
2452_GL_CXXALIASWARN (pthread_spin_lock);
2453# endif
2454#elif defined GNULIB_POSIXCHECK
2455# if HAVE_RAW_DECL_PTHREAD_SPIN_LOCK
2456_GL_WARN_ON_USE (pthread_spin_lock, "pthread_spin_lock is not portable - "
2457 "use gnulib module pthread-spin for portability");
2458# endif
2459#endif
2460
2461#if 0
2462# if 0
2463# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
2464# undef pthread_spin_trylock
2465# define pthread_spin_trylock rpl_pthread_spin_trylock
2466# endif
2467_GL_FUNCDECL_RPL (pthread_spin_trylock, int, (pthread_spinlock_t *lock),
2468 _GL_ARG_NONNULL ((1)));
2469_GL_CXXALIAS_RPL (pthread_spin_trylock, int, (pthread_spinlock_t *lock));
2470# else
2471# if !1
2472_GL_FUNCDECL_SYS (pthread_spin_trylock, int, (pthread_spinlock_t *lock),
2473 _GL_ARG_NONNULL ((1)));
2474# endif
2475_GL_CXXALIAS_SYS (pthread_spin_trylock, int, (pthread_spinlock_t *lock));
2476# endif
2477# if __GLIBC__ >= 2
2478_GL_CXXALIASWARN (pthread_spin_trylock);
2479# endif
2480#elif defined GNULIB_POSIXCHECK
2481# if HAVE_RAW_DECL_PTHREAD_SPIN_TRYLOCK
2482_GL_WARN_ON_USE (pthread_spin_trylock, "pthread_spin_trylock is not portable - "
2483 "use gnulib module pthread-spin for portability");
2484# endif
2485#endif
2486
2487#if 0
2488# if 0
2489# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
2490# undef pthread_spin_unlock
2491# define pthread_spin_unlock rpl_pthread_spin_unlock
2492# endif
2493_GL_FUNCDECL_RPL (pthread_spin_unlock, int, (pthread_spinlock_t *lock),
2494 _GL_ARG_NONNULL ((1)));
2495_GL_CXXALIAS_RPL (pthread_spin_unlock, int, (pthread_spinlock_t *lock));
2496# else
2497# if !1
2498_GL_FUNCDECL_SYS (pthread_spin_unlock, int, (pthread_spinlock_t *lock),
2499 _GL_ARG_NONNULL ((1)));
2500# endif
2501_GL_CXXALIAS_SYS (pthread_spin_unlock, int, (pthread_spinlock_t *lock));
2502# endif
2503# if __GLIBC__ >= 2
2504_GL_CXXALIASWARN (pthread_spin_unlock);
2505# endif
2506#elif defined GNULIB_POSIXCHECK
2507# if HAVE_RAW_DECL_PTHREAD_SPIN_UNLOCK
2508_GL_WARN_ON_USE (pthread_spin_unlock, "pthread_spin_unlock is not portable - "
2509 "use gnulib module pthread-spin for portability");
2510# endif
2511#endif
2512
2513#if 0
2514# if 0
2515# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
2516# undef pthread_spin_destroy
2517# define pthread_spin_destroy rpl_pthread_spin_destroy
2518# endif
2519_GL_FUNCDECL_RPL (pthread_spin_destroy, int, (pthread_spinlock_t *lock),
2520 _GL_ARG_NONNULL ((1)));
2521_GL_CXXALIAS_RPL (pthread_spin_destroy, int, (pthread_spinlock_t *lock));
2522# else
2523# if !1
2524_GL_FUNCDECL_SYS (pthread_spin_destroy, int, (pthread_spinlock_t *lock),
2525 _GL_ARG_NONNULL ((1)));
2526# endif
2527_GL_CXXALIAS_SYS (pthread_spin_destroy, int, (pthread_spinlock_t *lock));
2528# endif
2529# if __GLIBC__ >= 2
2530_GL_CXXALIASWARN (pthread_spin_destroy);
2531# endif
2532#elif defined GNULIB_POSIXCHECK
2533# if HAVE_RAW_DECL_PTHREAD_SPIN_DESTROY
2534_GL_WARN_ON_USE (pthread_spin_destroy, "pthread_spin_destroy is not portable - "
2535 "use gnulib module pthread-spin for portability");
2536# endif
2537#endif
2538
2539
2540#if defined __cplusplus && defined GNULIB_NAMESPACE && !1 && defined __MINGW32__
2541/* Provide the symbols required by mingw's <bits/gthr-default.h>. */
2542using GNULIB_NAMESPACE::pthread_create;
2543using GNULIB_NAMESPACE::pthread_self;
2544using GNULIB_NAMESPACE::pthread_equal;
2545using GNULIB_NAMESPACE::pthread_detach;
2546using GNULIB_NAMESPACE::pthread_join;
2547using GNULIB_NAMESPACE::pthread_once;
2548using GNULIB_NAMESPACE::pthread_mutex_init;
2549using GNULIB_NAMESPACE::pthread_mutexattr_init;
2550using GNULIB_NAMESPACE::pthread_mutexattr_settype;
2551using GNULIB_NAMESPACE::pthread_mutexattr_destroy;
2552using GNULIB_NAMESPACE::pthread_mutex_lock;
2553using GNULIB_NAMESPACE::pthread_mutex_trylock;
2554using GNULIB_NAMESPACE::pthread_mutex_timedlock;
2555using GNULIB_NAMESPACE::pthread_mutex_unlock;
2556using GNULIB_NAMESPACE::pthread_mutex_destroy;
2557using GNULIB_NAMESPACE::pthread_cond_wait;
2558using GNULIB_NAMESPACE::pthread_cond_timedwait;
2559using GNULIB_NAMESPACE::pthread_cond_signal;
2560using GNULIB_NAMESPACE::pthread_cond_broadcast;
2561using GNULIB_NAMESPACE::pthread_cond_destroy;
2562using GNULIB_NAMESPACE::pthread_key_create;
2563using GNULIB_NAMESPACE::pthread_setspecific;
2564using GNULIB_NAMESPACE::pthread_getspecific;
2565using GNULIB_NAMESPACE::pthread_key_delete;
2566#endif
2567
2568
2569#endif /* _GL_PTHREAD_H_ */
2570#endif /* _GL_PTHREAD_H_ */
2571#endif