Sevan Janiyan wrote in
https://lists.gnu.org/archive/html/bug-gnulib/2023-11/msg00163.html
https://lists.gnu.org/archive/html/bug-gnulib/2023-11/msg00165.html
https://lists.gnu.org/archive/html/bug-gnulib/2023-11/msg00183.html :
> All pthread components in gnulib 
> should be bundled?
> 
> test-pthread.c:33: error: ‘PTHREAD_RWLOCK_INITIALIZER’ undeclared here 
> (not in a function)

Oh, I see. What you are saying is: When a package uses module 'pthread-h'
without module 'pthread-rwlock', the build fails with the above compilation
error on MacOS X 10.4.

This patch should fix it.


2024-10-16  Bruno Haible  <br...@clisp.org>

        pthread-h tests: Fix a compilation error on MacOS X 10.4.
        Reported by Sevan Janiyan <ventur...@geeklan.co.uk> in
        <https://lists.gnu.org/archive/html/bug-gnulib/2023-11/msg00183.html>.
        * tests/test-pthread.c: Omit the PTHREAD_RWLOCK_INITIALIZER test if
        module 'pthread-rwlock' is not in use.

diff --git a/tests/test-pthread.c b/tests/test-pthread.c
index f7e89c667c..a78e714e0d 100644
--- a/tests/test-pthread.c
+++ b/tests/test-pthread.c
@@ -30,8 +30,10 @@ pthread_once_t t3 = PTHREAD_ONCE_INIT;
 pthread_mutex_t t4 = PTHREAD_MUTEX_INITIALIZER;
 pthread_mutexattr_t t5;
 
+#if GNULIB_TEST_PTHREAD_RWLOCK
 pthread_rwlock_t t6 = PTHREAD_RWLOCK_INITIALIZER;
 pthread_rwlockattr_t t7;
+#endif
 
 pthread_cond_t t8 = PTHREAD_COND_INITIALIZER;
 pthread_condattr_t t9;




Reply via email to