From ade0b9fdaca5768d3ea5263385caeeaf24bbd2b7 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Thu, 8 Aug 2024 00:54:03 +0200 Subject: [PATCH] Avoid compiler warnings in some configure tests. * m4/pthread-rwlock.m4 (gl_PTHREAD_RWLOCK): Allocate more room for local array 'name'. * m4/pthread_mutex_timedlock.m4 (gl_FUNC_PTHREAD_MUTEX_TIMEDLOCK): Don't pass a NULL pointer to pthread_mutex_timedlock. --- ChangeLog | 8 ++++++++ m4/pthread-rwlock.m4 | 4 ++-- m4/pthread_mutex_timedlock.m4 | 5 +++-- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7437e79e70..2ad41c38b9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2024-08-07 Bruno Haible + + Avoid compiler warnings in some configure tests. + * m4/pthread-rwlock.m4 (gl_PTHREAD_RWLOCK): Allocate more room for local + array 'name'. + * m4/pthread_mutex_timedlock.m4 (gl_FUNC_PTHREAD_MUTEX_TIMEDLOCK): Don't + pass a NULL pointer to pthread_mutex_timedlock. + 2024-08-07 Bruno Haible pthread-rwlock: Fix default wait queue behaviour on glibc/Linux. diff --git a/m4/pthread-rwlock.m4 b/m4/pthread-rwlock.m4 index 51d84419c7..cbd08790e1 100644 --- a/m4/pthread-rwlock.m4 +++ b/m4/pthread-rwlock.m4 @@ -1,5 +1,5 @@ # pthread-rwlock.m4 -# serial 5 +# serial 6 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, @@ -249,7 +249,7 @@ do_test (const char *rw_string) char **names = (char **) malloc (n * sizeof (char *)); for (size_t i = 0; i < n; i++) { - char name[10]; + char name[12]; sprintf (name, "%c%u", rw_string[i], (unsigned int) (i+1)); names[i] = strdup (name); } diff --git a/m4/pthread_mutex_timedlock.m4 b/m4/pthread_mutex_timedlock.m4 index 46b59d793c..9b175d5474 100644 --- a/m4/pthread_mutex_timedlock.m4 +++ b/m4/pthread_mutex_timedlock.m4 @@ -1,5 +1,5 @@ # pthread_mutex_timedlock.m4 -# serial 5 +# serial 6 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, @@ -28,7 +28,8 @@ AC_DEFUN([gl_FUNC_PTHREAD_MUTEX_TIMEDLOCK], #include ]], [[pthread_mutex_t lock; - return pthread_mutex_timedlock (&lock, (struct timespec *) 0); + struct timespec ts = { 0 }; + return pthread_mutex_timedlock (&lock, &ts); ]]) ], [gl_cv_func_pthread_mutex_timedlock_in_LIBMULTITHREAD=yes], -- 2.39.5