(root)/
m4-1.4.19/
tests/
pthread.in.h
       1  /* Implement the most essential subset of POSIX 1003.1-2008 pthread.h.
       2  
       3     Copyright (C) 2009-2021 Free Software Foundation, Inc.
       4  
       5     This program is free software; you can redistribute it and/or modify
       6     it under the terms of the GNU General Public License as published by
       7     the Free Software Foundation; either version 3, or (at your option)
       8     any later version.
       9  
      10     This program is distributed in the hope that it will be useful,
      11     but WITHOUT ANY WARRANTY; without even the implied warranty of
      12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      13     GNU General Public License for more details.
      14  
      15     You should have received a copy of the GNU General Public License
      16     along with this program; if not, see <https://www.gnu.org/licenses/>.  */
      17  
      18  /* Written by Paul Eggert, Glen Lenker, and Bruno Haible.  */
      19  
      20  #if __GNUC__ >= 3
      21  @PRAGMA_SYSTEM_HEADER@
      22  #endif
      23  @PRAGMA_COLUMNS@
      24  
      25  #if defined _GL_ALREADY_INCLUDING_PTHREAD_H
      26  /* Special invocation convention:
      27     On Android, we have a sequence of nested includes
      28     <pthread.h> -> <time.h> -> <sys/time.h> -> <sys/select.h> ->
      29     <signal.h> -> <pthread.h>.
      30     In this situation, PTHREAD_COND_INITIALIZER is not yet defined,
      31     therefore we should not attempt to define PTHREAD_MUTEX_NORMAL etc.  */
      32  
      33  #@INCLUDE_NEXT@ @NEXT_PTHREAD_H@
      34  
      35  #else
      36  /* Normal invocation convention.  */
      37  
      38  #ifndef _@GUARD_PREFIX@_PTHREAD_H_
      39  
      40  #if @HAVE_PTHREAD_H@
      41  
      42  # define _GL_ALREADY_INCLUDING_PTHREAD_H
      43  
      44  /* The include_next requires a split double-inclusion guard.  */
      45  # @INCLUDE_NEXT@ @NEXT_PTHREAD_H@
      46  
      47  # undef _GL_ALREADY_INCLUDING_PTHREAD_H
      48  
      49  #endif
      50  
      51  #ifndef _@GUARD_PREFIX@_PTHREAD_H_
      52  #define _@GUARD_PREFIX@_PTHREAD_H_
      53  
      54  #define __need_system_stdlib_h
      55  #include <stdlib.h>
      56  #undef __need_system_stdlib_h
      57  
      58  
      59  /* The pthreads-win32 <pthread.h> defines a couple of broken macros.  */
      60  #undef asctime_r
      61  #undef ctime_r
      62  #undef gmtime_r
      63  #undef localtime_r
      64  #undef rand_r
      65  #undef strtok_r
      66  
      67  #include <errno.h>
      68  #include <sched.h>
      69  #include <sys/types.h>
      70  #include <time.h>
      71  
      72  /* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
      73  
      74  /* The definition of _Noreturn is copied here.  */
      75  
      76  /* The definition of _GL_ARG_NONNULL is copied here.  */
      77  
      78  /* The definition of _GL_WARN_ON_USE is copied here.  */
      79  
      80  /* =========== Thread types and macros =========== */
      81  
      82  #if (defined _WIN32 && ! defined __CYGWIN__) && USE_WINDOWS_THREADS
      83  # if @GNULIB_PTHREAD_THREAD@
      84  #  include "windows-thread.h"
      85  #  if @HAVE_PTHREAD_T@
      86  #   define pthread_t rpl_pthread_t
      87  #   define pthread_attr_t rpl_pthread_attr_t
      88  #  endif
      89  #  if !GNULIB_defined_pthread_thread_types
      90  typedef glwthread_thread_t pthread_t;
      91  typedef unsigned int pthread_attr_t;
      92  #   define GNULIB_defined_pthread_thread_types 1
      93  #  endif
      94  # else
      95  #  if @HAVE_PTHREAD_T@
      96  #   define pthread_t rpl_pthread_t
      97  #   define pthread_attr_t rpl_pthread_attr_t
      98  #  endif
      99  #  if !GNULIB_defined_pthread_thread_types
     100  typedef int pthread_t;
     101  typedef unsigned int pthread_attr_t;
     102  #   define GNULIB_defined_pthread_thread_types 1
     103  #  endif
     104  # endif
     105  # undef PTHREAD_CREATE_JOINABLE
     106  # undef PTHREAD_CREATE_DETACHED
     107  # define PTHREAD_CREATE_JOINABLE 0
     108  # define PTHREAD_CREATE_DETACHED 1
     109  #else
     110  # if !@HAVE_PTHREAD_T@
     111  #  if !GNULIB_defined_pthread_thread_types
     112  typedef int pthread_t;
     113  typedef unsigned int pthread_attr_t;
     114  #   define GNULIB_defined_pthread_thread_types 1
     115  #  endif
     116  # endif
     117  # if !@HAVE_PTHREAD_CREATE_DETACHED@
     118  #  define PTHREAD_CREATE_JOINABLE 0
     119  #  define PTHREAD_CREATE_DETACHED 1
     120  # endif
     121  #endif
     122  
     123  /* =========== Once-only control (initialization) types and macros ========== */
     124  
     125  #if (defined _WIN32 && ! defined __CYGWIN__) && USE_WINDOWS_THREADS
     126  # if @GNULIB_PTHREAD_ONCE@
     127  #  include "windows-once.h"
     128  #  if @HAVE_PTHREAD_T@
     129  #   define pthread_once_t rpl_pthread_once_t
     130  #  endif
     131  #  if !GNULIB_defined_pthread_once_types
     132  typedef glwthread_once_t pthread_once_t;
     133  #   define GNULIB_defined_pthread_once_types 1
     134  #  endif
     135  #  undef PTHREAD_ONCE_INIT
     136  #  define PTHREAD_ONCE_INIT GLWTHREAD_ONCE_INIT
     137  # else
     138  #  if @HAVE_PTHREAD_T@
     139  #   define pthread_once_t rpl_pthread_once_t
     140  #  endif
     141  #  if !GNULIB_defined_pthread_once_types
     142  typedef int pthread_once_t;
     143  #   define GNULIB_defined_pthread_once_types 1
     144  #  endif
     145  #  undef PTHREAD_ONCE_INIT
     146  #  define PTHREAD_ONCE_INIT { 0 }
     147  # endif
     148  #else
     149  # if !@HAVE_PTHREAD_T@
     150  #  if !GNULIB_defined_pthread_once_types
     151  typedef int pthread_once_t;
     152  #   define GNULIB_defined_pthread_once_types 1
     153  #  endif
     154  #  undef PTHREAD_ONCE_INIT
     155  #  define PTHREAD_ONCE_INIT { 0 }
     156  # endif
     157  #endif
     158  
     159  /* =========== Mutex types and macros =========== */
     160  
     161  #if (defined _WIN32 && ! defined __CYGWIN__) && USE_WINDOWS_THREADS
     162  # if @GNULIB_PTHREAD_MUTEX@
     163  #  include "windows-timedmutex.h"
     164  #  include "windows-timedrecmutex.h"
     165  #  if @HAVE_PTHREAD_T@
     166  #   define pthread_mutex_t rpl_pthread_mutex_t
     167  #   define pthread_mutexattr_t rpl_pthread_mutexattr_t
     168  #  endif
     169  #  if !GNULIB_defined_pthread_mutex_types
     170  typedef struct
     171          {
     172            int type;
     173            union
     174              {
     175                glwthread_timedmutex_t    u_timedmutex;
     176                glwthread_timedrecmutex_t u_timedrecmutex;
     177              }
     178            u;
     179          }
     180          pthread_mutex_t;
     181  typedef unsigned int pthread_mutexattr_t;
     182  #   define GNULIB_defined_pthread_mutex_types 1
     183  #  endif
     184  #  undef PTHREAD_MUTEX_INITIALIZER
     185  #  define PTHREAD_MUTEX_INITIALIZER { 1, { GLWTHREAD_TIMEDMUTEX_INIT } }
     186  # else
     187  #  if @HAVE_PTHREAD_T@
     188  #   define pthread_mutex_t rpl_pthread_mutex_t
     189  #   define pthread_mutexattr_t rpl_pthread_mutexattr_t
     190  #  endif
     191  #  if !GNULIB_defined_pthread_mutex_types
     192  typedef int pthread_mutex_t;
     193  typedef unsigned int pthread_mutexattr_t;
     194  #   define GNULIB_defined_pthread_mutex_types 1
     195  #  endif
     196  #  undef PTHREAD_MUTEX_INITIALIZER
     197  #  define PTHREAD_MUTEX_INITIALIZER { 0 }
     198  # endif
     199  # undef PTHREAD_MUTEX_DEFAULT
     200  # undef PTHREAD_MUTEX_NORMAL
     201  # undef PTHREAD_MUTEX_ERRORCHECK
     202  # undef PTHREAD_MUTEX_RECURSIVE
     203  # define PTHREAD_MUTEX_DEFAULT PTHREAD_MUTEX_NORMAL
     204  # define PTHREAD_MUTEX_NORMAL 0
     205  # define PTHREAD_MUTEX_ERRORCHECK 1
     206  # define PTHREAD_MUTEX_RECURSIVE 2
     207  # undef PTHREAD_MUTEX_STALLED
     208  # undef PTHREAD_MUTEX_ROBUST
     209  # define PTHREAD_MUTEX_STALLED 0
     210  # define PTHREAD_MUTEX_ROBUST 1
     211  #else
     212  # if !@HAVE_PTHREAD_T@
     213  #  if !GNULIB_defined_pthread_mutex_types
     214  typedef int pthread_mutex_t;
     215  typedef unsigned int pthread_mutexattr_t;
     216  #   define GNULIB_defined_pthread_mutex_types 1
     217  #  endif
     218  #  undef PTHREAD_MUTEX_INITIALIZER
     219  #  define PTHREAD_MUTEX_INITIALIZER { 0 }
     220  # endif
     221  # if !@HAVE_PTHREAD_MUTEX_RECURSIVE@
     222  #  define PTHREAD_MUTEX_DEFAULT PTHREAD_MUTEX_NORMAL
     223  #  define PTHREAD_MUTEX_NORMAL 0
     224  #  define PTHREAD_MUTEX_ERRORCHECK 1
     225  #  define PTHREAD_MUTEX_RECURSIVE 2
     226  # endif
     227  # if !@HAVE_PTHREAD_MUTEX_ROBUST@
     228  #  define PTHREAD_MUTEX_STALLED 0
     229  #  define PTHREAD_MUTEX_ROBUST 1
     230  # endif
     231  #endif
     232  
     233  /* =========== Read-write lock types and macros =========== */
     234  
     235  #if (defined _WIN32 && ! defined __CYGWIN__) && USE_WINDOWS_THREADS
     236  # if @GNULIB_PTHREAD_RWLOCK@
     237  #  include "windows-timedrwlock.h"
     238  #  if @HAVE_PTHREAD_T@
     239  #   define pthread_rwlock_t rpl_pthread_rwlock_t
     240  #   define pthread_rwlockattr_t rpl_pthread_rwlockattr_t
     241  #  endif
     242  #  if !GNULIB_defined_pthread_rwlock_types
     243  typedef glwthread_timedrwlock_t pthread_rwlock_t;
     244  typedef unsigned int pthread_rwlockattr_t;
     245  #   define GNULIB_defined_pthread_rwlock_types 1
     246  #  endif
     247  #  undef PTHREAD_RWLOCK_INITIALIZER
     248  #  define PTHREAD_RWLOCK_INITIALIZER GLWTHREAD_TIMEDRWLOCK_INIT
     249  # else
     250  #  if @HAVE_PTHREAD_T@
     251  #   define pthread_rwlock_t rpl_pthread_rwlock_t
     252  #   define pthread_rwlockattr_t rpl_pthread_rwlockattr_t
     253  #  endif
     254  #  if !GNULIB_defined_pthread_rwlock_types
     255  typedef int pthread_rwlock_t;
     256  typedef unsigned int pthread_rwlockattr_t;
     257  #   define GNULIB_defined_pthread_rwlock_types 1
     258  #  endif
     259  #  undef PTHREAD_RWLOCK_INITIALIZER
     260  #  define PTHREAD_RWLOCK_INITIALIZER { 0 }
     261  # endif
     262  #elif @GNULIB_PTHREAD_RWLOCK@ && @REPLACE_PTHREAD_RWLOCK_INIT@ /* i.e. PTHREAD_RWLOCK_UNIMPLEMENTED */
     263  # if @HAVE_PTHREAD_T@
     264  #  define pthread_rwlock_t rpl_pthread_rwlock_t
     265  #  define pthread_rwlockattr_t rpl_pthread_rwlockattr_t
     266  # endif
     267  # if !GNULIB_defined_pthread_rwlock_types
     268  typedef struct
     269          {
     270            pthread_mutex_t lock; /* protects the remaining fields */
     271            pthread_cond_t waiting_readers; /* waiting readers */
     272            pthread_cond_t waiting_writers; /* waiting writers */
     273            unsigned int waiting_writers_count; /* number of waiting writers */
     274            int runcount; /* number of readers running, or -1 when a writer runs */
     275          }
     276          pthread_rwlock_t;
     277  typedef unsigned int pthread_rwlockattr_t;
     278  #  define GNULIB_defined_pthread_rwlock_types 1
     279  # endif
     280  # undef PTHREAD_RWLOCK_INITIALIZER
     281  # define PTHREAD_RWLOCK_INITIALIZER \
     282     { PTHREAD_MUTEX_INITIALIZER, PTHREAD_COND_INITIALIZER, PTHREAD_COND_INITIALIZER, 0, 0 }
     283  #else
     284  # if @HAVE_PTHREAD_T@
     285  #  if !defined PTHREAD_RWLOCK_INITIALIZER && defined PTHREAD_RWLOCK_INITIALIZER_NP /* z/OS */
     286  #   define PTHREAD_RWLOCK_INITIALIZER PTHREAD_RWLOCK_INITIALIZER_NP
     287  #  endif
     288  # else
     289  #  if !GNULIB_defined_pthread_rwlock_types
     290  typedef int pthread_rwlock_t;
     291  typedef unsigned int pthread_rwlockattr_t;
     292  #   define GNULIB_defined_pthread_rwlock_types 1
     293  #  endif
     294  #  undef PTHREAD_RWLOCK_INITIALIZER
     295  #  define PTHREAD_RWLOCK_INITIALIZER { 0 }
     296  # endif
     297  #endif
     298  
     299  /* =========== Condition variable types and macros =========== */
     300  
     301  #if (defined _WIN32 && ! defined __CYGWIN__) && USE_WINDOWS_THREADS
     302  # if @GNULIB_PTHREAD_COND@
     303  #  include "windows-cond.h"
     304  #  if @HAVE_PTHREAD_T@
     305  #   define pthread_cond_t rpl_pthread_cond_t
     306  #   define pthread_condattr_t rpl_pthread_condattr_t
     307  #  endif
     308  #  if !GNULIB_defined_pthread_cond_types
     309  typedef glwthread_cond_t pthread_cond_t;
     310  typedef unsigned int pthread_condattr_t;
     311  #   define GNULIB_defined_pthread_cond_types 1
     312  #  endif
     313  #  undef PTHREAD_COND_INITIALIZER
     314  #  define PTHREAD_COND_INITIALIZER GLWTHREAD_COND_INIT
     315  # else
     316  #  if @HAVE_PTHREAD_T@
     317  #   define pthread_cond_t rpl_pthread_cond_t
     318  #   define pthread_condattr_t rpl_pthread_condattr_t
     319  #  endif
     320  #  if !GNULIB_defined_pthread_cond_types
     321  typedef int pthread_cond_t;
     322  typedef unsigned int pthread_condattr_t;
     323  #   define GNULIB_defined_pthread_cond_types 1
     324  #  endif
     325  #  undef PTHREAD_COND_INITIALIZER
     326  #  define PTHREAD_COND_INITIALIZER { 0 }
     327  # endif
     328  #else
     329  # if !@HAVE_PTHREAD_T@
     330  #  if !GNULIB_defined_pthread_cond_types
     331  typedef int pthread_cond_t;
     332  typedef unsigned int pthread_condattr_t;
     333  #   define GNULIB_defined_pthread_cond_types 1
     334  #  endif
     335  #  undef PTHREAD_COND_INITIALIZER
     336  #  define PTHREAD_COND_INITIALIZER { 0 }
     337  # endif
     338  #endif
     339  
     340  /* =========== Thread-specific storage types and macros =========== */
     341  
     342  #if (defined _WIN32 && ! defined __CYGWIN__) && USE_WINDOWS_THREADS
     343  # if @GNULIB_PTHREAD_TSS@
     344  #  include "windows-tls.h"
     345  #  if @HAVE_PTHREAD_T@
     346  #   define pthread_key_t rpl_pthread_key_t
     347  #  endif
     348  #  if !GNULIB_defined_pthread_tss_types
     349  typedef glwthread_tls_key_t pthread_key_t;
     350  #   define GNULIB_defined_pthread_tss_types 1
     351  #  endif
     352  #  undef PTHREAD_DESTRUCTOR_ITERATIONS
     353  #  define PTHREAD_DESTRUCTOR_ITERATIONS GLWTHREAD_DESTRUCTOR_ITERATIONS
     354  # else
     355  #  if @HAVE_PTHREAD_T@
     356  #   define pthread_key_t rpl_pthread_key_t
     357  #  endif
     358  #  if !GNULIB_defined_pthread_tss_types
     359  typedef void ** pthread_key_t;
     360  #   define GNULIB_defined_pthread_tss_types 1
     361  #  endif
     362  #  undef PTHREAD_DESTRUCTOR_ITERATIONS
     363  #  define PTHREAD_DESTRUCTOR_ITERATIONS 0
     364  # endif
     365  #else
     366  # if !@HAVE_PTHREAD_T@
     367  #  if !GNULIB_defined_pthread_tss_types
     368  typedef void ** pthread_key_t;
     369  #   define GNULIB_defined_pthread_tss_types 1
     370  #  endif
     371  #  undef PTHREAD_DESTRUCTOR_ITERATIONS
     372  #  define PTHREAD_DESTRUCTOR_ITERATIONS 0
     373  # endif
     374  #endif
     375  
     376  /* =========== Spinlock types and macros =========== */
     377  
     378  #if (defined _WIN32 && ! defined __CYGWIN__) && USE_WINDOWS_THREADS
     379  # if @GNULIB_PTHREAD_SPIN@
     380  #  include "windows-spin.h"
     381  #  if @HAVE_PTHREAD_T@
     382  #   define pthread_spinlock_t rpl_pthread_spinlock_t
     383  #  endif
     384  #  if !GNULIB_defined_pthread_spin_types
     385  typedef glwthread_spinlock_t pthread_spinlock_t;
     386  #   define GNULIB_defined_pthread_spin_types 1
     387  #  endif
     388  # else
     389  #  if @HAVE_PTHREAD_T@
     390  #   define pthread_spinlock_t rpl_pthread_spinlock_t
     391  #  endif
     392  #  if !GNULIB_defined_pthread_spin_types
     393  typedef pthread_mutex_t pthread_spinlock_t;
     394  #   define GNULIB_defined_pthread_spin_types 1
     395  #  endif
     396  # endif
     397  # undef PTHREAD_PROCESS_PRIVATE
     398  # undef PTHREAD_PROCESS_SHARED
     399  # define PTHREAD_PROCESS_PRIVATE 0
     400  # define PTHREAD_PROCESS_SHARED 1
     401  #else
     402  # if !@HAVE_PTHREAD_SPINLOCK_T@
     403  /* Approximate spinlocks with mutexes.  */
     404  #  if !GNULIB_defined_pthread_spin_types
     405  typedef pthread_mutex_t pthread_spinlock_t;
     406  #   define GNULIB_defined_pthread_spin_types 1
     407  #  endif
     408  # endif
     409  # if !@HAVE_PTHREAD_PROCESS_SHARED@
     410  #  define PTHREAD_PROCESS_PRIVATE 0
     411  #  define PTHREAD_PROCESS_SHARED 1
     412  # endif
     413  #endif
     414  
     415  /* =========== Other types and macros =========== */
     416  
     417  #if !@HAVE_PTHREAD_T@
     418  # if !GNULIB_defined_other_pthread_types
     419  typedef int pthread_barrier_t;
     420  typedef unsigned int pthread_barrierattr_t;
     421  #  define GNULIB_defined_other_pthread_types 1
     422  # endif
     423  #endif
     424  
     425  #if !defined PTHREAD_CANCELED
     426  
     427  # define PTHREAD_BARRIER_SERIAL_THREAD (-1)
     428  
     429  # define PTHREAD_CANCEL_DEFERRED 0
     430  # define PTHREAD_CANCEL_ASYNCHRONOUS 1
     431  
     432  # define PTHREAD_CANCEL_ENABLE 0
     433  # define PTHREAD_CANCEL_DISABLE 1
     434  
     435  # define PTHREAD_CANCELED ((void *) -1)
     436  
     437  # define PTHREAD_INHERIT_SCHED 0
     438  # define PTHREAD_EXPLICIT_SCHED 1
     439  
     440  # define PTHREAD_PRIO_NONE 0
     441  # define PTHREAD_PRIO_INHERIT 1
     442  # define PTHREAD_PRIO_PROTECT 2
     443  
     444  # define PTHREAD_SCOPE_SYSTEM 0
     445  # define PTHREAD_SCOPE_PROCESS 1
     446  
     447  #endif
     448  
     449  /* =========== Thread functions =========== */
     450  
     451  #if @GNULIB_PTHREAD_THREAD@
     452  /* The 'restrict' qualifier on ARG is nonsense, but POSIX specifies it this way.
     453     Sigh.  */
     454  # if @REPLACE_PTHREAD_CREATE@
     455  #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
     456  #   undef pthread_create
     457  #   define pthread_create rpl_pthread_create
     458  #  endif
     459  _GL_FUNCDECL_RPL (pthread_create, int,
     460                    (pthread_t *restrict threadp,
     461                     const pthread_attr_t *restrict attr,
     462                     void * (*mainfunc) (void *), void *restrict arg)
     463                    _GL_ARG_NONNULL ((1, 3)));
     464  _GL_CXXALIAS_RPL (pthread_create, int,
     465                    (pthread_t *restrict threadp,
     466                     const pthread_attr_t *restrict attr,
     467                     void * (*mainfunc) (void *), void *restrict arg));
     468  # else
     469  #  if !@HAVE_PTHREAD_CREATE@
     470  _GL_FUNCDECL_SYS (pthread_create, int,
     471                    (pthread_t *restrict threadp,
     472                     const pthread_attr_t *restrict attr,
     473                     void * (*mainfunc) (void *), void *restrict arg)
     474                    _GL_ARG_NONNULL ((1, 3)));
     475  #  endif
     476  _GL_CXXALIAS_SYS_CAST (pthread_create, int,
     477                         (pthread_t *restrict threadp,
     478                          const pthread_attr_t *restrict attr,
     479                          void * (*mainfunc) (void *), void *restrict arg));
     480  # endif
     481  # if __GLIBC__ >= 2
     482  _GL_CXXALIASWARN (pthread_create);
     483  # endif
     484  #elif defined GNULIB_POSIXCHECK
     485  # undef pthread_create
     486  # if HAVE_RAW_DECL_PTHREAD_CREATE
     487  _GL_WARN_ON_USE (pthread_create, "pthread_create is not portable - "
     488                   "use gnulib module pthread-thread for portability");
     489  # endif
     490  #endif
     491  
     492  #if @GNULIB_PTHREAD_THREAD@
     493  # if @REPLACE_PTHREAD_ATTR_INIT@
     494  #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
     495  #   undef pthread_attr_init
     496  #   define pthread_attr_init rpl_pthread_attr_init
     497  #  endif
     498  _GL_FUNCDECL_RPL (pthread_attr_init, int, (pthread_attr_t *attr)
     499                                            _GL_ARG_NONNULL ((1)));
     500  _GL_CXXALIAS_RPL (pthread_attr_init, int, (pthread_attr_t *attr));
     501  # else
     502  #  if !@HAVE_PTHREAD_ATTR_INIT@
     503  _GL_FUNCDECL_SYS (pthread_attr_init, int, (pthread_attr_t *attr)
     504                                            _GL_ARG_NONNULL ((1)));
     505  #  endif
     506  _GL_CXXALIAS_SYS (pthread_attr_init, int, (pthread_attr_t *attr));
     507  # endif
     508  # if __GLIBC__ >= 2
     509  _GL_CXXALIASWARN (pthread_attr_init);
     510  # endif
     511  #elif defined GNULIB_POSIXCHECK
     512  # undef pthread_attr_init
     513  # if HAVE_RAW_DECL_PTHREAD_ATTR_INIT
     514  _GL_WARN_ON_USE (pthread_attr_init, "pthread_attr_init is not portable - "
     515                   "use gnulib module pthread-thread for portability");
     516  # endif
     517  #endif
     518  
     519  #if @GNULIB_PTHREAD_THREAD@
     520  # if @REPLACE_PTHREAD_ATTR_GETDETACHSTATE@
     521  #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
     522  #   undef pthread_attr_getdetachstate
     523  #   define pthread_attr_getdetachstate rpl_pthread_attr_getdetachstate
     524  #  endif
     525  _GL_FUNCDECL_RPL (pthread_attr_getdetachstate, int,
     526                    (const pthread_attr_t *attr, int *detachstatep)
     527                    _GL_ARG_NONNULL ((1, 2)));
     528  _GL_CXXALIAS_RPL (pthread_attr_getdetachstate, int,
     529                    (const pthread_attr_t *attr, int *detachstatep));
     530  # else
     531  #  if !@HAVE_PTHREAD_ATTR_GETDETACHSTATE@
     532  _GL_FUNCDECL_SYS (pthread_attr_getdetachstate, int,
     533                    (const pthread_attr_t *attr, int *detachstatep)
     534                    _GL_ARG_NONNULL ((1, 2)));
     535  #  endif
     536  _GL_CXXALIAS_SYS (pthread_attr_getdetachstate, int,
     537                    (const pthread_attr_t *attr, int *detachstatep));
     538  # endif
     539  # if __GLIBC__ >= 2
     540  _GL_CXXALIASWARN (pthread_attr_getdetachstate);
     541  # endif
     542  #elif defined GNULIB_POSIXCHECK
     543  # undef pthread_attr_getdetachstate
     544  # if HAVE_RAW_DECL_PTHREAD_ATTR_GETDETACHSTATE
     545  _GL_WARN_ON_USE (pthread_attr_getdetachstate, "pthread_attr_getdetachstate is not portable - "
     546                   "use gnulib module pthread-thread for portability");
     547  # endif
     548  #endif
     549  
     550  #if @GNULIB_PTHREAD_THREAD@
     551  # if @REPLACE_PTHREAD_ATTR_SETDETACHSTATE@
     552  #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
     553  #   undef pthread_attr_setdetachstate
     554  #   define pthread_attr_setdetachstate rpl_pthread_attr_setdetachstate
     555  #  endif
     556  _GL_FUNCDECL_RPL (pthread_attr_setdetachstate, int,
     557                    (pthread_attr_t *attr, int detachstate)
     558                    _GL_ARG_NONNULL ((1)));
     559  _GL_CXXALIAS_RPL (pthread_attr_setdetachstate, int,
     560                    (pthread_attr_t *attr, int detachstate));
     561  # else
     562  #  if !@HAVE_PTHREAD_ATTR_SETDETACHSTATE@
     563  _GL_FUNCDECL_SYS (pthread_attr_setdetachstate, int,
     564                    (pthread_attr_t *attr, int detachstate)
     565                    _GL_ARG_NONNULL ((1)));
     566  #  endif
     567  _GL_CXXALIAS_SYS (pthread_attr_setdetachstate, int,
     568                    (pthread_attr_t *attr, int detachstate));
     569  # endif
     570  # if __GLIBC__ >= 2
     571  _GL_CXXALIASWARN (pthread_attr_setdetachstate);
     572  # endif
     573  #elif defined GNULIB_POSIXCHECK
     574  # undef pthread_attr_setdetachstate
     575  # if HAVE_RAW_DECL_PTHREAD_ATTR_SETDETACHSTATE
     576  _GL_WARN_ON_USE (pthread_attr_setdetachstate, "pthread_attr_setdetachstate is not portable - "
     577                   "use gnulib module pthread-thread for portability");
     578  # endif
     579  #endif
     580  
     581  #if @GNULIB_PTHREAD_THREAD@
     582  # if @REPLACE_PTHREAD_ATTR_DESTROY@
     583  #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
     584  #   undef pthread_attr_destroy
     585  #   define pthread_attr_destroy rpl_pthread_attr_destroy
     586  #  endif
     587  _GL_FUNCDECL_RPL (pthread_attr_destroy, int, (pthread_attr_t *attr)
     588                                               _GL_ARG_NONNULL ((1)));
     589  _GL_CXXALIAS_RPL (pthread_attr_destroy, int, (pthread_attr_t *attr));
     590  # else
     591  #  if !@HAVE_PTHREAD_ATTR_DESTROY@
     592  _GL_FUNCDECL_SYS (pthread_attr_destroy, int, (pthread_attr_t *attr)
     593                                               _GL_ARG_NONNULL ((1)));
     594  #  endif
     595  _GL_CXXALIAS_SYS (pthread_attr_destroy, int, (pthread_attr_t *attr));
     596  # endif
     597  # if __GLIBC__ >= 2
     598  _GL_CXXALIASWARN (pthread_attr_destroy);
     599  # endif
     600  #elif defined GNULIB_POSIXCHECK
     601  # undef pthread_attr_destroy
     602  # if HAVE_RAW_DECL_PTHREAD_ATTR_DESTROY
     603  _GL_WARN_ON_USE (pthread_attr_destroy, "pthread_attr_destroy is not portable - "
     604                   "use gnulib module pthread-thread for portability");
     605  # endif
     606  #endif
     607  
     608  #if @GNULIB_PTHREAD_THREAD@
     609  # if @REPLACE_PTHREAD_SELF@
     610  #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
     611  #   undef pthread_self
     612  #   define pthread_self rpl_pthread_self
     613  #  endif
     614  _GL_FUNCDECL_RPL (pthread_self, pthread_t, (void) _GL_ATTRIBUTE_PURE);
     615  _GL_CXXALIAS_RPL (pthread_self, pthread_t, (void));
     616  # else
     617  #  if !@HAVE_PTHREAD_SELF@
     618  _GL_FUNCDECL_SYS (pthread_self, pthread_t, (void) _GL_ATTRIBUTE_PURE);
     619  #  endif
     620  _GL_CXXALIAS_SYS (pthread_self, pthread_t, (void));
     621  # endif
     622  # if __GLIBC__ >= 2
     623  _GL_CXXALIASWARN (pthread_self);
     624  # endif
     625  #elif defined GNULIB_POSIXCHECK
     626  # undef pthread_self
     627  # if HAVE_RAW_DECL_PTHREAD_SELF
     628  _GL_WARN_ON_USE (pthread_self, "pthread_self is not portable - "
     629                   "use gnulib module pthread-thread for portability");
     630  # endif
     631  #endif
     632  
     633  #if @GNULIB_PTHREAD_THREAD@
     634  # if @REPLACE_PTHREAD_EQUAL@
     635  #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
     636  #   undef pthread_equal
     637  #   define pthread_equal rpl_pthread_equal
     638  #  endif
     639  _GL_FUNCDECL_RPL (pthread_equal, int, (pthread_t thread1, pthread_t thread2));
     640  _GL_CXXALIAS_RPL (pthread_equal, int, (pthread_t thread1, pthread_t thread2));
     641  # else
     642  #  if !@HAVE_PTHREAD_EQUAL@
     643  _GL_FUNCDECL_SYS (pthread_equal, int, (pthread_t thread1, pthread_t thread2));
     644  #  endif
     645  _GL_CXXALIAS_SYS (pthread_equal, int, (pthread_t thread1, pthread_t thread2));
     646  # endif
     647  # if __GLIBC__ >= 2
     648  _GL_CXXALIASWARN (pthread_equal);
     649  # endif
     650  #elif defined GNULIB_POSIXCHECK
     651  # undef pthread_equal
     652  # if HAVE_RAW_DECL_PTHREAD_EQUAL
     653  _GL_WARN_ON_USE (pthread_equal, "pthread_equal is not portable - "
     654                   "use gnulib module pthread-thread for portability");
     655  # endif
     656  #endif
     657  
     658  #if @GNULIB_PTHREAD_THREAD@
     659  # if @REPLACE_PTHREAD_DETACH@
     660  #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
     661  #   undef pthread_detach
     662  #   define pthread_detach rpl_pthread_detach
     663  #  endif
     664  _GL_FUNCDECL_RPL (pthread_detach, int, (pthread_t thread));
     665  _GL_CXXALIAS_RPL (pthread_detach, int, (pthread_t thread));
     666  # else
     667  #  if !@HAVE_PTHREAD_DETACH@
     668  _GL_FUNCDECL_SYS (pthread_detach, int, (pthread_t thread));
     669  #  endif
     670  _GL_CXXALIAS_SYS (pthread_detach, int, (pthread_t thread));
     671  # endif
     672  # if __GLIBC__ >= 2
     673  _GL_CXXALIASWARN (pthread_detach);
     674  # endif
     675  #elif defined GNULIB_POSIXCHECK
     676  # undef pthread_detach
     677  # if HAVE_RAW_DECL_PTHREAD_DETACH
     678  _GL_WARN_ON_USE (pthread_detach, "pthread_detach is not portable - "
     679                   "use gnulib module pthread-thread for portability");
     680  # endif
     681  #endif
     682  
     683  #if @GNULIB_PTHREAD_THREAD@
     684  # if @REPLACE_PTHREAD_JOIN@
     685  #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
     686  #   undef pthread_join
     687  #   define pthread_join rpl_pthread_join
     688  #  endif
     689  _GL_FUNCDECL_RPL (pthread_join, int, (pthread_t thread, void **valuep));
     690  _GL_CXXALIAS_RPL (pthread_join, int, (pthread_t thread, void **valuep));
     691  # else
     692  #  if !@HAVE_PTHREAD_JOIN@
     693  _GL_FUNCDECL_SYS (pthread_join, int, (pthread_t thread, void **valuep));
     694  #  endif
     695  _GL_CXXALIAS_SYS (pthread_join, int, (pthread_t thread, void **valuep));
     696  # endif
     697  # if __GLIBC__ >= 2
     698  _GL_CXXALIASWARN (pthread_join);
     699  # endif
     700  #elif defined GNULIB_POSIXCHECK
     701  # undef pthread_join
     702  # if HAVE_RAW_DECL_PTHREAD_JOIN
     703  _GL_WARN_ON_USE (pthread_join, "pthread_join is not portable - "
     704                   "use gnulib module pthread-thread for portability");
     705  # endif
     706  #endif
     707  
     708  #if @GNULIB_PTHREAD_THREAD@
     709  # if @REPLACE_PTHREAD_EXIT@
     710  #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
     711  #   undef pthread_exit
     712  #   define pthread_exit rpl_pthread_exit
     713  #  endif
     714  _GL_FUNCDECL_RPL (pthread_exit, _Noreturn void, (void *value));
     715  _GL_CXXALIAS_RPL (pthread_exit, void, (void *value));
     716  # else
     717  #  if !@HAVE_PTHREAD_EXIT@
     718  _GL_FUNCDECL_SYS (pthread_exit, _Noreturn void, (void *value));
     719  #  endif
     720  /* Need to cast because of AIX with xlclang++.  */
     721  _GL_CXXALIAS_SYS_CAST (pthread_exit, void, (void *value));
     722  # endif
     723  # if __GLIBC__ >= 2
     724  _GL_CXXALIASWARN (pthread_exit);
     725  # endif
     726  #elif defined GNULIB_POSIXCHECK
     727  # undef pthread_exit
     728  # if HAVE_RAW_DECL_PTHREAD_EXIT
     729  _GL_WARN_ON_USE (pthread_exit, "pthread_exit is not portable - "
     730                   "use gnulib module pthread-thread for portability");
     731  # endif
     732  #endif
     733  
     734  /* =========== Once-only control (initialization) functions =========== */
     735  
     736  #if @GNULIB_PTHREAD_ONCE@
     737  # if @REPLACE_PTHREAD_ONCE@
     738  #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
     739  #   undef pthread_once
     740  #   define pthread_once rpl_pthread_once
     741  #  endif
     742  _GL_FUNCDECL_RPL (pthread_once, int,
     743                    (pthread_once_t *once_control, void (*initfunction) (void))
     744                    _GL_ARG_NONNULL ((1, 2)));
     745  _GL_CXXALIAS_RPL (pthread_once, int,
     746                    (pthread_once_t *once_control, void (*initfunction) (void)));
     747  # else
     748  #  if !@HAVE_PTHREAD_ONCE@
     749  _GL_FUNCDECL_SYS (pthread_once, int,
     750                    (pthread_once_t *once_control, void (*initfunction) (void))
     751                     _GL_ARG_NONNULL ((1, 2)));
     752  #  endif
     753  _GL_CXXALIAS_SYS_CAST (pthread_once, int,
     754                         (pthread_once_t *once_control,
     755                          void (*initfunction) (void)));
     756  # endif
     757  # if __GLIBC__ >= 2
     758  _GL_CXXALIASWARN (pthread_once);
     759  # endif
     760  #elif defined GNULIB_POSIXCHECK
     761  # undef pthread_once
     762  # if HAVE_RAW_DECL_PTHREAD_ONCE
     763  _GL_WARN_ON_USE (pthread_once, "pthread_once is not portable - "
     764                   "use gnulib module pthread-once for portability");
     765  # endif
     766  #endif
     767  
     768  /* =========== Mutex functions =========== */
     769  
     770  #if @GNULIB_PTHREAD_MUTEX@
     771  # if @REPLACE_PTHREAD_MUTEX_INIT@
     772  #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
     773  #   undef pthread_mutex_init
     774  #   define pthread_mutex_init rpl_pthread_mutex_init
     775  #  endif
     776  _GL_FUNCDECL_RPL (pthread_mutex_init, int,
     777                    (pthread_mutex_t *restrict mutex,
     778                     const pthread_mutexattr_t *restrict attr)
     779                    _GL_ARG_NONNULL ((1)));
     780  _GL_CXXALIAS_RPL (pthread_mutex_init, int,
     781                    (pthread_mutex_t *restrict mutex,
     782                     const pthread_mutexattr_t *restrict attr));
     783  # else
     784  #  if !@HAVE_PTHREAD_MUTEX_INIT@
     785  _GL_FUNCDECL_SYS (pthread_mutex_init, int,
     786                    (pthread_mutex_t *restrict mutex,
     787                     const pthread_mutexattr_t *restrict attr)
     788                    _GL_ARG_NONNULL ((1)));
     789  #  endif
     790  _GL_CXXALIAS_SYS (pthread_mutex_init, int,
     791                    (pthread_mutex_t *restrict mutex,
     792                     const pthread_mutexattr_t *restrict attr));
     793  # endif
     794  # if __GLIBC__ >= 2
     795  _GL_CXXALIASWARN (pthread_mutex_init);
     796  # endif
     797  #elif defined GNULIB_POSIXCHECK
     798  # undef pthread_mutex_init
     799  # if HAVE_RAW_DECL_PTHREAD_MUTEX_INIT
     800  _GL_WARN_ON_USE (pthread_mutex_init, "pthread_mutex_init is not portable - "
     801                   "use gnulib module pthread-mutex for portability");
     802  # endif
     803  #endif
     804  
     805  #if @GNULIB_PTHREAD_MUTEX@
     806  # if @REPLACE_PTHREAD_MUTEXATTR_INIT@
     807  #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
     808  #   undef pthread_mutexattr_init
     809  #   define pthread_mutexattr_init rpl_pthread_mutexattr_init
     810  #  endif
     811  _GL_FUNCDECL_RPL (pthread_mutexattr_init, int, (pthread_mutexattr_t *attr)
     812                                                 _GL_ARG_NONNULL ((1)));
     813  _GL_CXXALIAS_RPL (pthread_mutexattr_init, int, (pthread_mutexattr_t *attr));
     814  # else
     815  #  if !@HAVE_PTHREAD_MUTEXATTR_INIT@
     816  _GL_FUNCDECL_SYS (pthread_mutexattr_init, int, (pthread_mutexattr_t *attr)
     817                                                 _GL_ARG_NONNULL ((1)));
     818  #  endif
     819  _GL_CXXALIAS_SYS (pthread_mutexattr_init, int, (pthread_mutexattr_t *attr));
     820  # endif
     821  # if __GLIBC__ >= 2
     822  _GL_CXXALIASWARN (pthread_mutexattr_init);
     823  # endif
     824  #elif defined GNULIB_POSIXCHECK
     825  # undef pthread_mutexattr_init
     826  # if HAVE_RAW_DECL_PTHREAD_MUTEXATTR_INIT
     827  _GL_WARN_ON_USE (pthread_mutexattr_init, "pthread_mutexattr_init is not portable - "
     828                   "use gnulib module pthread-mutex for portability");
     829  # endif
     830  #endif
     831  
     832  #if @GNULIB_PTHREAD_MUTEX@
     833  # if @REPLACE_PTHREAD_MUTEXATTR_GETTYPE@
     834  #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
     835  #   undef pthread_mutexattr_gettype
     836  #   define pthread_mutexattr_gettype rpl_pthread_mutexattr_gettype
     837  #  endif
     838  _GL_FUNCDECL_RPL (pthread_mutexattr_gettype, int,
     839                    (const pthread_mutexattr_t *restrict attr,
     840                     int *restrict typep)
     841                    _GL_ARG_NONNULL ((1, 2)));
     842  _GL_CXXALIAS_RPL (pthread_mutexattr_gettype, int,
     843                    (const pthread_mutexattr_t *restrict attr,
     844                     int *restrict typep));
     845  # else
     846  #  if !@HAVE_PTHREAD_MUTEXATTR_GETTYPE@
     847  _GL_FUNCDECL_SYS (pthread_mutexattr_gettype, int,
     848                    (const pthread_mutexattr_t *restrict attr,
     849                     int *restrict typep)
     850                    _GL_ARG_NONNULL ((1, 2)));
     851  #  endif
     852  /* Need to cast, because on FreeBSD the first parameter is
     853                          pthread_mutexattr_t *attr.  */
     854  _GL_CXXALIAS_SYS_CAST (pthread_mutexattr_gettype, int,
     855                         (const pthread_mutexattr_t *restrict attr,
     856                          int *restrict typep));
     857  # endif
     858  # if __GLIBC__ >= 2
     859  _GL_CXXALIASWARN (pthread_mutexattr_gettype);
     860  # endif
     861  #elif defined GNULIB_POSIXCHECK
     862  # undef pthread_mutexattr_gettype
     863  # if HAVE_RAW_DECL_PTHREAD_MUTEXATTR_GETTYPE
     864  _GL_WARN_ON_USE (pthread_mutexattr_gettype, "pthread_mutexattr_gettype is not portable - "
     865                   "use gnulib module pthread-mutex for portability");
     866  # endif
     867  #endif
     868  
     869  #if @GNULIB_PTHREAD_MUTEX@
     870  # if @REPLACE_PTHREAD_MUTEXATTR_SETTYPE@
     871  #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
     872  #   undef pthread_mutexattr_settype
     873  #   define pthread_mutexattr_settype rpl_pthread_mutexattr_settype
     874  #  endif
     875  _GL_FUNCDECL_RPL (pthread_mutexattr_settype, int,
     876                    (pthread_mutexattr_t *attr, int type) _GL_ARG_NONNULL ((1)));
     877  _GL_CXXALIAS_RPL (pthread_mutexattr_settype, int,
     878                    (pthread_mutexattr_t *attr, int type));
     879  # else
     880  #  if !@HAVE_PTHREAD_MUTEXATTR_SETTYPE@
     881  _GL_FUNCDECL_SYS (pthread_mutexattr_settype, int,
     882                    (pthread_mutexattr_t *attr, int type) _GL_ARG_NONNULL ((1)));
     883  #  endif
     884  _GL_CXXALIAS_SYS (pthread_mutexattr_settype, int,
     885                    (pthread_mutexattr_t *attr, int type));
     886  # endif
     887  # if __GLIBC__ >= 2
     888  _GL_CXXALIASWARN (pthread_mutexattr_settype);
     889  # endif
     890  #elif defined GNULIB_POSIXCHECK
     891  # undef pthread_mutexattr_settype
     892  # if HAVE_RAW_DECL_PTHREAD_MUTEXATTR_SETTYPE
     893  _GL_WARN_ON_USE (pthread_mutexattr_settype, "pthread_mutexattr_settype is not portable - "
     894                   "use gnulib module pthread-mutex for portability");
     895  # endif
     896  #endif
     897  
     898  #if @GNULIB_PTHREAD_MUTEX@
     899  # if @REPLACE_PTHREAD_MUTEXATTR_GETROBUST@
     900  #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
     901  #   undef pthread_mutexattr_getrobust
     902  #   define pthread_mutexattr_getrobust rpl_pthread_mutexattr_getrobust
     903  #  endif
     904  _GL_FUNCDECL_RPL (pthread_mutexattr_getrobust, int,
     905                    (const pthread_mutexattr_t *restrict attr,
     906                     int *restrict robustp)
     907                    _GL_ARG_NONNULL ((1, 2)));
     908  _GL_CXXALIAS_RPL (pthread_mutexattr_getrobust, int,
     909                    (const pthread_mutexattr_t *restrict attr,
     910                     int *restrict robustp));
     911  # else
     912  #  if !@HAVE_PTHREAD_MUTEXATTR_GETROBUST@
     913  _GL_FUNCDECL_SYS (pthread_mutexattr_getrobust, int,
     914                    (const pthread_mutexattr_t *restrict attr,
     915                     int *restrict robustp)
     916                    _GL_ARG_NONNULL ((1, 2)));
     917  #  endif
     918  /* Need to cast, because on FreeBSD the first parameter is
     919                          pthread_mutexattr_t *attr.  */
     920  _GL_CXXALIAS_SYS_CAST (pthread_mutexattr_getrobust, int,
     921                         (const pthread_mutexattr_t *restrict attr,
     922                          int *restrict robustp));
     923  # endif
     924  # if __GLIBC__ >= 2
     925  _GL_CXXALIASWARN (pthread_mutexattr_getrobust);
     926  # endif
     927  #elif defined GNULIB_POSIXCHECK
     928  # undef pthread_mutexattr_getrobust
     929  # if HAVE_RAW_DECL_PTHREAD_MUTEXATTR_GETROBUST
     930  _GL_WARN_ON_USE (pthread_mutexattr_getrobust, "pthread_mutexattr_getrobust is not portable - "
     931                   "use gnulib module pthread-mutex for portability");
     932  # endif
     933  #endif
     934  
     935  #if @GNULIB_PTHREAD_MUTEX@
     936  # if @REPLACE_PTHREAD_MUTEXATTR_SETROBUST@
     937  #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
     938  #   undef pthread_mutexattr_setrobust
     939  #   define pthread_mutexattr_setrobust rpl_pthread_mutexattr_setrobust
     940  #  endif
     941  _GL_FUNCDECL_RPL (pthread_mutexattr_setrobust, int,
     942                    (pthread_mutexattr_t *attr, int robust)
     943                    _GL_ARG_NONNULL ((1)));
     944  _GL_CXXALIAS_RPL (pthread_mutexattr_setrobust, int,
     945                    (pthread_mutexattr_t *attr, int robust));
     946  # else
     947  #  if !@HAVE_PTHREAD_MUTEXATTR_SETROBUST@
     948  _GL_FUNCDECL_SYS (pthread_mutexattr_setrobust, int,
     949                    (pthread_mutexattr_t *attr, int robust)
     950                    _GL_ARG_NONNULL ((1)));
     951  #  endif
     952  _GL_CXXALIAS_SYS (pthread_mutexattr_setrobust, int,
     953                    (pthread_mutexattr_t *attr, int robust));
     954  # endif
     955  # if __GLIBC__ >= 2
     956  _GL_CXXALIASWARN (pthread_mutexattr_setrobust);
     957  # endif
     958  #elif defined GNULIB_POSIXCHECK
     959  # undef pthread_mutexattr_setrobust
     960  # if HAVE_RAW_DECL_PTHREAD_MUTEXATTR_SETROBUST
     961  _GL_WARN_ON_USE (pthread_mutexattr_setrobust, "pthread_mutexattr_setrobust is not portable - "
     962                   "use gnulib module pthread-mutex for portability");
     963  # endif
     964  #endif
     965  
     966  #if @GNULIB_PTHREAD_MUTEX@
     967  # if @REPLACE_PTHREAD_MUTEXATTR_DESTROY@
     968  #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
     969  #   undef pthread_mutexattr_destroy
     970  #   define pthread_mutexattr_destroy rpl_pthread_mutexattr_destroy
     971  #  endif
     972  _GL_FUNCDECL_RPL (pthread_mutexattr_destroy, int, (pthread_mutexattr_t *attr)
     973                                                    _GL_ARG_NONNULL ((1)));
     974  _GL_CXXALIAS_RPL (pthread_mutexattr_destroy, int, (pthread_mutexattr_t *attr));
     975  # else
     976  #  if !@HAVE_PTHREAD_MUTEXATTR_DESTROY@
     977  _GL_FUNCDECL_SYS (pthread_mutexattr_destroy, int, (pthread_mutexattr_t *attr)
     978                                                    _GL_ARG_NONNULL ((1)));
     979  #  endif
     980  _GL_CXXALIAS_SYS (pthread_mutexattr_destroy, int, (pthread_mutexattr_t *attr));
     981  # endif
     982  # if __GLIBC__ >= 2
     983  _GL_CXXALIASWARN (pthread_mutexattr_destroy);
     984  # endif
     985  #elif defined GNULIB_POSIXCHECK
     986  # undef pthread_mutexattr_destroy
     987  # if HAVE_RAW_DECL_PTHREAD_MUTEXATTR_DESTROY
     988  _GL_WARN_ON_USE (pthread_mutexattr_destroy, "pthread_mutexattr_destroy is not portable - "
     989                   "use gnulib module pthread-mutex for portability");
     990  # endif
     991  #endif
     992  
     993  #if @GNULIB_PTHREAD_MUTEX@
     994  # if @REPLACE_PTHREAD_MUTEX_LOCK@
     995  #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
     996  #   undef pthread_mutex_lock
     997  #   define pthread_mutex_lock rpl_pthread_mutex_lock
     998  #  endif
     999  _GL_FUNCDECL_RPL (pthread_mutex_lock, int, (pthread_mutex_t *mutex)
    1000                                             _GL_ARG_NONNULL ((1)));
    1001  _GL_CXXALIAS_RPL (pthread_mutex_lock, int, (pthread_mutex_t *mutex));
    1002  # else
    1003  #  if !@HAVE_PTHREAD_MUTEX_LOCK@
    1004  _GL_FUNCDECL_SYS (pthread_mutex_lock, int, (pthread_mutex_t *mutex)
    1005                                             _GL_ARG_NONNULL ((1)));
    1006  #  endif
    1007  _GL_CXXALIAS_SYS (pthread_mutex_lock, int, (pthread_mutex_t *mutex));
    1008  # endif
    1009  # if __GLIBC__ >= 2
    1010  _GL_CXXALIASWARN (pthread_mutex_lock);
    1011  # endif
    1012  #elif defined GNULIB_POSIXCHECK
    1013  # undef pthread_mutex_lock
    1014  # if HAVE_RAW_DECL_PTHREAD_MUTEX_LOCK
    1015  _GL_WARN_ON_USE (pthread_mutex_lock, "pthread_mutex_lock is not portable - "
    1016                   "use gnulib module pthread-mutex for portability");
    1017  # endif
    1018  #endif
    1019  
    1020  #if @GNULIB_PTHREAD_MUTEX@
    1021  # if @REPLACE_PTHREAD_MUTEX_TRYLOCK@
    1022  #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    1023  #   undef pthread_mutex_trylock
    1024  #   define pthread_mutex_trylock rpl_pthread_mutex_trylock
    1025  #  endif
    1026  _GL_FUNCDECL_RPL (pthread_mutex_trylock, int, (pthread_mutex_t *mutex)
    1027                                                _GL_ARG_NONNULL ((1)));
    1028  _GL_CXXALIAS_RPL (pthread_mutex_trylock, int, (pthread_mutex_t *mutex));
    1029  # else
    1030  #  if !@HAVE_PTHREAD_MUTEX_TRYLOCK@
    1031  _GL_FUNCDECL_SYS (pthread_mutex_trylock, int, (pthread_mutex_t *mutex)
    1032                                                _GL_ARG_NONNULL ((1)));
    1033  #  endif
    1034  _GL_CXXALIAS_SYS (pthread_mutex_trylock, int, (pthread_mutex_t *mutex));
    1035  # endif
    1036  # if __GLIBC__ >= 2
    1037  _GL_CXXALIASWARN (pthread_mutex_trylock);
    1038  # endif
    1039  #elif defined GNULIB_POSIXCHECK
    1040  # undef pthread_mutex_trylock
    1041  # if HAVE_RAW_DECL_PTHREAD_MUTEX_TRYLOCK
    1042  _GL_WARN_ON_USE (pthread_mutex_trylock, "pthread_mutex_trylock is not portable - "
    1043                   "use gnulib module pthread-mutex for portability");
    1044  # endif
    1045  #endif
    1046  
    1047  #if @GNULIB_PTHREAD_MUTEX_TIMEDLOCK@
    1048  # if @REPLACE_PTHREAD_MUTEX_TIMEDLOCK@
    1049  #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    1050  #   undef pthread_mutex_timedlock
    1051  #   define pthread_mutex_timedlock rpl_pthread_mutex_timedlock
    1052  #  endif
    1053  _GL_FUNCDECL_RPL (pthread_mutex_timedlock, int,
    1054                    (pthread_mutex_t *restrict mutex,
    1055                     const struct timespec *restrict abstime)
    1056                    _GL_ARG_NONNULL ((1, 2)));
    1057  _GL_CXXALIAS_RPL (pthread_mutex_timedlock, int,
    1058                    (pthread_mutex_t *restrict mutex,
    1059                     const struct timespec *restrict abstime));
    1060  # else
    1061  #  if !@HAVE_PTHREAD_MUTEX_TIMEDLOCK@
    1062  _GL_FUNCDECL_SYS (pthread_mutex_timedlock, int,
    1063                    (pthread_mutex_t *restrict mutex,
    1064                     const struct timespec *restrict abstime)
    1065                    _GL_ARG_NONNULL ((1, 2)));
    1066  #  endif
    1067  _GL_CXXALIAS_SYS (pthread_mutex_timedlock, int,
    1068                    (pthread_mutex_t *restrict mutex,
    1069                     const struct timespec *restrict abstime));
    1070  # endif
    1071  # if __GLIBC__ >= 2
    1072  _GL_CXXALIASWARN (pthread_mutex_timedlock);
    1073  # endif
    1074  #elif defined GNULIB_POSIXCHECK
    1075  # undef pthread_mutex_timedlock
    1076  # if HAVE_RAW_DECL_PTHREAD_MUTEX_TIMEDLOCK
    1077  _GL_WARN_ON_USE (pthread_mutex_timedlock, "pthread_mutex_timedlock is not portable - "
    1078                   "use gnulib module pthread_mutex_timedlock for portability");
    1079  # endif
    1080  #endif
    1081  
    1082  #if @GNULIB_PTHREAD_MUTEX@
    1083  # if @REPLACE_PTHREAD_MUTEX_UNLOCK@
    1084  #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    1085  #   undef pthread_mutex_unlock
    1086  #   define pthread_mutex_unlock rpl_pthread_mutex_unlock
    1087  #  endif
    1088  _GL_FUNCDECL_RPL (pthread_mutex_unlock, int, (pthread_mutex_t *mutex)
    1089                                               _GL_ARG_NONNULL ((1)));
    1090  _GL_CXXALIAS_RPL (pthread_mutex_unlock, int, (pthread_mutex_t *mutex));
    1091  # else
    1092  #  if !@HAVE_PTHREAD_MUTEX_UNLOCK@
    1093  _GL_FUNCDECL_SYS (pthread_mutex_unlock, int, (pthread_mutex_t *mutex)
    1094                                               _GL_ARG_NONNULL ((1)));
    1095  #  endif
    1096  _GL_CXXALIAS_SYS (pthread_mutex_unlock, int, (pthread_mutex_t *mutex));
    1097  # endif
    1098  # if __GLIBC__ >= 2
    1099  _GL_CXXALIASWARN (pthread_mutex_unlock);
    1100  # endif
    1101  #elif defined GNULIB_POSIXCHECK
    1102  # undef pthread_mutex_unlock
    1103  # if HAVE_RAW_DECL_PTHREAD_MUTEX_UNLOCK
    1104  _GL_WARN_ON_USE (pthread_mutex_unlock, "pthread_mutex_unlock is not portable - "
    1105                   "use gnulib module pthread-mutex for portability");
    1106  # endif
    1107  #endif
    1108  
    1109  #if @GNULIB_PTHREAD_MUTEX@
    1110  # if @REPLACE_PTHREAD_MUTEX_DESTROY@
    1111  #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    1112  #   undef pthread_mutex_destroy
    1113  #   define pthread_mutex_destroy rpl_pthread_mutex_destroy
    1114  #  endif
    1115  _GL_FUNCDECL_RPL (pthread_mutex_destroy, int, (pthread_mutex_t *mutex)
    1116                                                _GL_ARG_NONNULL ((1)));
    1117  _GL_CXXALIAS_RPL (pthread_mutex_destroy, int, (pthread_mutex_t *mutex));
    1118  # else
    1119  #  if !@HAVE_PTHREAD_MUTEX_DESTROY@
    1120  _GL_FUNCDECL_SYS (pthread_mutex_destroy, int, (pthread_mutex_t *mutex)
    1121                                                _GL_ARG_NONNULL ((1)));
    1122  #  endif
    1123  _GL_CXXALIAS_SYS (pthread_mutex_destroy, int, (pthread_mutex_t *mutex));
    1124  # endif
    1125  # if __GLIBC__ >= 2
    1126  _GL_CXXALIASWARN (pthread_mutex_destroy);
    1127  # endif
    1128  #elif defined GNULIB_POSIXCHECK
    1129  # undef pthread_mutex_destroy
    1130  # if HAVE_RAW_DECL_PTHREAD_MUTEX_DESTROY
    1131  _GL_WARN_ON_USE (pthread_mutex_destroy, "pthread_mutex_destroy is not portable - "
    1132                   "use gnulib module pthread-mutex for portability");
    1133  # endif
    1134  #endif
    1135  
    1136  /* =========== Read-write lock functions =========== */
    1137  
    1138  #if @GNULIB_PTHREAD_RWLOCK@
    1139  # if @REPLACE_PTHREAD_RWLOCK_INIT@
    1140  #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    1141  #   undef pthread_rwlock_init
    1142  #   define pthread_rwlock_init rpl_pthread_rwlock_init
    1143  #  endif
    1144  _GL_FUNCDECL_RPL (pthread_rwlock_init, int,
    1145                    (pthread_rwlock_t *restrict lock,
    1146                     const pthread_rwlockattr_t *restrict attr)
    1147                    _GL_ARG_NONNULL ((1)));
    1148  _GL_CXXALIAS_RPL (pthread_rwlock_init, int,
    1149                    (pthread_rwlock_t *restrict lock,
    1150                     const pthread_rwlockattr_t *restrict attr));
    1151  # else
    1152  #  if !@HAVE_PTHREAD_RWLOCK_INIT@
    1153  _GL_FUNCDECL_SYS (pthread_rwlock_init, int,
    1154                    (pthread_rwlock_t *restrict lock,
    1155                     const pthread_rwlockattr_t *restrict attr)
    1156                    _GL_ARG_NONNULL ((1)));
    1157  #  endif
    1158  _GL_CXXALIAS_SYS (pthread_rwlock_init, int,
    1159                    (pthread_rwlock_t *restrict lock,
    1160                     const pthread_rwlockattr_t *restrict attr));
    1161  # endif
    1162  # if __GLIBC__ >= 2
    1163  _GL_CXXALIASWARN (pthread_rwlock_init);
    1164  # endif
    1165  #elif defined GNULIB_POSIXCHECK
    1166  # undef pthread_rwlock_init
    1167  # if HAVE_RAW_DECL_PTHREAD_RWLOCK_INIT
    1168  _GL_WARN_ON_USE (pthread_rwlock_init, "pthread_rwlock_init is not portable - "
    1169                   "use gnulib module pthread-rwlock for portability");
    1170  # endif
    1171  #endif
    1172  
    1173  #if @GNULIB_PTHREAD_RWLOCK@
    1174  # if @REPLACE_PTHREAD_RWLOCKATTR_INIT@
    1175  #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    1176  #   undef pthread_rwlockattr_init
    1177  #   define pthread_rwlockattr_init rpl_pthread_rwlockattr_init
    1178  #  endif
    1179  _GL_FUNCDECL_RPL (pthread_rwlockattr_init, int, (pthread_rwlockattr_t *attr)
    1180                                                  _GL_ARG_NONNULL ((1)));
    1181  _GL_CXXALIAS_RPL (pthread_rwlockattr_init, int, (pthread_rwlockattr_t *attr));
    1182  # else
    1183  #  if !@HAVE_PTHREAD_RWLOCKATTR_INIT@
    1184  _GL_FUNCDECL_SYS (pthread_rwlockattr_init, int, (pthread_rwlockattr_t *attr)
    1185                                                  _GL_ARG_NONNULL ((1)));
    1186  #  endif
    1187  _GL_CXXALIAS_SYS (pthread_rwlockattr_init, int, (pthread_rwlockattr_t *attr));
    1188  # endif
    1189  # if __GLIBC__ >= 2
    1190  _GL_CXXALIASWARN (pthread_rwlockattr_init);
    1191  # endif
    1192  #elif defined GNULIB_POSIXCHECK
    1193  # undef pthread_rwlockattr_init
    1194  # if HAVE_RAW_DECL_PTHREAD_RWLOCKATTR_INIT
    1195  _GL_WARN_ON_USE (pthread_rwlockattr_init, "pthread_rwlockattr_init is not portable - "
    1196                   "use gnulib module pthread-rwlock for portability");
    1197  # endif
    1198  #endif
    1199  
    1200  #if @GNULIB_PTHREAD_RWLOCK@
    1201  # if @REPLACE_PTHREAD_RWLOCKATTR_DESTROY@
    1202  #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    1203  #   undef pthread_rwlockattr_destroy
    1204  #   define pthread_rwlockattr_destroy rpl_pthread_rwlockattr_destroy
    1205  #  endif
    1206  _GL_FUNCDECL_RPL (pthread_rwlockattr_destroy, int,
    1207                    (pthread_rwlockattr_t *attr) _GL_ARG_NONNULL ((1)));
    1208  _GL_CXXALIAS_RPL (pthread_rwlockattr_destroy, int,
    1209                    (pthread_rwlockattr_t *attr));
    1210  # else
    1211  #  if !@HAVE_PTHREAD_RWLOCKATTR_DESTROY@
    1212  _GL_FUNCDECL_SYS (pthread_rwlockattr_destroy, int,
    1213                    (pthread_rwlockattr_t *attr) _GL_ARG_NONNULL ((1)));
    1214  #  endif
    1215  _GL_CXXALIAS_SYS (pthread_rwlockattr_destroy, int,
    1216                    (pthread_rwlockattr_t *attr));
    1217  # endif
    1218  # if __GLIBC__ >= 2
    1219  _GL_CXXALIASWARN (pthread_rwlockattr_destroy);
    1220  # endif
    1221  #elif defined GNULIB_POSIXCHECK
    1222  # undef pthread_rwlockattr_destroy
    1223  # if HAVE_RAW_DECL_PTHREAD_RWLOCKATTR_DESTROY
    1224  _GL_WARN_ON_USE (pthread_rwlockattr_destroy, "pthread_rwlockattr_destroy is not portable - "
    1225                   "use gnulib module pthread-rwlock for portability");
    1226  # endif
    1227  #endif
    1228  
    1229  #if @GNULIB_PTHREAD_RWLOCK@
    1230  # if @REPLACE_PTHREAD_RWLOCK_RDLOCK@
    1231  #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    1232  #   undef pthread_rwlock_rdlock
    1233  #   define pthread_rwlock_rdlock rpl_pthread_rwlock_rdlock
    1234  #  endif
    1235  _GL_FUNCDECL_RPL (pthread_rwlock_rdlock, int, (pthread_rwlock_t *lock)
    1236                                                _GL_ARG_NONNULL ((1)));
    1237  _GL_CXXALIAS_RPL (pthread_rwlock_rdlock, int, (pthread_rwlock_t *lock));
    1238  # else
    1239  #  if !@HAVE_PTHREAD_RWLOCK_RDLOCK@
    1240  _GL_FUNCDECL_SYS (pthread_rwlock_rdlock, int, (pthread_rwlock_t *lock)
    1241                                                _GL_ARG_NONNULL ((1)));
    1242  #  endif
    1243  _GL_CXXALIAS_SYS (pthread_rwlock_rdlock, int, (pthread_rwlock_t *lock));
    1244  # endif
    1245  # if __GLIBC__ >= 2
    1246  _GL_CXXALIASWARN (pthread_rwlock_rdlock);
    1247  # endif
    1248  #elif defined GNULIB_POSIXCHECK
    1249  # undef pthread_rwlock_rdlock
    1250  # if HAVE_RAW_DECL_PTHREAD_RWLOCK_RDLOCK
    1251  _GL_WARN_ON_USE (pthread_rwlock_rdlock, "pthread_rwlock_rdlock is not portable - "
    1252                   "use gnulib module pthread-rwlock for portability");
    1253  # endif
    1254  #endif
    1255  
    1256  #if @GNULIB_PTHREAD_RWLOCK@
    1257  # if @REPLACE_PTHREAD_RWLOCK_WRLOCK@
    1258  #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    1259  #   undef pthread_rwlock_wrlock
    1260  #   define pthread_rwlock_wrlock rpl_pthread_rwlock_wrlock
    1261  #  endif
    1262  _GL_FUNCDECL_RPL (pthread_rwlock_wrlock, int, (pthread_rwlock_t *lock)
    1263                                                _GL_ARG_NONNULL ((1)));
    1264  _GL_CXXALIAS_RPL (pthread_rwlock_wrlock, int, (pthread_rwlock_t *lock));
    1265  # else
    1266  #  if !@HAVE_PTHREAD_RWLOCK_WRLOCK@
    1267  _GL_FUNCDECL_SYS (pthread_rwlock_wrlock, int, (pthread_rwlock_t *lock)
    1268                                                _GL_ARG_NONNULL ((1)));
    1269  #  endif
    1270  _GL_CXXALIAS_SYS (pthread_rwlock_wrlock, int, (pthread_rwlock_t *lock));
    1271  # endif
    1272  # if __GLIBC__ >= 2
    1273  _GL_CXXALIASWARN (pthread_rwlock_wrlock);
    1274  # endif
    1275  #elif defined GNULIB_POSIXCHECK
    1276  # undef pthread_rwlock_wrlock
    1277  # if HAVE_RAW_DECL_PTHREAD_RWLOCK_WRLOCK
    1278  _GL_WARN_ON_USE (pthread_rwlock_wrlock, "pthread_rwlock_wrlock is not portable - "
    1279                   "use gnulib module pthread-rwlock for portability");
    1280  # endif
    1281  #endif
    1282  
    1283  #if @GNULIB_PTHREAD_RWLOCK@
    1284  # if @REPLACE_PTHREAD_RWLOCK_TRYRDLOCK@
    1285  #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    1286  #   undef pthread_rwlock_tryrdlock
    1287  #   define pthread_rwlock_tryrdlock rpl_pthread_rwlock_tryrdlock
    1288  #  endif
    1289  _GL_FUNCDECL_RPL (pthread_rwlock_tryrdlock, int, (pthread_rwlock_t *lock)
    1290                                                   _GL_ARG_NONNULL ((1)));
    1291  _GL_CXXALIAS_RPL (pthread_rwlock_tryrdlock, int, (pthread_rwlock_t *lock));
    1292  # else
    1293  #  if !@HAVE_PTHREAD_RWLOCK_TRYRDLOCK@
    1294  _GL_FUNCDECL_SYS (pthread_rwlock_tryrdlock, int, (pthread_rwlock_t *lock)
    1295                                                   _GL_ARG_NONNULL ((1)));
    1296  #  endif
    1297  _GL_CXXALIAS_SYS (pthread_rwlock_tryrdlock, int, (pthread_rwlock_t *lock));
    1298  # endif
    1299  # if __GLIBC__ >= 2
    1300  _GL_CXXALIASWARN (pthread_rwlock_tryrdlock);
    1301  # endif
    1302  #elif defined GNULIB_POSIXCHECK
    1303  # undef pthread_rwlock_tryrdlock
    1304  # if HAVE_RAW_DECL_PTHREAD_RWLOCK_TRYRDLOCK
    1305  _GL_WARN_ON_USE (pthread_rwlock_tryrdlock, "pthread_rwlock_tryrdlock is not portable - "
    1306                   "use gnulib module pthread-rwlock for portability");
    1307  # endif
    1308  #endif
    1309  
    1310  #if @GNULIB_PTHREAD_RWLOCK@
    1311  # if @REPLACE_PTHREAD_RWLOCK_TRYWRLOCK@
    1312  #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    1313  #   undef pthread_rwlock_trywrlock
    1314  #   define pthread_rwlock_trywrlock rpl_pthread_rwlock_trywrlock
    1315  #  endif
    1316  _GL_FUNCDECL_RPL (pthread_rwlock_trywrlock, int, (pthread_rwlock_t *lock)
    1317                                                   _GL_ARG_NONNULL ((1)));
    1318  _GL_CXXALIAS_RPL (pthread_rwlock_trywrlock, int, (pthread_rwlock_t *lock));
    1319  # else
    1320  #  if !@HAVE_PTHREAD_RWLOCK_TRYWRLOCK@
    1321  _GL_FUNCDECL_SYS (pthread_rwlock_trywrlock, int, (pthread_rwlock_t *lock)
    1322                                                   _GL_ARG_NONNULL ((1)));
    1323  #  endif
    1324  _GL_CXXALIAS_SYS (pthread_rwlock_trywrlock, int, (pthread_rwlock_t *lock));
    1325  # endif
    1326  # if __GLIBC__ >= 2
    1327  _GL_CXXALIASWARN (pthread_rwlock_trywrlock);
    1328  # endif
    1329  #elif defined GNULIB_POSIXCHECK
    1330  # undef pthread_rwlock_trywrlock
    1331  # if HAVE_RAW_DECL_PTHREAD_RWLOCK_TRYWRLOCK
    1332  _GL_WARN_ON_USE (pthread_rwlock_trywrlock, "pthread_rwlock_trywrlock is not portable - "
    1333                   "use gnulib module pthread-rwlock for portability");
    1334  # endif
    1335  #endif
    1336  
    1337  #if @GNULIB_PTHREAD_RWLOCK@
    1338  # if @REPLACE_PTHREAD_RWLOCK_TIMEDRDLOCK@
    1339  #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    1340  #   undef pthread_rwlock_timedrdlock
    1341  #   define pthread_rwlock_timedrdlock rpl_pthread_rwlock_timedrdlock
    1342  #  endif
    1343  _GL_FUNCDECL_RPL (pthread_rwlock_timedrdlock, int,
    1344                    (pthread_rwlock_t *restrict lock,
    1345                     const struct timespec *restrict abstime)
    1346                    _GL_ARG_NONNULL ((1, 2)));
    1347  _GL_CXXALIAS_RPL (pthread_rwlock_timedrdlock, int,
    1348                    (pthread_rwlock_t *restrict lock,
    1349                     const struct timespec *restrict abstime));
    1350  # else
    1351  #  if !@HAVE_PTHREAD_RWLOCK_TIMEDRDLOCK@
    1352  _GL_FUNCDECL_SYS (pthread_rwlock_timedrdlock, int,
    1353                    (pthread_rwlock_t *restrict lock,
    1354                     const struct timespec *restrict abstime)
    1355                    _GL_ARG_NONNULL ((1, 2)));
    1356  #  endif
    1357  _GL_CXXALIAS_SYS (pthread_rwlock_timedrdlock, int,
    1358                    (pthread_rwlock_t *restrict lock,
    1359                     const struct timespec *restrict abstime));
    1360  # endif
    1361  # if __GLIBC__ >= 2
    1362  _GL_CXXALIASWARN (pthread_rwlock_timedrdlock);
    1363  # endif
    1364  #elif defined GNULIB_POSIXCHECK
    1365  # undef pthread_rwlock_timedrdlock
    1366  # if HAVE_RAW_DECL_PTHREAD_RWLOCK_TIMEDRDLOCK
    1367  _GL_WARN_ON_USE (pthread_rwlock_timedrdlock, "pthread_rwlock_timedrdlock is not portable - "
    1368                   "use gnulib module pthread-rwlock for portability");
    1369  # endif
    1370  #endif
    1371  
    1372  #if @GNULIB_PTHREAD_RWLOCK@
    1373  # if @REPLACE_PTHREAD_RWLOCK_TIMEDWRLOCK@
    1374  #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    1375  #   undef pthread_rwlock_timedwrlock
    1376  #   define pthread_rwlock_timedwrlock rpl_pthread_rwlock_timedwrlock
    1377  #  endif
    1378  _GL_FUNCDECL_RPL (pthread_rwlock_timedwrlock, int,
    1379                    (pthread_rwlock_t *restrict lock,
    1380                     const struct timespec *restrict abstime)
    1381                    _GL_ARG_NONNULL ((1, 2)));
    1382  _GL_CXXALIAS_RPL (pthread_rwlock_timedwrlock, int,
    1383                    (pthread_rwlock_t *restrict lock,
    1384                     const struct timespec *restrict abstime));
    1385  # else
    1386  #  if !@HAVE_PTHREAD_RWLOCK_TIMEDWRLOCK@
    1387  _GL_FUNCDECL_SYS (pthread_rwlock_timedwrlock, int,
    1388                    (pthread_rwlock_t *restrict lock,
    1389                     const struct timespec *restrict abstime)
    1390                    _GL_ARG_NONNULL ((1, 2)));
    1391  #  endif
    1392  _GL_CXXALIAS_SYS (pthread_rwlock_timedwrlock, int,
    1393                    (pthread_rwlock_t *restrict lock,
    1394                     const struct timespec *restrict abstime));
    1395  # endif
    1396  # if __GLIBC__ >= 2
    1397  _GL_CXXALIASWARN (pthread_rwlock_timedwrlock);
    1398  # endif
    1399  #elif defined GNULIB_POSIXCHECK
    1400  # undef pthread_rwlock_timedwrlock
    1401  # if HAVE_RAW_DECL_PTHREAD_RWLOCK_TIMEDWRLOCK
    1402  _GL_WARN_ON_USE (pthread_rwlock_timedwrlock, "pthread_rwlock_timedwrlock is not portable - "
    1403                   "use gnulib module pthread-rwlock for portability");
    1404  # endif
    1405  #endif
    1406  
    1407  #if @GNULIB_PTHREAD_RWLOCK@
    1408  # if @REPLACE_PTHREAD_RWLOCK_UNLOCK@
    1409  #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    1410  #   undef pthread_rwlock_unlock
    1411  #   define pthread_rwlock_unlock rpl_pthread_rwlock_unlock
    1412  #  endif
    1413  _GL_FUNCDECL_RPL (pthread_rwlock_unlock, int, (pthread_rwlock_t *lock)
    1414                                                _GL_ARG_NONNULL ((1)));
    1415  _GL_CXXALIAS_RPL (pthread_rwlock_unlock, int, (pthread_rwlock_t *lock));
    1416  # else
    1417  #  if !@HAVE_PTHREAD_RWLOCK_UNLOCK@
    1418  _GL_FUNCDECL_SYS (pthread_rwlock_unlock, int, (pthread_rwlock_t *lock)
    1419                                                _GL_ARG_NONNULL ((1)));
    1420  #  endif
    1421  _GL_CXXALIAS_SYS (pthread_rwlock_unlock, int, (pthread_rwlock_t *lock));
    1422  # endif
    1423  # if __GLIBC__ >= 2
    1424  _GL_CXXALIASWARN (pthread_rwlock_unlock);
    1425  # endif
    1426  #elif defined GNULIB_POSIXCHECK
    1427  # undef pthread_rwlock_unlock
    1428  # if HAVE_RAW_DECL_PTHREAD_RWLOCK_UNLOCK
    1429  _GL_WARN_ON_USE (pthread_rwlock_unlock, "pthread_rwlock_unlock is not portable - "
    1430                   "use gnulib module pthread-rwlock for portability");
    1431  # endif
    1432  #endif
    1433  
    1434  #if @GNULIB_PTHREAD_RWLOCK@
    1435  # if @REPLACE_PTHREAD_RWLOCK_DESTROY@
    1436  #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    1437  #   undef pthread_rwlock_destroy
    1438  #   define pthread_rwlock_destroy rpl_pthread_rwlock_destroy
    1439  #  endif
    1440  _GL_FUNCDECL_RPL (pthread_rwlock_destroy, int, (pthread_rwlock_t *lock)
    1441                                                 _GL_ARG_NONNULL ((1)));
    1442  _GL_CXXALIAS_RPL (pthread_rwlock_destroy, int, (pthread_rwlock_t *lock));
    1443  # else
    1444  #  if !@HAVE_PTHREAD_RWLOCK_DESTROY@
    1445  _GL_FUNCDECL_SYS (pthread_rwlock_destroy, int, (pthread_rwlock_t *lock)
    1446                                                 _GL_ARG_NONNULL ((1)));
    1447  #  endif
    1448  _GL_CXXALIAS_SYS (pthread_rwlock_destroy, int, (pthread_rwlock_t *lock));
    1449  # endif
    1450  # if __GLIBC__ >= 2
    1451  _GL_CXXALIASWARN (pthread_rwlock_destroy);
    1452  # endif
    1453  #elif defined GNULIB_POSIXCHECK
    1454  # undef pthread_rwlock_destroy
    1455  # if HAVE_RAW_DECL_PTHREAD_RWLOCK_DESTROY
    1456  _GL_WARN_ON_USE (pthread_rwlock_destroy, "pthread_rwlock_destroy is not portable - "
    1457                   "use gnulib module pthread-rwlock for portability");
    1458  # endif
    1459  #endif
    1460  
    1461  /* =========== Condition variable functions =========== */
    1462  
    1463  #if @GNULIB_PTHREAD_COND@
    1464  # if @REPLACE_PTHREAD_COND_INIT@
    1465  #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    1466  #   undef pthread_cond_init
    1467  #   define pthread_cond_init rpl_pthread_cond_init
    1468  #  endif
    1469  _GL_FUNCDECL_RPL (pthread_cond_init, int,
    1470                    (pthread_cond_t *restrict cond,
    1471                     const pthread_condattr_t *restrict attr)
    1472                    _GL_ARG_NONNULL ((1)));
    1473  _GL_CXXALIAS_RPL (pthread_cond_init, int,
    1474                    (pthread_cond_t *restrict cond,
    1475                     const pthread_condattr_t *restrict attr));
    1476  # else
    1477  #  if !@HAVE_PTHREAD_COND_INIT@
    1478  _GL_FUNCDECL_SYS (pthread_cond_init, int,
    1479                    (pthread_cond_t *restrict cond,
    1480                     const pthread_condattr_t *restrict attr)
    1481                    _GL_ARG_NONNULL ((1)));
    1482  #  endif
    1483  _GL_CXXALIAS_SYS (pthread_cond_init, int,
    1484                    (pthread_cond_t *restrict cond,
    1485                     const pthread_condattr_t *restrict attr));
    1486  # endif
    1487  # if __GLIBC__ >= 2
    1488  _GL_CXXALIASWARN (pthread_cond_init);
    1489  # endif
    1490  #elif defined GNULIB_POSIXCHECK
    1491  # undef pthread_cond_init
    1492  # if HAVE_RAW_DECL_PTHREAD_COND_INIT
    1493  _GL_WARN_ON_USE (pthread_cond_init, "pthread_cond_init is not portable - "
    1494                   "use gnulib module pthread-cond for portability");
    1495  # endif
    1496  #endif
    1497  
    1498  #if @GNULIB_PTHREAD_COND@
    1499  # if @REPLACE_PTHREAD_CONDATTR_INIT@
    1500  #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    1501  #   undef pthread_condattr_init
    1502  #   define pthread_condattr_init rpl_pthread_condattr_init
    1503  #  endif
    1504  _GL_FUNCDECL_RPL (pthread_condattr_init, int, (pthread_condattr_t *attr)
    1505                                                _GL_ARG_NONNULL ((1)));
    1506  _GL_CXXALIAS_RPL (pthread_condattr_init, int, (pthread_condattr_t *attr));
    1507  # else
    1508  #  if !@HAVE_PTHREAD_CONDATTR_INIT@
    1509  _GL_FUNCDECL_SYS (pthread_condattr_init, int, (pthread_condattr_t *attr)
    1510                                                _GL_ARG_NONNULL ((1)));
    1511  #  endif
    1512  _GL_CXXALIAS_SYS (pthread_condattr_init, int, (pthread_condattr_t *attr));
    1513  # endif
    1514  # if __GLIBC__ >= 2
    1515  _GL_CXXALIASWARN (pthread_condattr_init);
    1516  # endif
    1517  #elif defined GNULIB_POSIXCHECK
    1518  # undef pthread_condattr_init
    1519  # if HAVE_RAW_DECL_PTHREAD_CONDATTR_INIT
    1520  _GL_WARN_ON_USE (pthread_condattr_init, "pthread_condattr_init is not portable - "
    1521                   "use gnulib module pthread-cond for portability");
    1522  # endif
    1523  #endif
    1524  
    1525  #if @GNULIB_PTHREAD_COND@
    1526  # if @REPLACE_PTHREAD_CONDATTR_DESTROY@
    1527  #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    1528  #   undef pthread_condattr_destroy
    1529  #   define pthread_condattr_destroy rpl_pthread_condattr_destroy
    1530  #  endif
    1531  _GL_FUNCDECL_RPL (pthread_condattr_destroy, int, (pthread_condattr_t *attr)
    1532                                                   _GL_ARG_NONNULL ((1)));
    1533  _GL_CXXALIAS_RPL (pthread_condattr_destroy, int, (pthread_condattr_t *attr));
    1534  # else
    1535  #  if !@HAVE_PTHREAD_CONDATTR_DESTROY@
    1536  _GL_FUNCDECL_SYS (pthread_condattr_destroy, int, (pthread_condattr_t *attr)
    1537                                                   _GL_ARG_NONNULL ((1)));
    1538  #  endif
    1539  _GL_CXXALIAS_SYS (pthread_condattr_destroy, int, (pthread_condattr_t *attr));
    1540  # endif
    1541  # if __GLIBC__ >= 2
    1542  _GL_CXXALIASWARN (pthread_condattr_destroy);
    1543  # endif
    1544  #elif defined GNULIB_POSIXCHECK
    1545  # undef pthread_condattr_destroy
    1546  # if HAVE_RAW_DECL_PTHREAD_CONDATTR_DESTROY
    1547  _GL_WARN_ON_USE (pthread_condattr_destroy, "pthread_condattr_destroy is not portable - "
    1548                   "use gnulib module pthread-cond for portability");
    1549  # endif
    1550  #endif
    1551  
    1552  #if @GNULIB_PTHREAD_COND@
    1553  # if @REPLACE_PTHREAD_COND_WAIT@
    1554  #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    1555  #   undef pthread_cond_wait
    1556  #   define pthread_cond_wait rpl_pthread_cond_wait
    1557  #  endif
    1558  _GL_FUNCDECL_RPL (pthread_cond_wait, int,
    1559                    (pthread_cond_t *restrict cond,
    1560                     pthread_mutex_t *restrict mutex)
    1561                    _GL_ARG_NONNULL ((1, 2)));
    1562  _GL_CXXALIAS_RPL (pthread_cond_wait, int,
    1563                    (pthread_cond_t *restrict cond,
    1564                     pthread_mutex_t *restrict mutex));
    1565  # else
    1566  #  if !@HAVE_PTHREAD_COND_WAIT@
    1567  _GL_FUNCDECL_SYS (pthread_cond_wait, int,
    1568                    (pthread_cond_t *restrict cond,
    1569                     pthread_mutex_t *restrict mutex)
    1570                    _GL_ARG_NONNULL ((1, 2)));
    1571  #  endif
    1572  _GL_CXXALIAS_SYS (pthread_cond_wait, int,
    1573                    (pthread_cond_t *restrict cond,
    1574                     pthread_mutex_t *restrict mutex));
    1575  # endif
    1576  # if __GLIBC__ >= 2
    1577  _GL_CXXALIASWARN (pthread_cond_wait);
    1578  # endif
    1579  #elif defined GNULIB_POSIXCHECK
    1580  # undef pthread_cond_wait
    1581  # if HAVE_RAW_DECL_PTHREAD_COND_WAIT
    1582  _GL_WARN_ON_USE (pthread_cond_wait, "pthread_cond_wait is not portable - "
    1583                   "use gnulib module pthread-cond for portability");
    1584  # endif
    1585  #endif
    1586  
    1587  #if @GNULIB_PTHREAD_COND@
    1588  # if @REPLACE_PTHREAD_COND_TIMEDWAIT@
    1589  #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    1590  #   undef pthread_cond_timedwait
    1591  #   define pthread_cond_timedwait rpl_pthread_cond_timedwait
    1592  #  endif
    1593  _GL_FUNCDECL_RPL (pthread_cond_timedwait, int,
    1594                    (pthread_cond_t *restrict cond,
    1595                     pthread_mutex_t *restrict mutex,
    1596                     const struct timespec *restrict abstime)
    1597                    _GL_ARG_NONNULL ((1, 2, 3)));
    1598  _GL_CXXALIAS_RPL (pthread_cond_timedwait, int,
    1599                    (pthread_cond_t *restrict cond,
    1600                     pthread_mutex_t *restrict mutex,
    1601                     const struct timespec *restrict abstime));
    1602  # else
    1603  #  if !@HAVE_PTHREAD_COND_TIMEDWAIT@
    1604  _GL_FUNCDECL_SYS (pthread_cond_timedwait, int,
    1605                    (pthread_cond_t *restrict cond,
    1606                     pthread_mutex_t *restrict mutex,
    1607                     const struct timespec *restrict abstime)
    1608                    _GL_ARG_NONNULL ((1, 2, 3)));
    1609  #  endif
    1610  _GL_CXXALIAS_SYS (pthread_cond_timedwait, int,
    1611                    (pthread_cond_t *restrict cond,
    1612                     pthread_mutex_t *restrict mutex,
    1613                     const struct timespec *restrict abstime));
    1614  # endif
    1615  # if __GLIBC__ >= 2
    1616  _GL_CXXALIASWARN (pthread_cond_timedwait);
    1617  # endif
    1618  #elif defined GNULIB_POSIXCHECK
    1619  # undef pthread_cond_timedwait
    1620  # if HAVE_RAW_DECL_PTHREAD_COND_TIMEDWAIT
    1621  _GL_WARN_ON_USE (pthread_cond_timedwait, "pthread_cond_timedwait is not portable - "
    1622                   "use gnulib module pthread-cond for portability");
    1623  # endif
    1624  #endif
    1625  
    1626  #if @GNULIB_PTHREAD_COND@
    1627  # if @REPLACE_PTHREAD_COND_SIGNAL@
    1628  #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    1629  #   undef pthread_cond_signal
    1630  #   define pthread_cond_signal rpl_pthread_cond_signal
    1631  #  endif
    1632  _GL_FUNCDECL_RPL (pthread_cond_signal, int, (pthread_cond_t *cond)
    1633                                              _GL_ARG_NONNULL ((1)));
    1634  _GL_CXXALIAS_RPL (pthread_cond_signal, int, (pthread_cond_t *cond));
    1635  # else
    1636  #  if !@HAVE_PTHREAD_COND_SIGNAL@
    1637  _GL_FUNCDECL_SYS (pthread_cond_signal, int, (pthread_cond_t *cond)
    1638                                              _GL_ARG_NONNULL ((1)));
    1639  #  endif
    1640  _GL_CXXALIAS_SYS (pthread_cond_signal, int, (pthread_cond_t *cond));
    1641  # endif
    1642  # if __GLIBC__ >= 2
    1643  _GL_CXXALIASWARN (pthread_cond_signal);
    1644  # endif
    1645  #elif defined GNULIB_POSIXCHECK
    1646  # undef pthread_cond_signal
    1647  # if HAVE_RAW_DECL_PTHREAD_COND_SIGNAL
    1648  _GL_WARN_ON_USE (pthread_cond_signal, "pthread_cond_signal is not portable - "
    1649                   "use gnulib module pthread-cond for portability");
    1650  # endif
    1651  #endif
    1652  
    1653  #if @GNULIB_PTHREAD_COND@
    1654  # if @REPLACE_PTHREAD_COND_BROADCAST@
    1655  #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    1656  #   undef pthread_cond_broadcast
    1657  #   define pthread_cond_broadcast rpl_pthread_cond_broadcast
    1658  #  endif
    1659  _GL_FUNCDECL_RPL (pthread_cond_broadcast, int, (pthread_cond_t *cond)
    1660                                                 _GL_ARG_NONNULL ((1)));
    1661  _GL_CXXALIAS_RPL (pthread_cond_broadcast, int, (pthread_cond_t *cond));
    1662  # else
    1663  #  if !@HAVE_PTHREAD_COND_BROADCAST@
    1664  _GL_FUNCDECL_SYS (pthread_cond_broadcast, int, (pthread_cond_t *cond)
    1665                                                 _GL_ARG_NONNULL ((1)));
    1666  #  endif
    1667  _GL_CXXALIAS_SYS (pthread_cond_broadcast, int, (pthread_cond_t *cond));
    1668  # endif
    1669  # if __GLIBC__ >= 2
    1670  _GL_CXXALIASWARN (pthread_cond_broadcast);
    1671  # endif
    1672  #elif defined GNULIB_POSIXCHECK
    1673  # undef pthread_cond_broadcast
    1674  # if HAVE_RAW_DECL_PTHREAD_COND_BROADCAST
    1675  _GL_WARN_ON_USE (pthread_cond_broadcast, "pthread_cond_broadcast is not portable - "
    1676                   "use gnulib module pthread-cond for portability");
    1677  # endif
    1678  #endif
    1679  
    1680  #if @GNULIB_PTHREAD_COND@
    1681  # if @REPLACE_PTHREAD_COND_DESTROY@
    1682  #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    1683  #   undef pthread_cond_destroy
    1684  #   define pthread_cond_destroy rpl_pthread_cond_destroy
    1685  #  endif
    1686  _GL_FUNCDECL_RPL (pthread_cond_destroy, int, (pthread_cond_t *cond)
    1687                                               _GL_ARG_NONNULL ((1)));
    1688  _GL_CXXALIAS_RPL (pthread_cond_destroy, int, (pthread_cond_t *cond));
    1689  # else
    1690  #  if !@HAVE_PTHREAD_COND_DESTROY@
    1691  _GL_FUNCDECL_SYS (pthread_cond_destroy, int, (pthread_cond_t *cond)
    1692                                               _GL_ARG_NONNULL ((1)));
    1693  #  endif
    1694  _GL_CXXALIAS_SYS (pthread_cond_destroy, int, (pthread_cond_t *cond));
    1695  # endif
    1696  # if __GLIBC__ >= 2
    1697  _GL_CXXALIASWARN (pthread_cond_destroy);
    1698  # endif
    1699  #elif defined GNULIB_POSIXCHECK
    1700  # undef pthread_cond_destroy
    1701  # if HAVE_RAW_DECL_PTHREAD_COND_DESTROY
    1702  _GL_WARN_ON_USE (pthread_cond_destroy, "pthread_cond_destroy is not portable - "
    1703                   "use gnulib module pthread-cond for portability");
    1704  # endif
    1705  #endif
    1706  
    1707  /* =========== Thread-specific storage functions =========== */
    1708  
    1709  #if @GNULIB_PTHREAD_TSS@
    1710  # if @REPLACE_PTHREAD_KEY_CREATE@
    1711  #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    1712  #   undef pthread_key_create
    1713  #   define pthread_key_create rpl_pthread_key_create
    1714  #  endif
    1715  _GL_FUNCDECL_RPL (pthread_key_create, int,
    1716                    (pthread_key_t *keyp, void (*destructor) (void *))
    1717                    _GL_ARG_NONNULL ((1)));
    1718  _GL_CXXALIAS_RPL (pthread_key_create, int,
    1719                    (pthread_key_t *keyp, void (*destructor) (void *)));
    1720  # else
    1721  #  if !@HAVE_PTHREAD_KEY_CREATE@
    1722  _GL_FUNCDECL_SYS (pthread_key_create, int,
    1723                    (pthread_key_t *keyp, void (*destructor) (void *))
    1724                    _GL_ARG_NONNULL ((1)));
    1725  #  endif
    1726  _GL_CXXALIAS_SYS_CAST (pthread_key_create, int,
    1727                         (pthread_key_t *keyp, void (*destructor) (void *)));
    1728  # endif
    1729  # if __GLIBC__ >= 2
    1730  _GL_CXXALIASWARN (pthread_key_create);
    1731  # endif
    1732  #elif defined GNULIB_POSIXCHECK
    1733  # undef pthread_key_create
    1734  # if HAVE_RAW_DECL_PTHREAD_KEY_CREATE
    1735  _GL_WARN_ON_USE (pthread_key_create, "pthread_key_create is not portable - "
    1736                   "use gnulib module pthread-tss for portability");
    1737  # endif
    1738  #endif
    1739  
    1740  #if @GNULIB_PTHREAD_TSS@
    1741  # if @REPLACE_PTHREAD_SETSPECIFIC@
    1742  #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    1743  #   undef pthread_setspecific
    1744  #   define pthread_setspecific rpl_pthread_setspecific
    1745  #  endif
    1746  _GL_FUNCDECL_RPL (pthread_setspecific, int,
    1747                    (pthread_key_t key, const void *value));
    1748  _GL_CXXALIAS_RPL (pthread_setspecific, int,
    1749                    (pthread_key_t key, const void *value));
    1750  # else
    1751  #  if !@HAVE_PTHREAD_SETSPECIFIC@
    1752  _GL_FUNCDECL_SYS (pthread_setspecific, int,
    1753                    (pthread_key_t key, const void *value));
    1754  #  endif
    1755  _GL_CXXALIAS_SYS (pthread_setspecific, int,
    1756                    (pthread_key_t key, const void *value));
    1757  # endif
    1758  # if __GLIBC__ >= 2
    1759  _GL_CXXALIASWARN (pthread_setspecific);
    1760  # endif
    1761  #elif defined GNULIB_POSIXCHECK
    1762  # undef pthread_setspecific
    1763  # if HAVE_RAW_DECL_PTHREAD_SETSPECIFIC
    1764  _GL_WARN_ON_USE (pthread_setspecific, "pthread_setspecific is not portable - "
    1765                   "use gnulib module pthread-tss for portability");
    1766  # endif
    1767  #endif
    1768  
    1769  #if @GNULIB_PTHREAD_TSS@
    1770  # if @REPLACE_PTHREAD_GETSPECIFIC@
    1771  #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    1772  #   undef pthread_getspecific
    1773  #   define pthread_getspecific rpl_pthread_getspecific
    1774  #  endif
    1775  _GL_FUNCDECL_RPL (pthread_getspecific, void *, (pthread_key_t key));
    1776  _GL_CXXALIAS_RPL (pthread_getspecific, void *, (pthread_key_t key));
    1777  # else
    1778  #  if !@HAVE_PTHREAD_GETSPECIFIC@
    1779  _GL_FUNCDECL_SYS (pthread_getspecific, void *, (pthread_key_t key));
    1780  #  endif
    1781  _GL_CXXALIAS_SYS (pthread_getspecific, void *, (pthread_key_t key));
    1782  # endif
    1783  # if __GLIBC__ >= 2
    1784  _GL_CXXALIASWARN (pthread_getspecific);
    1785  # endif
    1786  #elif defined GNULIB_POSIXCHECK
    1787  # undef pthread_getspecific
    1788  # if HAVE_RAW_DECL_PTHREAD_GETSPECIFIC
    1789  _GL_WARN_ON_USE (pthread_getspecific, "pthread_getspecific is not portable - "
    1790                   "use gnulib module pthread-tss for portability");
    1791  # endif
    1792  #endif
    1793  
    1794  #if @GNULIB_PTHREAD_TSS@
    1795  # if @REPLACE_PTHREAD_KEY_DELETE@
    1796  #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    1797  #   undef pthread_key_delete
    1798  #   define pthread_key_delete rpl_pthread_key_delete
    1799  #  endif
    1800  _GL_FUNCDECL_RPL (pthread_key_delete, int, (pthread_key_t key));
    1801  _GL_CXXALIAS_RPL (pthread_key_delete, int, (pthread_key_t key));
    1802  # else
    1803  #  if !@HAVE_PTHREAD_KEY_DELETE@
    1804  _GL_FUNCDECL_SYS (pthread_key_delete, int, (pthread_key_t key));
    1805  #  endif
    1806  _GL_CXXALIAS_SYS (pthread_key_delete, int, (pthread_key_t key));
    1807  # endif
    1808  # if __GLIBC__ >= 2
    1809  _GL_CXXALIASWARN (pthread_key_delete);
    1810  # endif
    1811  #elif defined GNULIB_POSIXCHECK
    1812  # undef pthread_key_delete
    1813  # if HAVE_RAW_DECL_PTHREAD_KEY_DELETE
    1814  _GL_WARN_ON_USE (pthread_key_delete, "pthread_key_delete is not portable - "
    1815                   "use gnulib module pthread-tss for portability");
    1816  # endif
    1817  #endif
    1818  
    1819  /* =========== Spinlock functions =========== */
    1820  
    1821  #if @GNULIB_PTHREAD_SPIN@
    1822  # if @REPLACE_PTHREAD_SPIN_INIT@
    1823  #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    1824  #   undef pthread_spin_init
    1825  #   define pthread_spin_init rpl_pthread_spin_init
    1826  #  endif
    1827  _GL_FUNCDECL_RPL (pthread_spin_init, int,
    1828                    (pthread_spinlock_t *lock, int shared_across_processes)
    1829                    _GL_ARG_NONNULL ((1)));
    1830  _GL_CXXALIAS_RPL (pthread_spin_init, int,
    1831                    (pthread_spinlock_t *lock, int shared_across_processes));
    1832  # else
    1833  #  if !@HAVE_PTHREAD_SPIN_INIT@
    1834  _GL_FUNCDECL_SYS (pthread_spin_init, int,
    1835                    (pthread_spinlock_t *lock, int shared_across_processes)
    1836                    _GL_ARG_NONNULL ((1)));
    1837  #  endif
    1838  _GL_CXXALIAS_SYS (pthread_spin_init, int,
    1839                    (pthread_spinlock_t *lock, int shared_across_processes));
    1840  # endif
    1841  # if __GLIBC__ >= 2
    1842  _GL_CXXALIASWARN (pthread_spin_init);
    1843  # endif
    1844  #elif defined GNULIB_POSIXCHECK
    1845  # undef pthread_spin_init
    1846  # if HAVE_RAW_DECL_PTHREAD_SPIN_INIT
    1847  _GL_WARN_ON_USE (pthread_spin_init, "pthread_spin_init is not portable - "
    1848                   "use gnulib module pthread-spin for portability");
    1849  # endif
    1850  #endif
    1851  
    1852  #if @GNULIB_PTHREAD_SPIN@
    1853  # if @REPLACE_PTHREAD_SPIN_LOCK@
    1854  #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    1855  #   undef pthread_spin_lock
    1856  #   define pthread_spin_lock rpl_pthread_spin_lock
    1857  #  endif
    1858  _GL_FUNCDECL_RPL (pthread_spin_lock, int, (pthread_spinlock_t *lock)
    1859                                            _GL_ARG_NONNULL ((1)));
    1860  _GL_CXXALIAS_RPL (pthread_spin_lock, int, (pthread_spinlock_t *lock));
    1861  # else
    1862  #  if !@HAVE_PTHREAD_SPIN_LOCK@
    1863  _GL_FUNCDECL_SYS (pthread_spin_lock, int, (pthread_spinlock_t *lock)
    1864                                            _GL_ARG_NONNULL ((1)));
    1865  #  endif
    1866  _GL_CXXALIAS_SYS (pthread_spin_lock, int, (pthread_spinlock_t *lock));
    1867  # endif
    1868  # if __GLIBC__ >= 2
    1869  _GL_CXXALIASWARN (pthread_spin_lock);
    1870  # endif
    1871  #elif defined GNULIB_POSIXCHECK
    1872  # undef pthread_spin_lock
    1873  # if HAVE_RAW_DECL_PTHREAD_SPIN_LOCK
    1874  _GL_WARN_ON_USE (pthread_spin_lock, "pthread_spin_lock is not portable - "
    1875                   "use gnulib module pthread-spin for portability");
    1876  # endif
    1877  #endif
    1878  
    1879  #if @GNULIB_PTHREAD_SPIN@
    1880  # if @REPLACE_PTHREAD_SPIN_TRYLOCK@
    1881  #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    1882  #   undef pthread_spin_trylock
    1883  #   define pthread_spin_trylock rpl_pthread_spin_trylock
    1884  #  endif
    1885  _GL_FUNCDECL_RPL (pthread_spin_trylock, int, (pthread_spinlock_t *lock)
    1886                                               _GL_ARG_NONNULL ((1)));
    1887  _GL_CXXALIAS_RPL (pthread_spin_trylock, int, (pthread_spinlock_t *lock));
    1888  # else
    1889  #  if !@HAVE_PTHREAD_SPIN_TRYLOCK@
    1890  _GL_FUNCDECL_SYS (pthread_spin_trylock, int, (pthread_spinlock_t *lock)
    1891                                               _GL_ARG_NONNULL ((1)));
    1892  #  endif
    1893  _GL_CXXALIAS_SYS (pthread_spin_trylock, int, (pthread_spinlock_t *lock));
    1894  # endif
    1895  # if __GLIBC__ >= 2
    1896  _GL_CXXALIASWARN (pthread_spin_trylock);
    1897  # endif
    1898  #elif defined GNULIB_POSIXCHECK
    1899  # undef pthread_spin_trylock
    1900  # if HAVE_RAW_DECL_PTHREAD_SPIN_TRYLOCK
    1901  _GL_WARN_ON_USE (pthread_spin_trylock, "pthread_spin_trylock is not portable - "
    1902                   "use gnulib module pthread-spin for portability");
    1903  # endif
    1904  #endif
    1905  
    1906  #if @GNULIB_PTHREAD_SPIN@
    1907  # if @REPLACE_PTHREAD_SPIN_UNLOCK@
    1908  #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    1909  #   undef pthread_spin_unlock
    1910  #   define pthread_spin_unlock rpl_pthread_spin_unlock
    1911  #  endif
    1912  _GL_FUNCDECL_RPL (pthread_spin_unlock, int, (pthread_spinlock_t *lock)
    1913                                              _GL_ARG_NONNULL ((1)));
    1914  _GL_CXXALIAS_RPL (pthread_spin_unlock, int, (pthread_spinlock_t *lock));
    1915  # else
    1916  #  if !@HAVE_PTHREAD_SPIN_UNLOCK@
    1917  _GL_FUNCDECL_SYS (pthread_spin_unlock, int, (pthread_spinlock_t *lock)
    1918                                              _GL_ARG_NONNULL ((1)));
    1919  #  endif
    1920  _GL_CXXALIAS_SYS (pthread_spin_unlock, int, (pthread_spinlock_t *lock));
    1921  # endif
    1922  # if __GLIBC__ >= 2
    1923  _GL_CXXALIASWARN (pthread_spin_unlock);
    1924  # endif
    1925  #elif defined GNULIB_POSIXCHECK
    1926  # undef pthread_spin_unlock
    1927  # if HAVE_RAW_DECL_PTHREAD_SPIN_UNLOCK
    1928  _GL_WARN_ON_USE (pthread_spin_unlock, "pthread_spin_unlock is not portable - "
    1929                   "use gnulib module pthread-spin for portability");
    1930  # endif
    1931  #endif
    1932  
    1933  #if @GNULIB_PTHREAD_SPIN@
    1934  # if @REPLACE_PTHREAD_SPIN_DESTROY@
    1935  #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    1936  #   undef pthread_spin_destroy
    1937  #   define pthread_spin_destroy rpl_pthread_spin_destroy
    1938  #  endif
    1939  _GL_FUNCDECL_RPL (pthread_spin_destroy, int, (pthread_spinlock_t *lock)
    1940                                               _GL_ARG_NONNULL ((1)));
    1941  _GL_CXXALIAS_RPL (pthread_spin_destroy, int, (pthread_spinlock_t *lock));
    1942  # else
    1943  #  if !@HAVE_PTHREAD_SPIN_DESTROY@
    1944  _GL_FUNCDECL_SYS (pthread_spin_destroy, int, (pthread_spinlock_t *lock)
    1945                                               _GL_ARG_NONNULL ((1)));
    1946  #  endif
    1947  _GL_CXXALIAS_SYS (pthread_spin_destroy, int, (pthread_spinlock_t *lock));
    1948  # endif
    1949  # if __GLIBC__ >= 2
    1950  _GL_CXXALIASWARN (pthread_spin_destroy);
    1951  # endif
    1952  #elif defined GNULIB_POSIXCHECK
    1953  # undef pthread_spin_destroy
    1954  # if HAVE_RAW_DECL_PTHREAD_SPIN_DESTROY
    1955  _GL_WARN_ON_USE (pthread_spin_destroy, "pthread_spin_destroy is not portable - "
    1956                   "use gnulib module pthread-spin for portability");
    1957  # endif
    1958  #endif
    1959  
    1960  
    1961  #endif /* _@GUARD_PREFIX@_PTHREAD_H_ */
    1962  #endif /* _@GUARD_PREFIX@_PTHREAD_H_ */
    1963  #endif