2023-10-15 Bruno Haible <bruno@clisp.org>
+ pthread-spin: Fix warnings on FreeBSD 5.2.1/i386.
+ * lib/pthread.in.h (pthread_spinlock_t): Override if <pthread.h> defines
+ pthread_spinlock_t but we need to approximate spinlocks with mutexes.
+ * m4/pthread-spin.m4 (gl_PTHREAD_SPIN): When the pthread_spin_*
+ functions are declared but don't exist, mark them as REPLACEd.
+
pthread-spin: Fix link errors on FreeBSD 5.2.1/i386.
* m4/pthread-spin.m4 (gl_PTHREAD_SPIN): Test not only whether
<pthread.h> defines the pthread_spinlock_t type, but also whether the
# define PTHREAD_PROCESS_PRIVATE 0
# define PTHREAD_PROCESS_SHARED 1
#else
-# if !@HAVE_PTHREAD_SPINLOCK_T@
+# if @HAVE_PTHREAD_SPINLOCK_T@
+/* <pthread.h> exists and defines pthread_spinlock_t. */
+# if !(((__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7) \
+ || __clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >= 1)) \
+ || (((__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1)) \
+ && !defined __ANDROID__) \
+ || __clang_major__ >= 3)) \
+ && !defined __ibmxl__)
+/* We can't use GCC built-ins. Approximate spinlocks with mutexes. */
+# if !GNULIB_defined_pthread_spin_types
+# define pthread_spinlock_t pthread_mutex_t
+# define GNULIB_defined_pthread_spin_types 1
+# endif
+# endif
+# else
/* Approximate spinlocks with mutexes. */
# if !GNULIB_defined_pthread_spin_types
typedef pthread_mutex_t pthread_spinlock_t;
])
if test $gl_cv_func_pthread_spin_init_in_LIBMULTITHREAD != yes; then
HAVE_PTHREAD_SPIN_INIT=0
+ REPLACE_PTHREAD_SPIN_INIT=1
HAVE_PTHREAD_SPIN_LOCK=0
+ REPLACE_PTHREAD_SPIN_LOCK=1
HAVE_PTHREAD_SPIN_TRYLOCK=0
+ REPLACE_PTHREAD_SPIN_TRYLOCK=1
HAVE_PTHREAD_SPIN_UNLOCK=0
+ REPLACE_PTHREAD_SPIN_UNLOCK=1
HAVE_PTHREAD_SPIN_DESTROY=0
+ REPLACE_PTHREAD_SPIN_DESTROY=1
fi
], [
: