Index | Thread | Search

From:
Theo Buehler <tb@theobuehler.org>
Subject:
Re: libstdthreads fix type of mtx_t
To:
ports@openbsd.org
Date:
Mon, 17 Nov 2025 14:49:37 +0100

Download raw body.

Thread
On Mon, Nov 17, 2025 at 02:45:28PM +0100, Claudio Jeker wrote:
> This tripped over gcc15 in c23 mode. Our pthreads mutexes
> (pthread_mutex_t) are typedef-ed to volatile struct pthread_mutex *
> so this should do the same. 

It's probably fine without a bump, but I'd probably still do it. Also
the other hunk can go away once we switch to gcc 15 :)

ok tb

> 
> -- 
> :wq Claudio
> 
> Index: patches/patch-threads_h
> ===================================================================
> RCS file: /cvs/ports/devel/libstdthreads/patches/patch-threads_h,v
> diff -u -p -r1.1 patch-threads_h
> --- patches/patch-threads_h	2 Sep 2024 16:39:12 -0000	1.1
> +++ patches/patch-threads_h	30 Oct 2025 14:18:50 -0000
> @@ -1,4 +1,5 @@
>  __has_extension support added in gcc >= 14
> +Fixup mtx_t definition to mirror pthread_mutex_t
>  
>  Index: threads.h
>  --- threads.h.orig
> @@ -14,3 +15,12 @@ Index: threads.h
>   #if __has_extension(c_thread_safety_attributes)
>   #define	__lock_annotate(x)	__attribute__((x))
>   #else
> +@@ -97,7 +101,7 @@
> +  */
> + 
> + typedef struct pthread_cond	*cnd_t;
> +-typedef struct pthread_mutex	*mtx_t;
> ++typedef volatile struct pthread_mutex	*mtx_t;
> + typedef struct pthread		*thrd_t;
> + typedef int			 tss_t;
> + 
>