On AIX 7.1, with xlc, I see this compilation error:

"../../gltests/test-pthread-rwlock-waitqueue.c", line 200.49: 1506-226 (S) The 
":" operator is not allowed between "void*(void*)" and "int".
This patch fixes it.

Maybe we should override NULL on this platform (where it is defined as 0)?


2024-11-14  Bruno Haible  <br...@clisp.org>

        pthread-rwlock tests: Fix compilation error on AIX with xlc.
        * m4/pthread-rwlock.m4 (gl_PTHREAD_RWLOCK): Cast the NULL pointer.
        * tests/test-pthread-rwlock-waitqueue.c (do_test): Likewise.

diff --git a/m4/pthread-rwlock.m4 b/m4/pthread-rwlock.m4
index 31bda46ea1..084697df80 100644
--- a/m4/pthread-rwlock.m4
+++ b/m4/pthread-rwlock.m4
@@ -1,5 +1,5 @@
 # pthread-rwlock.m4
-# serial 7
+# serial 8
 dnl Copyright (C) 2019-2024 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -267,7 +267,7 @@ AC_DEFUN([gl_PTHREAD_RWLOCK]
       err = pthread_create (&threads[i], NULL,
                             rw_string[i] == 'R' ? reader_func :
                             rw_string[i] == 'W' ? writer_func :
-                            (abort (), NULL),
+                            (abort (), (void * (*) (void *)) NULL),
                             &locals[i]);
       if (err)
         {
diff --git a/tests/test-pthread-rwlock-waitqueue.c 
b/tests/test-pthread-rwlock-waitqueue.c
index 6b800ea5cc..f34ed36e14 100644
--- a/tests/test-pthread-rwlock-waitqueue.c
+++ b/tests/test-pthread-rwlock-waitqueue.c
@@ -198,7 +198,7 @@ do_test (const char *rw_string)
       err = pthread_create (&threads[i], NULL,
                             rw_string[i] == 'R' ? reader_func :
                             rw_string[i] == 'W' ? writer_func :
-                            (abort (), NULL),
+                            (abort (), (void * (*) (void *)) NULL),
                             &locals[i]);
       if (err)
         {




Reply via email to