[libc-commits] [libc] Add <stdbool.h> to llvm-libc-types headers that need it. (PR #165798)

Alexey Samsonov via libc-commits libc-commits at lists.llvm.org
Thu Oct 30 16:19:59 PDT 2025


https://github.com/vonosmas created https://github.com/llvm/llvm-project/pull/165798

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.

>From 60ba02b7b709995ae0f708a8eae7dcbed7147183 Mon Sep 17 00:00:00 2001
From: Alexey Samsonov <vonosmas at gmail.com>
Date: Thu, 30 Oct 2025 23:18:19 +0000
Subject: [PATCH] Add <stdbool.h> to llvm-libc-types headers that need it.

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.
---
 libc/include/llvm-libc-types/__barrier_type.h        | 2 ++
 libc/include/llvm-libc-types/pthread_barrierattr_t.h | 2 ++
 2 files changed, 4 insertions(+)

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;



More information about the libc-commits mailing list