[libcxx-commits] [libcxx] [libc++] Remove <stdbool.h> (PR #164595)
Nikolas Klauser via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Oct 22 03:34:25 PDT 2025
https://github.com/philnik777 created https://github.com/llvm/llvm-project/pull/164595
`<stdbool.h>` is provided by the compiler and both Clang and GCC provide C++-aware versions of these headers, making our own wrapper header entirely unnecessary.
>From 5d7b1e579c2d20adfa0597368081d764329bb480 Mon Sep 17 00:00:00 2001
From: Nikolas Klauser <nikolasklauser at berlin.de>
Date: Wed, 22 Oct 2025 12:32:53 +0200
Subject: [PATCH] [libc++] Remove <stdbool.h>
---
libcxx/include/CMakeLists.txt | 2 --
libcxx/include/__cxx03/stdbool.h | 40 ---------------------------
libcxx/include/module.modulemap.in | 4 ---
libcxx/include/stdbool.h | 44 ------------------------------
4 files changed, 90 deletions(-)
delete mode 100644 libcxx/include/__cxx03/stdbool.h
delete mode 100644 libcxx/include/stdbool.h
diff --git a/libcxx/include/CMakeLists.txt b/libcxx/include/CMakeLists.txt
index dd1e71380e7fc..f437f56154963 100644
--- a/libcxx/include/CMakeLists.txt
+++ b/libcxx/include/CMakeLists.txt
@@ -1063,7 +1063,6 @@ set(files
sstream
stack
stdatomic.h
- stdbool.h
stddef.h
stdexcept
stdio.h
@@ -1651,7 +1650,6 @@ set(files
__cxx03/sstream
__cxx03/stack
__cxx03/stdatomic.h
- __cxx03/stdbool.h
__cxx03/stddef.h
__cxx03/stdexcept
__cxx03/stdint.h
diff --git a/libcxx/include/__cxx03/stdbool.h b/libcxx/include/__cxx03/stdbool.h
deleted file mode 100644
index e6c2eae2cfd12..0000000000000
--- a/libcxx/include/__cxx03/stdbool.h
+++ /dev/null
@@ -1,40 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___CXX03_STDBOOL_H
-#define _LIBCPP___CXX03_STDBOOL_H
-
-/*
- stdbool.h synopsis
-
-Macros:
-
- __bool_true_false_are_defined
-
-*/
-
-#include <__cxx03/__config>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-#if __has_include_next(<stdbool.h>)
-# include_next <stdbool.h>
-#endif
-
-#ifdef __cplusplus
-# undef bool
-# undef true
-# undef false
-# undef __bool_true_false_are_defined
-# define __bool_true_false_are_defined 1
-#endif
-
-#endif // _LIBCPP___CXX03_STDBOOL_H
diff --git a/libcxx/include/module.modulemap.in b/libcxx/include/module.modulemap.in
index a86d6c6a43d0e..752b4cacd9c15 100644
--- a/libcxx/include/module.modulemap.in
+++ b/libcxx/include/module.modulemap.in
@@ -2434,10 +2434,6 @@ module std_stdatomic_h [system] {
header "stdatomic.h"
export *
}
-module std_stdbool_h [system] {
- // <stdbool.h>'s __bool_true_false_are_defined macro requires textual inclusion.
- textual header "stdbool.h"
-}
module std_stddef_h [system] {
// <stddef.h> supports being included multiple times with different pre-defined macros
textual header "stddef.h"
diff --git a/libcxx/include/stdbool.h b/libcxx/include/stdbool.h
deleted file mode 100644
index c34853b97b854..0000000000000
--- a/libcxx/include/stdbool.h
+++ /dev/null
@@ -1,44 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP_STDBOOL_H
-#define _LIBCPP_STDBOOL_H
-
-/*
- stdbool.h synopsis
-
-Macros:
-
- __bool_true_false_are_defined
-
-*/
-
-#if defined(__cplusplus) && __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
-# include <__cxx03/stdbool.h>
-#else
-# include <__config>
-
-# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-# endif
-
-# if __has_include_next(<stdbool.h>)
-# include_next <stdbool.h>
-# endif
-
-# ifdef __cplusplus
-# undef bool
-# undef true
-# undef false
-# undef __bool_true_false_are_defined
-# define __bool_true_false_are_defined 1
-# endif
-#endif // defined(__cplusplus) && __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
-
-#endif // _LIBCPP_STDBOOL_H
More information about the libcxx-commits
mailing list