Always use compiler builtin for offsetof()

We have received multiple reports of GCC breaking builds when compiler
flags like `-std=c11` were being passed. The workaround until the next
release is to simply not define `__STRICT_ANSI__` which is a bad idea.
This commit is contained in:
Justine Tunney 2023-12-07 14:20:12 -08:00
parent e36283f1d9
commit 06ace4e7b4
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
2 changed files with 1 additions and 6 deletions

View file

@ -473,12 +473,7 @@ typedef struct {
#define autotype(x) typeof(x) #define autotype(x) typeof(x)
#endif #endif
#if defined(__STRICT_ANSI__) || \
(!defined(__GNUC__) && !defined(__builtin_offsetof))
#define offsetof(type, member) ((unsigned long)&((type *)0)->member)
#else
#define offsetof(type, member) __builtin_offsetof(type, member) #define offsetof(type, member) __builtin_offsetof(type, member)
#endif
#ifdef _COSMO_SOURCE #ifdef _COSMO_SOURCE

View file

@ -71,7 +71,7 @@ static void _pthread_cancel_sig(int sig, siginfo_t *si, void *arg) {
if (pt->pt_flags & PT_NOCANCEL) return; if (pt->pt_flags & PT_NOCANCEL) return;
if (!atomic_load_explicit(&pt->pt_canceled, memory_order_acquire)) return; if (!atomic_load_explicit(&pt->pt_canceled, memory_order_acquire)) return;
// in asynchronous mode we'll just the exit asynchronously // in asynchronous mode the asynchronous signal calls exit
if (pt->pt_flags & PT_ASYNC) { if (pt->pt_flags & PT_ASYNC) {
sigaddset(&ctx->uc_sigmask, SIGTHR); sigaddset(&ctx->uc_sigmask, SIGTHR);
pthread_sigmask(SIG_SETMASK, &ctx->uc_sigmask, 0); pthread_sigmask(SIG_SETMASK, &ctx->uc_sigmask, 0);