Skip to content

Conversation

@vonosmas
Copy link
Contributor

We need <stdbool.h> to support having "bool" members inside pthread structs that may get included through <pthread.h> from C code prior to C23.

We need <stdbool.h> to support having "bool" members inside pthread
structs that may get included from <pthread.h> from C code prior to C23.
@vonosmas vonosmas requested review from frobtech and lntue October 30, 2025 23:19
@llvmbot llvmbot added the libc label Oct 30, 2025
@llvmbot
Copy link
Member

llvmbot commented Oct 30, 2025

@llvm/pr-subscribers-libc

Author: Alexey Samsonov (vonosmas)

Changes

We need &lt;stdbool.h&gt; to support having "bool" members inside pthread structs that may get included through &lt;pthread.h&gt; from C code prior to C23.


Full diff: https://github.com/llvm/llvm-project/pull/165798.diff

2 Files Affected:

  • (modified) libc/include/llvm-libc-types/__barrier_type.h (+2)
  • (modified) libc/include/llvm-libc-types/pthread_barrierattr_t.h (+2)
diff --git a/libc/include/llvm-libc-types/__barrier_type.h b/libc/include/llvm-libc-types/__barrier_type.h
index 59712619e917d..5752f832f04b9 100644
--- a/libc/include/llvm-libc-types/__barrier_type.h
+++ b/libc/include/llvm-libc-types/__barrier_type.h
@@ -9,6 +9,8 @@
 #ifndef LLVM_LIBC_TYPES__BARRIER_TYPE_H
 #define LLVM_LIBC_TYPES__BARRIER_TYPE_H
 
+#include <stdbool.h>
+
 typedef struct __attribute__((aligned(8 /* alignof (Barrier) */))) {
   unsigned expected;
   unsigned waiting;
diff --git a/libc/include/llvm-libc-types/pthread_barrierattr_t.h b/libc/include/llvm-libc-types/pthread_barrierattr_t.h
index 064be5bfb6721..b62fdc0f72e12 100644
--- a/libc/include/llvm-libc-types/pthread_barrierattr_t.h
+++ b/libc/include/llvm-libc-types/pthread_barrierattr_t.h
@@ -9,6 +9,8 @@
 #ifndef LLVM_LIBC_TYPES_PTHREAD_BARRIERATTR_T_H
 #define LLVM_LIBC_TYPES_PTHREAD_BARRIERATTR_T_H
 
+#include <stdbool.h>
+
 typedef struct {
   bool pshared;
 } pthread_barrierattr_t;

@vonosmas vonosmas merged commit 45b1a4b into llvm:main Oct 30, 2025
19 of 20 checks passed
@vonosmas vonosmas deleted the libc-include-stdbool-fix branch October 30, 2025 23:37
DEBADRIBASAK pushed a commit to DEBADRIBASAK/llvm-project that referenced this pull request Nov 3, 2025
We need `<stdbool.h>` to support having "bool" members inside pthread
structs that may get included through `<pthread.h>` from C code prior to
C23.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants