[libc-commits] [libc] [libc] Remove hardcoded sizeof in __barrier_type.h (PR #153718)
Mikhail R. Gadelha via libc-commits
libc-commits at lists.llvm.org
Thu Aug 14 17:32:48 PDT 2025
https://github.com/mikhailramalho created https://github.com/llvm/llvm-project/pull/153718
This PR removes the hardcoded values for the sizeof(LIBC_NAMESPACE::CndVar) and sizeof(LIBC_NAMESPACE::Mutex) and replaces them with the actual calls to sizeof. Fixes compilation error in 32-bit systems.
>From 08a3fee6380fe00d5333ff5e7d4ffa5455dbacdf Mon Sep 17 00:00:00 2001
From: "Mikhail R. Gadelha" <mikhail at igalia.com>
Date: Thu, 14 Aug 2025 21:30:21 -0300
Subject: [PATCH] Remove hardcoded sizeof
Signed-off-by: Mikhail R. Gadelha <mikhail at igalia.com>
---
libc/include/llvm-libc-types/__barrier_type.h | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/libc/include/llvm-libc-types/__barrier_type.h b/libc/include/llvm-libc-types/__barrier_type.h
index 59712619e917d..23593372af56e 100644
--- a/libc/include/llvm-libc-types/__barrier_type.h
+++ b/libc/include/llvm-libc-types/__barrier_type.h
@@ -9,13 +9,16 @@
#ifndef LLVM_LIBC_TYPES__BARRIER_TYPE_H
#define LLVM_LIBC_TYPES__BARRIER_TYPE_H
+#include "src/__support/threads/CndVar.h"
+#include "src/__support/threads/mutex.h"
+
typedef struct __attribute__((aligned(8 /* alignof (Barrier) */))) {
unsigned expected;
unsigned waiting;
bool blocking;
- char entering[24 /* sizeof (CndVar) */];
- char exiting[24 /* sizeof (CndVar) */];
- char mutex[24 /* sizeof (Mutex) */];
+ char entering[sizeof(LIBC_NAMESPACE::CndVar)];
+ char exiting[sizeof(LIBC_NAMESPACE::CndVar)];
+ char mutex[sizeof(LIBC_NAMESPACE::Mutex)];
} __barrier_type;
#endif // LLVM_LIBC_TYPES__BARRIER_TYPE_H
More information about the libc-commits
mailing list