Skip to content

Conversation

@philnik777
Copy link
Contributor

<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.

@philnik777 philnik777 marked this pull request as ready for review October 23, 2025 09:12
@philnik777 philnik777 requested a review from a team as a code owner October 23, 2025 09:12
@llvmbot llvmbot added the libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. label Oct 23, 2025
@llvmbot
Copy link
Member

llvmbot commented Oct 23, 2025

@llvm/pr-subscribers-libcxx

Author: Nikolas Klauser (philnik777)

Changes

&lt;stdbool.h&gt; is provided by the compiler and both Clang and GCC provide C++-aware versions of these headers, making our own wrapper header entirely unnecessary.


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

4 Files Affected:

  • (modified) libcxx/include/CMakeLists.txt (-2)
  • (removed) libcxx/include/__cxx03/stdbool.h (-40)
  • (modified) libcxx/include/module.modulemap.in (-4)
  • (removed) libcxx/include/stdbool.h (-44)
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

Copy link
Member

@ldionne ldionne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but I'd like to run a build on that patch before we land it just to quantify the amount of breakage it causes (if any). People who have non-standard include path setups might not always be adding search paths for compiler builtin headers, and this could potentially break them.

CC @llvm/libcxx-vendors

Edit: ref 163294811&163294997 for builds

@rupprecht
Copy link
Collaborator

LGTM, but I'd like to run a build on that patch before we land it just to quantify the amount of breakage it causes (if any). People who have non-standard include path setups might not always be adding search paths for compiler builtin headers, and this could potentially break them.

I ran a global test; no issues detected over here.

@zibi2
Copy link
Contributor

zibi2 commented Oct 28, 2025

This change looks good from z/OS point of you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants