]> git.ipfire.org Git - thirdparty/gnulib.git/commitdiff
pthread-h: Fix compilation error in C++ mode.
authorBruno Haible <bruno@clisp.org>
Wed, 6 May 2026 09:43:59 +0000 (11:43 +0200)
committerBruno Haible <bruno@clisp.org>
Wed, 6 May 2026 09:45:09 +0000 (11:45 +0200)
Reported by Daiki Ueno.

* lib/pthread.in.h: Disable the 'using GNULIB_NAMESPACE::pthread_*'
directives for which the corresponding Gnulib module is not present.

ChangeLog
lib/pthread.in.h

index 0bdf9d37451e04a29d49297d42c80caa453b423b..d379b2d42a5fb69ff2bc432f17db813d49d44f79 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2026-05-06  Bruno Haible  <bruno@clisp.org>
+
+       pthread-h: Fix compilation error in C++ mode.
+       Reported by Daiki Ueno.
+       * lib/pthread.in.h: Disable the 'using GNULIB_NAMESPACE::pthread_*'
+       directives for which the corresponding Gnulib module is not present.
+
 2026-05-06  Bruno Haible  <bruno@clisp.org>
 
        regex: Fix compilation error with MSVC 2022.
index 37deab82477072c3bfab127158b4e17a5c21022b..54eb83b015a97b05dee38477c8415dc1cf4135bd 100644 (file)
@@ -1949,30 +1949,44 @@ _GL_WARN_ON_USE (pthread_spin_destroy, "pthread_spin_destroy is not portable - "
 
 #if defined __cplusplus && defined GNULIB_NAMESPACE && !@HAVE_PTHREAD_H@ && defined __MINGW32__
 /* Provide the symbols required by mingw's <bits/gthr-default.h>.  */
+# if @GNULIB_PTHREAD_THREAD@
 using GNULIB_NAMESPACE::pthread_create;
 using GNULIB_NAMESPACE::pthread_self;
 using GNULIB_NAMESPACE::pthread_equal;
 using GNULIB_NAMESPACE::pthread_detach;
 using GNULIB_NAMESPACE::pthread_join;
+# endif
+# if @GNULIB_PTHREAD_ONCE@
 using GNULIB_NAMESPACE::pthread_once;
+# endif
+# if @GNULIB_PTHREAD_MUTEX@
 using GNULIB_NAMESPACE::pthread_mutex_init;
 using GNULIB_NAMESPACE::pthread_mutexattr_init;
 using GNULIB_NAMESPACE::pthread_mutexattr_settype;
 using GNULIB_NAMESPACE::pthread_mutexattr_destroy;
 using GNULIB_NAMESPACE::pthread_mutex_lock;
 using GNULIB_NAMESPACE::pthread_mutex_trylock;
+# endif
+# if @GNULIB_PTHREAD_MUTEX_TIMEDLOCK@
 using GNULIB_NAMESPACE::pthread_mutex_timedlock;
+# endif
+# if @GNULIB_PTHREAD_MUTEX@
 using GNULIB_NAMESPACE::pthread_mutex_unlock;
 using GNULIB_NAMESPACE::pthread_mutex_destroy;
+# endif
+# if @GNULIB_PTHREAD_COND@
 using GNULIB_NAMESPACE::pthread_cond_wait;
 using GNULIB_NAMESPACE::pthread_cond_timedwait;
 using GNULIB_NAMESPACE::pthread_cond_signal;
 using GNULIB_NAMESPACE::pthread_cond_broadcast;
 using GNULIB_NAMESPACE::pthread_cond_destroy;
+# endif
+# if @GNULIB_PTHREAD_TSS@
 using GNULIB_NAMESPACE::pthread_key_create;
 using GNULIB_NAMESPACE::pthread_setspecific;
 using GNULIB_NAMESPACE::pthread_getspecific;
 using GNULIB_NAMESPACE::pthread_key_delete;
+# endif
 #endif