Skip to content

Commit

Permalink
[libc++][C++03] Use __cxx03/ headers in C++03 mode (#109002)
Browse files Browse the repository at this point in the history
This patch implements the forwarding to frozen C++03 headers as
discussed in
https://discourse.llvm.org/t/rfc-freezing-c-03-headers-in-libc. In the
RFC, we initially proposed selecting the right headers from the Clang
driver, however consensus seemed to steer towards handling this in the
library itself. This patch implements that direction.

At a high level, the changes basically amount to making each public
header look like this:

```
// inside <vector>
#ifdef _LIBCPP_CXX03_LANG
#  include <__cxx03/vector>
#else
  // normal <vector> content
#endif
```

In most cases, public headers are simple umbrella headers so there isn't
much code in the #else branch. In other cases, the #else branch contains
the actual implementation of the header.
  • Loading branch information
philnik777 authored Dec 21, 2024
1 parent c361fd5 commit b9a2658
Show file tree
Hide file tree
Showing 247 changed files with 2,889 additions and 2,506 deletions.
1 change: 1 addition & 0 deletions .github/workflows/libcxx-build-and-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ jobs:
fail-fast: false
matrix:
config: [
'frozen-cxx03-headers',
'generic-cxx03',
'generic-cxx26',
'generic-modules'
Expand Down
2 changes: 2 additions & 0 deletions libcxx/cmake/caches/Generic-cxx03-frozen.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
set(LIBCXX_TEST_PARAMS "std=c++03;test_frozen_cxx03_headers=True" CACHE STRING "")
set(LIBCXXABI_TEST_PARAMS "${LIBCXX_TEST_PARAMS}" CACHE STRING "")
Loading

0 comments on commit b9a2658

Please sign in to comment.