Skip to content

Conversation

@philnik777
Copy link
Contributor

include_next doesn't work very well with the C++03 headers and modules. Since these specific headers are very self-contained there isn't much of a reason to split them into C++03/non-C++03 headers, so let's just remove them. The few C wrapper headers that aren't as self-contained will be refactored in a separate patch.

@philnik777 philnik777 force-pushed the cxx03_remove_c_wrapper_headers branch from 39ad356 to 5993f51 Compare October 16, 2025 13:26
@github-actions
Copy link

github-actions bot commented Oct 16, 2025

✅ With the latest revision this PR passed the C/C++ code formatter.

@philnik777 philnik777 force-pushed the cxx03_remove_c_wrapper_headers branch from 5993f51 to 51f55fa Compare October 20, 2025 11:47
@philnik777 philnik777 marked this pull request as ready for review October 20, 2025 11:48
@philnik777 philnik777 requested a review from a team as a code owner October 20, 2025 11:48
@llvmbot llvmbot added the libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. label Oct 20, 2025
@llvmbot
Copy link
Member

llvmbot commented Oct 20, 2025

@llvm/pr-subscribers-libcxx

Author: Nikolas Klauser (philnik777)

Changes

include_next doesn't work very well with the C++03 headers and modules. Since these specific headers are very self-contained there isn't much of a reason to split them into C++03/non-C++03 headers, so let's just remove them. The few C wrapper headers that aren't as self-contained will be refactored in a separate patch.


Patch is 62.25 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/163772.diff

34 Files Affected:

  • (modified) libcxx/include/CMakeLists.txt (-11)
  • (modified) libcxx/include/__cxx03/__thread/support/pthread.h (+1-1)
  • (modified) libcxx/include/__cxx03/cctype (+2-2)
  • (modified) libcxx/include/__cxx03/cerrno (+2-2)
  • (modified) libcxx/include/__cxx03/cfenv (+2-2)
  • (modified) libcxx/include/__cxx03/cfloat (+2-2)
  • (modified) libcxx/include/__cxx03/cinttypes (+2-2)
  • (removed) libcxx/include/__cxx03/complex.h (-32)
  • (modified) libcxx/include/__cxx03/cstddef (+2-2)
  • (modified) libcxx/include/__cxx03/cstdio (+2-2)
  • (removed) libcxx/include/__cxx03/ctype.h (-61)
  • (modified) libcxx/include/__cxx03/cwctype (+2-2)
  • (removed) libcxx/include/__cxx03/errno.h (-399)
  • (modified) libcxx/include/__cxx03/ext/__hash (+1-1)
  • (removed) libcxx/include/__cxx03/fenv.h (-114)
  • (removed) libcxx/include/__cxx03/float.h (-95)
  • (removed) libcxx/include/__cxx03/inttypes.h (-264)
  • (removed) libcxx/include/__cxx03/stdbool.h (-40)
  • (removed) libcxx/include/__cxx03/stddef.h (-44)
  • (removed) libcxx/include/__cxx03/stdio.h (-123)
  • (removed) libcxx/include/__cxx03/tgmath.h (-34)
  • (modified) libcxx/include/__cxx03/wchar.h (+1-1)
  • (removed) libcxx/include/__cxx03/wctype.h (-95)
  • (modified) libcxx/include/complex.h (+10-10)
  • (modified) libcxx/include/ctype.h (+24-24)
  • (modified) libcxx/include/errno.h (+269-269)
  • (modified) libcxx/include/fenv.h (+43-43)
  • (modified) libcxx/include/float.h (+16-16)
  • (modified) libcxx/include/inttypes.h (+16-16)
  • (modified) libcxx/include/stdbool.h (+18-18)
  • (modified) libcxx/include/stddef.h (+10-10)
  • (modified) libcxx/include/stdio.h (+20-21)
  • (modified) libcxx/include/tgmath.h (+12-12)
  • (modified) libcxx/include/wctype.h (+29-29)
diff --git a/libcxx/include/CMakeLists.txt b/libcxx/include/CMakeLists.txt
index ddace8bf8c728..2c175e3b1c125 100644
--- a/libcxx/include/CMakeLists.txt
+++ b/libcxx/include/CMakeLists.txt
@@ -1594,7 +1594,6 @@ set(files
   __cxx03/cmath
   __cxx03/codecvt
   __cxx03/complex
-  __cxx03/complex.h
   __cxx03/condition_variable
   __cxx03/csetjmp
   __cxx03/csignal
@@ -1607,25 +1606,20 @@ set(files
   __cxx03/cstring
   __cxx03/ctgmath
   __cxx03/ctime
-  __cxx03/ctype.h
   __cxx03/cuchar
   __cxx03/cwchar
   __cxx03/cwctype
   __cxx03/deque
-  __cxx03/errno.h
   __cxx03/exception
   __cxx03/experimental/__config
   __cxx03/experimental/utility
   __cxx03/ext/__hash
   __cxx03/ext/hash_map
   __cxx03/ext/hash_set
-  __cxx03/fenv.h
-  __cxx03/float.h
   __cxx03/forward_list
   __cxx03/fstream
   __cxx03/functional
   __cxx03/future
-  __cxx03/inttypes.h
   __cxx03/iomanip
   __cxx03/ios
   __cxx03/iosfwd
@@ -1652,11 +1646,8 @@ set(files
   __cxx03/sstream
   __cxx03/stack
   __cxx03/stdatomic.h
-  __cxx03/stdbool.h
-  __cxx03/stddef.h
   __cxx03/stdexcept
   __cxx03/stdint.h
-  __cxx03/stdio.h
   __cxx03/stdlib.h
   __cxx03/streambuf
   __cxx03/string
@@ -1664,7 +1655,6 @@ set(files
   __cxx03/string_view
   __cxx03/strstream
   __cxx03/system_error
-  __cxx03/tgmath.h
   __cxx03/thread
   __cxx03/type_traits
   __cxx03/typeindex
@@ -1677,7 +1667,6 @@ set(files
   __cxx03/vector
   __cxx03/version
   __cxx03/wchar.h
-  __cxx03/wctype.h
   )
 
 configure_file("__config_site.in" "${LIBCXX_GENERATED_INCLUDE_TARGET_DIR}/__config_site" @ONLY)
diff --git a/libcxx/include/__cxx03/__thread/support/pthread.h b/libcxx/include/__cxx03/__thread/support/pthread.h
index 4dc7a4980de2b..4ec5531003e02 100644
--- a/libcxx/include/__cxx03/__thread/support/pthread.h
+++ b/libcxx/include/__cxx03/__thread/support/pthread.h
@@ -14,7 +14,7 @@
 #include <__cxx03/__chrono/duration.h>
 #include <__cxx03/__config>
 #include <__cxx03/ctime>
-#include <__cxx03/errno.h>
+#include <errno.h>
 #include <pthread.h>
 #include <sched.h>
 
diff --git a/libcxx/include/__cxx03/cctype b/libcxx/include/__cxx03/cctype
index 7f1becb46341b..e074f5410efa8 100644
--- a/libcxx/include/__cxx03/cctype
+++ b/libcxx/include/__cxx03/cctype
@@ -36,9 +36,9 @@ int toupper(int c);
 
 #include <__cxx03/__config>
 
-#include <__cxx03/ctype.h>
+#include <ctype.h>
 
-#ifndef _LIBCPP___CXX03_CTYPE_H
+#ifndef _LIBCPP_CTYPE_H
 #   error <cctype> tried including <ctype.h> but didn't find libc++'s <ctype.h> header. \
           This usually means that your header search paths are not configured properly.  \
           The header search paths should contain the C++ Standard Library headers before \
diff --git a/libcxx/include/__cxx03/cerrno b/libcxx/include/__cxx03/cerrno
index acb894ea19495..a11a53f5c2ac8 100644
--- a/libcxx/include/__cxx03/cerrno
+++ b/libcxx/include/__cxx03/cerrno
@@ -24,9 +24,9 @@ Macros:
 
 #include <__cxx03/__config>
 
-#include <__cxx03/errno.h>
+#include <errno.h>
 
-#ifndef _LIBCPP___CXX03_ERRNO_H
+#ifndef _LIBCPP_ERRNO_H
 #   error <cerrno> tried including <errno.h> but didn't find libc++'s <errno.h> header. \
           This usually means that your header search paths are not configured properly. \
           The header search paths should contain the C++ Standard Library headers before \
diff --git a/libcxx/include/__cxx03/cfenv b/libcxx/include/__cxx03/cfenv
index d707f5a65b9bc..d3a5839221a82 100644
--- a/libcxx/include/__cxx03/cfenv
+++ b/libcxx/include/__cxx03/cfenv
@@ -54,9 +54,9 @@ int feupdateenv(const fenv_t* envp);
 
 #include <__cxx03/__config>
 
-#include <__cxx03/fenv.h>
+#include <fenv.h>
 
-#ifndef _LIBCPP___CXX03_FENV_H
+#ifndef _LIBCPP_FENV_H
 #   error <cfenv> tried including <fenv.h> but didn't find libc++'s <fenv.h> header. \
           This usually means that your header search paths are not configured properly. \
           The header search paths should contain the C++ Standard Library headers before \
diff --git a/libcxx/include/__cxx03/cfloat b/libcxx/include/__cxx03/cfloat
index 5d10db6a454a6..a48a213f1669f 100644
--- a/libcxx/include/__cxx03/cfloat
+++ b/libcxx/include/__cxx03/cfloat
@@ -71,9 +71,9 @@ Macros:
 
 #include <__cxx03/__config>
 
-#include <__cxx03/float.h>
+#include <float.h>
 
-#ifndef _LIBCPP___CXX03_FLOAT_H
+#ifndef _LIBCPP_FLOAT_H
 #   error <cfloat> tried including <float.h> but didn't find libc++'s <float.h> header. \
           This usually means that your header search paths are not configured properly. \
           The header search paths should contain the C++ Standard Library headers before \
diff --git a/libcxx/include/__cxx03/cinttypes b/libcxx/include/__cxx03/cinttypes
index a14c1a57e66f9..68a926cc75646 100644
--- a/libcxx/include/__cxx03/cinttypes
+++ b/libcxx/include/__cxx03/cinttypes
@@ -241,9 +241,9 @@ uintmax_t wcstoumax(const wchar_t* restrict nptr, wchar_t** restrict endptr, int
 // [cinttypes.syn]
 #include <__cxx03/cstdint>
 
-#include <__cxx03/inttypes.h>
+#include <inttypes.h>
 
-#ifndef _LIBCPP___CXX03_INTTYPES_H
+#ifndef _LIBCPP_INTTYPES_H
 #   error <cinttypes> tried including <inttypes.h> but didn't find libc++'s <inttypes.h> header. \
           This usually means that your header search paths are not configured properly. \
           The header search paths should contain the C++ Standard Library headers before \
diff --git a/libcxx/include/__cxx03/complex.h b/libcxx/include/__cxx03/complex.h
deleted file mode 100644
index 373017ff3f440..0000000000000
--- a/libcxx/include/__cxx03/complex.h
+++ /dev/null
@@ -1,32 +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_COMPLEX_H
-#define _LIBCPP___CXX03_COMPLEX_H
-
-/*
-    complex.h synopsis
-
-#include <__cxx03/ccomplex>
-
-*/
-
-#include <__cxx03/__config>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-#  pragma GCC system_header
-#endif
-
-#ifdef __cplusplus
-#  include <__cxx03/ccomplex>
-#elif __has_include_next(<complex.h>)
-#  include_next <complex.h>
-#endif
-
-#endif // _LIBCPP___CXX03_COMPLEX_H
diff --git a/libcxx/include/__cxx03/cstddef b/libcxx/include/__cxx03/cstddef
index f1527901bd6b5..2b52c5fb42f95 100644
--- a/libcxx/include/__cxx03/cstddef
+++ b/libcxx/include/__cxx03/cstddef
@@ -39,9 +39,9 @@ Types:
 #include <__cxx03/__type_traits/is_integral.h>
 #include <__cxx03/version>
 
-#include <__cxx03/stddef.h>
+#include <stddef.h>
 
-#ifndef _LIBCPP___CXX03_STDDEF_H
+#ifndef _LIBCPP_STDDEF_H
 #   error <cstddef> tried including <stddef.h> but didn't find libc++'s <stddef.h> header. \
           This usually means that your header search paths are not configured properly. \
           The header search paths should contain the C++ Standard Library headers before \
diff --git a/libcxx/include/__cxx03/cstdio b/libcxx/include/__cxx03/cstdio
index 166ac0d8abb61..90149044aeb8b 100644
--- a/libcxx/include/__cxx03/cstdio
+++ b/libcxx/include/__cxx03/cstdio
@@ -97,9 +97,9 @@ void perror(const char* s);
 
 #include <__cxx03/__config>
 
-#include <__cxx03/stdio.h>
+#include <stdio.h>
 
-#ifndef _LIBCPP___CXX03_STDIO_H
+#ifndef _LIBCPP_STDIO_H
 #   error <cstdio> tried including <stdio.h> but didn't find libc++'s <stdio.h> header. \
           This usually means that your header search paths are not configured properly. \
           The header search paths should contain the C++ Standard Library headers before \
diff --git a/libcxx/include/__cxx03/ctype.h b/libcxx/include/__cxx03/ctype.h
deleted file mode 100644
index cd4097ab012ff..0000000000000
--- a/libcxx/include/__cxx03/ctype.h
+++ /dev/null
@@ -1,61 +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_CTYPE_H
-#define _LIBCPP___CXX03_CTYPE_H
-
-/*
-    ctype.h synopsis
-
-int isalnum(int c);
-int isalpha(int c);
-int isblank(int c);  // C99
-int iscntrl(int c);
-int isdigit(int c);
-int isgraph(int c);
-int islower(int c);
-int isprint(int c);
-int ispunct(int c);
-int isspace(int c);
-int isupper(int c);
-int isxdigit(int c);
-int tolower(int c);
-int toupper(int c);
-*/
-
-#include <__cxx03/__config>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-#  pragma GCC system_header
-#endif
-
-#if __has_include_next(<ctype.h>)
-#  include_next <ctype.h>
-#endif
-
-#ifdef __cplusplus
-
-#  undef isalnum
-#  undef isalpha
-#  undef isblank
-#  undef iscntrl
-#  undef isdigit
-#  undef isgraph
-#  undef islower
-#  undef isprint
-#  undef ispunct
-#  undef isspace
-#  undef isupper
-#  undef isxdigit
-#  undef tolower
-#  undef toupper
-
-#endif
-
-#endif // _LIBCPP___CXX03_CTYPE_H
diff --git a/libcxx/include/__cxx03/cwctype b/libcxx/include/__cxx03/cwctype
index 5228124936c6c..336b22634abf4 100644
--- a/libcxx/include/__cxx03/cwctype
+++ b/libcxx/include/__cxx03/cwctype
@@ -52,9 +52,9 @@ wctrans_t wctrans(const char* property);
 #include <__cxx03/__config>
 #include <__cxx03/cctype>
 
-#include <__cxx03/wctype.h>
+#include <wctype.h>
 
-#ifndef _LIBCPP___CXX03_WCTYPE_H
+#ifndef _LIBCPP_WCTYPE_H
 #   error <cwctype> tried including <wctype.h> but didn't find libc++'s <wctype.h> header. \
           This usually means that your header search paths are not configured properly. \
           The header search paths should contain the C++ Standard Library headers before \
diff --git a/libcxx/include/__cxx03/errno.h b/libcxx/include/__cxx03/errno.h
deleted file mode 100644
index 440235bef8545..0000000000000
--- a/libcxx/include/__cxx03/errno.h
+++ /dev/null
@@ -1,399 +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_ERRNO_H
-#define _LIBCPP___CXX03_ERRNO_H
-
-/*
-    errno.h synopsis
-
-Macros:
-
-    EDOM
-    EILSEQ  // C99
-    ERANGE
-    errno
-
-*/
-
-#include <__cxx03/__config>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-#  pragma GCC system_header
-#endif
-
-#if __has_include_next(<errno.h>)
-#  include_next <errno.h>
-#endif
-
-#ifdef __cplusplus
-
-#  if !defined(EOWNERDEAD) || !defined(ENOTRECOVERABLE)
-
-#    ifdef ELAST
-
-static const int __elast1 = ELAST + 1;
-static const int __elast2 = ELAST + 2;
-
-#    else
-
-static const int __elast1 = 104;
-static const int __elast2 = 105;
-
-#    endif
-
-#    ifdef ENOTRECOVERABLE
-
-#      define EOWNERDEAD __elast1
-
-#      ifdef ELAST
-#        undef ELAST
-#        define ELAST EOWNERDEAD
-#      endif
-
-#    elif defined(EOWNERDEAD)
-
-#      define ENOTRECOVERABLE __elast1
-#      ifdef ELAST
-#        undef ELAST
-#        define ELAST ENOTRECOVERABLE
-#      endif
-
-#    else // defined(EOWNERDEAD)
-
-#      define EOWNERDEAD __elast1
-#      define ENOTRECOVERABLE __elast2
-#      ifdef ELAST
-#        undef ELAST
-#        define ELAST ENOTRECOVERABLE
-#      endif
-
-#    endif // defined(EOWNERDEAD)
-
-#  endif // !defined(EOWNERDEAD) || !defined(ENOTRECOVERABLE)
-
-//  supply errno values likely to be missing, particularly on Windows
-
-#  ifndef EAFNOSUPPORT
-#    define EAFNOSUPPORT 9901
-#  endif
-
-#  ifndef EADDRINUSE
-#    define EADDRINUSE 9902
-#  endif
-
-#  ifndef EADDRNOTAVAIL
-#    define EADDRNOTAVAIL 9903
-#  endif
-
-#  ifndef EISCONN
-#    define EISCONN 9904
-#  endif
-
-#  ifndef EBADMSG
-#    define EBADMSG 9905
-#  endif
-
-#  ifndef ECONNABORTED
-#    define ECONNABORTED 9906
-#  endif
-
-#  ifndef EALREADY
-#    define EALREADY 9907
-#  endif
-
-#  ifndef ECONNREFUSED
-#    define ECONNREFUSED 9908
-#  endif
-
-#  ifndef ECONNRESET
-#    define ECONNRESET 9909
-#  endif
-
-#  ifndef EDESTADDRREQ
-#    define EDESTADDRREQ 9910
-#  endif
-
-#  ifndef EHOSTUNREACH
-#    define EHOSTUNREACH 9911
-#  endif
-
-#  ifndef EIDRM
-#    define EIDRM 9912
-#  endif
-
-#  ifndef EMSGSIZE
-#    define EMSGSIZE 9913
-#  endif
-
-#  ifndef ENETDOWN
-#    define ENETDOWN 9914
-#  endif
-
-#  ifndef ENETRESET
-#    define ENETRESET 9915
-#  endif
-
-#  ifndef ENETUNREACH
-#    define ENETUNREACH 9916
-#  endif
-
-#  ifndef ENOBUFS
-#    define ENOBUFS 9917
-#  endif
-
-#  ifndef ENOLINK
-#    define ENOLINK 9918
-#  endif
-
-#  ifndef ENODATA
-#    define ENODATA 9919
-#  endif
-
-#  ifndef ENOMSG
-#    define ENOMSG 9920
-#  endif
-
-#  ifndef ENOPROTOOPT
-#    define ENOPROTOOPT 9921
-#  endif
-
-#  ifndef ENOSR
-#    define ENOSR 9922
-#  endif
-
-#  ifndef ENOTSOCK
-#    define ENOTSOCK 9923
-#  endif
-
-#  ifndef ENOSTR
-#    define ENOSTR 9924
-#  endif
-
-#  ifndef ENOTCONN
-#    define ENOTCONN 9925
-#  endif
-
-#  ifndef ENOTSUP
-#    define ENOTSUP 9926
-#  endif
-
-#  ifndef ECANCELED
-#    define ECANCELED 9927
-#  endif
-
-#  ifndef EINPROGRESS
-#    define EINPROGRESS 9928
-#  endif
-
-#  ifndef EOPNOTSUPP
-#    define EOPNOTSUPP 9929
-#  endif
-
-#  ifndef EWOULDBLOCK
-#    define EWOULDBLOCK 9930
-#  endif
-
-#  ifndef EOWNERDEAD
-#    define EOWNERDEAD 9931
-#  endif
-
-#  ifndef EPROTO
-#    define EPROTO 9932
-#  endif
-
-#  ifndef EPROTONOSUPPORT
-#    define EPROTONOSUPPORT 9933
-#  endif
-
-#  ifndef ENOTRECOVERABLE
-#    define ENOTRECOVERABLE 9934
-#  endif
-
-#  ifndef ETIME
-#    define ETIME 9935
-#  endif
-
-#  ifndef ETXTBSY
-#    define ETXTBSY 9936
-#  endif
-
-#  ifndef ETIMEDOUT
-#    define ETIMEDOUT 9938
-#  endif
-
-#  ifndef ELOOP
-#    define ELOOP 9939
-#  endif
-
-#  ifndef EOVERFLOW
-#    define EOVERFLOW 9940
-#  endif
-
-#  ifndef EPROTOTYPE
-#    define EPROTOTYPE 9941
-#  endif
-
-#  ifndef ENOSYS
-#    define ENOSYS 9942
-#  endif
-
-#  ifndef EINVAL
-#    define EINVAL 9943
-#  endif
-
-#  ifndef ERANGE
-#    define ERANGE 9944
-#  endif
-
-#  ifndef EILSEQ
-#    define EILSEQ 9945
-#  endif
-
-//  Windows Mobile doesn't appear to define these:
-
-#  ifndef E2BIG
-#    define E2BIG 9946
-#  endif
-
-#  ifndef EDOM
-#    define EDOM 9947
-#  endif
-
-#  ifndef EFAULT
-#    define EFAULT 9948
-#  endif
-
-#  ifndef EBADF
-#    define EBADF 9949
-#  endif
-
-#  ifndef EPIPE
-#    define EPIPE 9950
-#  endif
-
-#  ifndef EXDEV
-#    define EXDEV 9951
-#  endif
-
-#  ifndef EBUSY
-#    define EBUSY 9952
-#  endif
-
-#  ifndef ENOTEMPTY
-#    define ENOTEMPTY 9953
-#  endif
-
-#  ifndef ENOEXEC
-#    define ENOEXEC 9954
-#  endif
-
-#  ifndef EEXIST
-#    define EEXIST 9955
-#  endif
-
-#  ifndef EFBIG
-#    define EFBIG 9956
-#  endif
-
-#  ifndef ENAMETOOLONG
-#    define ENAMETOOLONG 9957
-#  endif
-
-#  ifndef ENOTTY
-#    define ENOTTY 9958
-#  endif
-
-#  ifndef EINTR
-#    define EINTR 9959
-#  endif
-
-#  ifndef ESPIPE
-#    define ESPIPE 9960
-#  endif
-
-#  ifndef EIO
-#    define EIO 9961
-#  endif
-
-#  ifndef EISDIR
-#    define EISDIR 9962
-#  endif
-
-#  ifndef ECHILD
-#    define ECHILD 9963
-#  endif
-
-#  ifndef ENOLCK
-#    define ENOLCK 9964
-#  endif
-
-#  ifndef ENOSPC
-#    define ENOSPC 9965
-#  endif
-
-#  ifndef ENXIO
-#    define ENXIO 9966
-#  endif
-
-#  ifndef ENODEV
-#    define ENODEV 9967
-#  endif
-
-#  ifndef ENOENT
-#    define ENOENT 9968
-#  endif
-
-#  ifndef ESRCH
-#    define ESRCH 9969
-#  endif
-
-#  ifndef ENOTDIR
-#    define ENOTDIR 9970
-#  endif
-
-#  ifndef ENOMEM
-#    define ENOMEM 9971
-#  endif
-
-#  ifndef EPERM
-#    define EPERM 9972
-#  endif
-
-#  ifndef EACCES
-#    define EACCES 9973
-#  endif
-
-#  ifndef EROFS
-#    define EROFS 9974
-#  endif
-
-#  ifndef EDEADLK
-#    define EDEADLK 9975
-#  endif
-
-#  ifndef EAGAIN
-#    define EAGAIN 9976
-#  endif
-
-#  ifndef ENFILE
-#    define ENFILE 9977
-#  endif
-
-#  ifndef EMFILE
-#    define EMFILE 9978
-#  endif
-
-#  ifndef EMLINK
-#    define EMLINK 9979
-#  endif
-
-#endif // __cplusplus
-
-#endif // _LIBCPP___CXX03_ERRNO_H
diff --git a/libcxx/include/__cxx03/ext/__hash b/libcxx/include/__cxx03/ext/__hash
index 8f27c7ea105c5..e2c521568280a 100644
--- a/libcxx/include/__cxx03/ext/__hash
+++ b/libcxx/include/__cxx03/ext/__hash
@@ -14,8 +14,8 @@
 
 #include <__cxx03/__config>
 #include <__cxx03/cstring>
-#include <__cxx03/stddef.h>
 #include <__cxx03/string>
+#include <stddef.h>
 
 namespace __gnu_cxx {
 
diff --git a/libcxx/include/__cxx03/fenv.h b/libcxx/include/__cxx03/fenv.h
deleted file mode 100644
index 87fe9d18b2b77..0000000000000
--- a/libcxx/include/__cxx03/fenv.h
+++ /dev/null
@@ -1,114 +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_FENV_H
-#define _LIBCPP___CXX03_FENV_H
-
-/*
-    fenv.h synopsis
-
-This entire header is C99 / C++0X
-
-Macros:
-
-    FE_DIVBYZERO
-    FE_INEXACT
-    FE_INVALID
-    FE_OVERFLOW
-    FE_UNDERFLOW
-    FE_ALL_EXCEPT
-    FE_DOWNWARD
-    FE_TONEAREST
-    FE_TOWARDZERO
-    FE_UPWARD
-    FE_DFL_ENV
-
-Types:
-
-    fenv_t
-    fexcept_t
-
-int feclearexcept(int excepts);
-int fegetexceptflag(fexcept_t* flagp, int excepts);
-int feraiseexcept(int excepts);
-int fesetexceptflag(const fexcept_t* flagp, int excepts);
-int fetestexcept(int excepts);
-int fegetround();
-int fesetround(int round);
-int fegetenv(fenv_t* envp);
-int feholdexcept(fenv_t* envp);
-int fesetenv(const fenv_t* envp);
-int feupdateenv(const fenv_t* envp);
-
-
-*/
-
-#include <__cxx03/__config>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-#  pragma GCC system_header
-#endif
-
-#if __has_include_next(<fenv.h>)
-#  include_next <fenv.h>
-#endif
-
-#ifdef __cplusplus
-
-extern "C++" {
-
-#  ifdef feclearexcept
-#    undef feclearexcept
-#  endif
-
-#  ifdef fegetexceptflag
-#    undef fegetexceptflag
-#  endif
-
-#  ifdef feraiseexcept
-#    undef feraiseexcept
-#  endif
-
-#  ifdef fesetexceptflag
-#    undef fesetexceptflag
-#  endif
-
-#  ifdef fetestexcept
-#    undef fetestexcept
-#  endif
-
-#  ifdef fegetround
-#    undef fegetround
-#  endif
-
-#  ifdef fesetround
-#    undef fesetround
-#  endif
-
-#  ifdef fegetenv
-#    undef fegetenv
-#  endif
-
-#  ifdef feholdexcept
-#    undef feholdexcept
-#  endif
-
-#  ifdef fesetenv
-#    undef fesetenv
-#  endif
-
-#  ifdef feupdateenv
-#    undef feupdateenv
-#  endif
-
-} // extern "C++"
-
-#endif // defined(__cplusplus)
-
-#endif // _LIBCPP___CXX03_FENV_H
diff --git a/libcxx/include/__cxx03/float.h b/libcxx/include/__cxx03/float.h
deleted file mode 100644
index 38f199067f411..0000000000000
--- a/libcxx/include/__cxx03/float.h
+++ /dev/null
@@ -1,95 +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_FLOAT_H
-#define _LIBCPP___CXX03_FLOAT_H
-
-/*
-    float.h synopsis
-
-Macros:
-
-    FLT_ROUNDS
-    FLT_EVAL_METHOD     // C99
-    FLT_RADIX
-
-    FLT_MANT_DIG
-    DBL_MANT_DIG
-    LDBL_MANT_DIG
-
-    FLT_HAS_SUBNORM     // C11
-    DBL_HAS_SUBNORM     // C11
-    LDBL_HAS_SUBNORM    // C11
-
-    DECIMAL_DIG         // C99
-    FLT_DECIMAL_DIG     // C11
-    DBL_DECIMAL_DIG     // C11
-    LDBL_DECIMAL_DIG    // C11
-
-    FLT_DIG
-    DBL_DIG
-    LDBL_DIG
-
-    FLT_MIN_EXP
-    DBL_MIN_EXP
-    LDBL_MIN_EXP
-
-    FLT_MIN_10_EXP
-    DBL_MIN_10_EXP
-    LDBL_MIN_10_EXP
-
-    FLT_MAX_EXP
-    DBL_...
[truncated]

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.

I don't like that we're starting to mix frozen code and non-frozen code. For example, <wctype.h> will now have to work with both the C++03 config and with the normal config. That's straying a bit away from the original design of the RFC, which aimed to make C++03 disjoint from the rest.

However, I understand the need for something like this in order to fix modules support. I think this can be tolerated if it only needs to be done in the C compatibility headers.

@philnik777 philnik777 merged commit 44331d2 into llvm:main Oct 24, 2025
84 of 85 checks passed
@philnik777 philnik777 deleted the cxx03_remove_c_wrapper_headers branch October 24, 2025 08:08
dvbuka pushed a commit to dvbuka/llvm-project that referenced this pull request Oct 27, 2025
…lvm#163772)

`include_next` doesn't work very well with the C++03 headers and
modules. Since these specific headers are very self-contained there
isn't much of a reason to split them into C++03/non-C++03 headers, so
let's just remove them. The few C wrapper headers that aren't as
self-contained will be refactored in a separate patch.
Lukacma pushed a commit to Lukacma/llvm-project that referenced this pull request Oct 29, 2025
…lvm#163772)

`include_next` doesn't work very well with the C++03 headers and
modules. Since these specific headers are very self-contained there
isn't much of a reason to split them into C++03/non-C++03 headers, so
let's just remove them. The few C wrapper headers that aren't as
self-contained will be refactored in a separate patch.
aokblast pushed a commit to aokblast/llvm-project that referenced this pull request Oct 30, 2025
…lvm#163772)

`include_next` doesn't work very well with the C++03 headers and
modules. Since these specific headers are very self-contained there
isn't much of a reason to split them into C++03/non-C++03 headers, so
let's just remove them. The few C wrapper headers that aren't as
self-contained will be refactored in a separate patch.
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.

3 participants