lock: fix compilation error on HP-UX IA64
(too old to reply)
Bruno Haible
2017-03-19 19:43:13 UTC
Raw Message
On HP-UX IA64 with this new shining compiler, I'm seeing this compilation

cc +DD64 -AC99 -D_XOPEN_SOURCE=500 -DHAVE_CONFIG_H -I. -I../../src/gllib -I.. -g -c -o glthread/lock.o ../../src/gllib/glthread/lock.c
"../../src/gllib/glthread/lock.h", line 143: error #4270: "pthread_rwlockattr_setkind_np" is undefined, pragma ignored
# pragma weak pthread_rwlockattr_setkind_np

1 error detected in the compilation of "../../src/gllib/glthread/lock.c".

Although this error message is a candidate for a hall of fame, let me add a

2017-03-19 Bruno Haible <***@clisp.org>

lock: Fix compilation error with HP-UX IA64 cc.
* lib/glthread/lock.h (pthread_rwlockattr_setkind_np): Don't declare
weak on non-glibc platforms.

diff --git a/lib/glthread/lock.h b/lib/glthread/lock.h
index 67932aa..ec8d11d 100644
--- a/lib/glthread/lock.h
+++ b/lib/glthread/lock.h
@@ -140,7 +140,9 @@ extern int glthread_in_use (void);
# pragma weak pthread_mutexattr_settype
# pragma weak pthread_mutexattr_destroy
# pragma weak pthread_rwlockattr_init
-# pragma weak pthread_rwlockattr_setkind_np
+# if __GNU_LIBRARY__ > 1
+# pragma weak pthread_rwlockattr_setkind_np
+# endif
# pragma weak pthread_rwlockattr_destroy
# ifndef pthread_self
# pragma weak pthread_self