Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[libc++] Add #if 0 block to all the top-level headers #119234

Merged
merged 1 commit into from
Dec 10, 2024

Conversation

philnik777
Copy link
Contributor

Including The frozen C++03 headers results in a lot of formatting changes in the main headers, so this splits these changes into a separate commit instead.

This is part of https://discourse.llvm.org/t/rfc-freezing-c-03-headers-in-libc.

@philnik777 philnik777 requested a review from a team as a code owner December 9, 2024 17:33
@llvmbot llvmbot added the libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. label Dec 9, 2024
@llvmbot
Copy link
Member

llvmbot commented Dec 9, 2024

@llvm/pr-subscribers-libcxx

Author: Nikolas Klauser (philnik777)

Changes

Including The frozen C++03 headers results in a lot of formatting changes in the main headers, so this splits these changes into a separate commit instead.

This is part of https://discourse.llvm.org/t/rfc-freezing-c-03-headers-in-libc.


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

123 Files Affected:

  • (modified) libcxx/include/algorithm (+226-223)
  • (modified) libcxx/include/any (+69-66)
  • (modified) libcxx/include/array (+93-90)
  • (modified) libcxx/include/atomic (+39-36)
  • (modified) libcxx/include/barrier (+37-34)
  • (modified) libcxx/include/bit (+35-32)
  • (modified) libcxx/include/bitset (+55-52)
  • (modified) libcxx/include/cassert (+12-9)
  • (modified) libcxx/include/ccomplex (+10-7)
  • (modified) libcxx/include/cctype (+52-49)
  • (modified) libcxx/include/cerrno (+10-7)
  • (modified) libcxx/include/cfenv (+10-7)
  • (modified) libcxx/include/cfloat (+10-7)
  • (modified) libcxx/include/charconv (+35-32)
  • (modified) libcxx/include/chrono (+73-70)
  • (modified) libcxx/include/cinttypes (+12-8)
  • (modified) libcxx/include/ciso646 (+9-6)
  • (modified) libcxx/include/climits (+9-5)
  • (modified) libcxx/include/clocale (+11-7)
  • (modified) libcxx/include/cmath (+32-29)
  • (modified) libcxx/include/codecvt (+35-31)
  • (modified) libcxx/include/compare (+32-29)
  • (modified) libcxx/include/complex (+45-42)
  • (modified) libcxx/include/complex.h (+14-11)
  • (modified) libcxx/include/concepts (+40-37)
  • (modified) libcxx/include/condition_variable (+48-41)
  • (modified) libcxx/include/coroutine (+21-18)
  • (modified) libcxx/include/csetjmp (+13-9)
  • (modified) libcxx/include/csignal (+13-9)
  • (modified) libcxx/include/cstdalign (+19-16)
  • (modified) libcxx/include/cstdarg (+13-9)
  • (modified) libcxx/include/cstdbool (+12-9)
  • (modified) libcxx/include/cstddef (+18-15)
  • (modified) libcxx/include/cstdint (+11-7)
  • (modified) libcxx/include/cstdio (+14-10)
  • (modified) libcxx/include/cstdlib (+18-14)
  • (modified) libcxx/include/cstring (+13-9)
  • (modified) libcxx/include/ctgmath (+12-8)
  • (modified) libcxx/include/ctime (+18-14)
  • (modified) libcxx/include/ctype.h (+31-28)
  • (modified) libcxx/include/cuchar (+15-12)
  • (modified) libcxx/include/cwchar (+31-28)
  • (modified) libcxx/include/cwctype (+14-10)
  • (modified) libcxx/include/deque (+175-172)
  • (modified) libcxx/include/errno.h (+271-268)
  • (modified) libcxx/include/exception (+20-17)
  • (modified) libcxx/include/execution (+21-18)
  • (modified) libcxx/include/expected (+17-14)
  • (modified) libcxx/include/fenv.h (+45-42)
  • (modified) libcxx/include/filesystem (+39-36)
  • (modified) libcxx/include/flat_map (+13-10)
  • (modified) libcxx/include/float.h (+18-15)
  • (modified) libcxx/include/format (+67-64)
  • (modified) libcxx/include/forward_list (+144-141)
  • (modified) libcxx/include/fstream (+141-138)
  • (modified) libcxx/include/functional (+70-67)
  • (modified) libcxx/include/future (+121-118)
  • (modified) libcxx/include/initializer_list (+14-11)
  • (modified) libcxx/include/inttypes.h (+18-15)
  • (modified) libcxx/include/iomanip (+47-44)
  • (modified) libcxx/include/ios (+63-60)
  • (modified) libcxx/include/iosfwd (+29-25)
  • (modified) libcxx/include/iostream (+15-11)
  • (modified) libcxx/include/istream (+130-126)
  • (modified) libcxx/include/iterator (+71-68)
  • (modified) libcxx/include/latch (+23-20)
  • (modified) libcxx/include/limits (+30-27)
  • (modified) libcxx/include/list (+166-163)
  • (modified) libcxx/include/locale (+156-153)
  • (modified) libcxx/include/map (+183-182)
  • (modified) libcxx/include/math.h (+4-1)
  • (modified) libcxx/include/mdspan (+20-17)
  • (modified) libcxx/include/memory (+55-52)
  • (modified) libcxx/include/memory_resource (+27-24)
  • (modified) libcxx/include/mutex (+47-44)
  • (modified) libcxx/include/new (+96-93)
  • (modified) libcxx/include/numbers (+16-13)
  • (modified) libcxx/include/numeric (+50-47)
  • (modified) libcxx/include/optional (+101-98)
  • (modified) libcxx/include/ostream (+27-24)
  • (modified) libcxx/include/print (+67-63)
  • (modified) libcxx/include/queue (+91-90)
  • (modified) libcxx/include/random (+60-57)
  • (modified) libcxx/include/ranges (+65-62)
  • (modified) libcxx/include/ratio (+30-27)
  • (modified) libcxx/include/regex (+157-154)
  • (modified) libcxx/include/scoped_allocator (+45-42)
  • (modified) libcxx/include/semaphore (+31-28)
  • (modified) libcxx/include/set (+155-156)
  • (modified) libcxx/include/shared_mutex (+31-28)
  • (modified) libcxx/include/source_location (+12-8)
  • (modified) libcxx/include/span (+87-84)
  • (modified) libcxx/include/sstream (+99-96)
  • (modified) libcxx/include/stack (+51-50)
  • (modified) libcxx/include/stdatomic.h (+23-20)
  • (modified) libcxx/include/stdbool.h (+20-17)
  • (modified) libcxx/include/stddef.h (+12-9)
  • (modified) libcxx/include/stdexcept (+62-59)
  • (modified) libcxx/include/stdio.h (+24-21)
  • (modified) libcxx/include/stdlib.h (+36-33)
  • (modified) libcxx/include/stop_token (+19-16)
  • (modified) libcxx/include/streambuf (+27-24)
  • (modified) libcxx/include/string (+274-271)
  • (modified) libcxx/include/string.h (+16-12)
  • (modified) libcxx/include/string_view (+96-93)
  • (modified) libcxx/include/strstream (+28-25)
  • (modified) libcxx/include/syncstream (+47-44)
  • (modified) libcxx/include/system_error (+22-19)
  • (modified) libcxx/include/tgmath.h (+16-13)
  • (modified) libcxx/include/thread (+29-26)
  • (modified) libcxx/include/tuple (+107-104)
  • (modified) libcxx/include/type_traits (+106-103)
  • (modified) libcxx/include/typeindex (+21-18)
  • (modified) libcxx/include/typeinfo (+61-58)
  • (modified) libcxx/include/uchar.h (+16-13)
  • (modified) libcxx/include/unordered_map (+180-177)
  • (modified) libcxx/include/unordered_set (+149-146)
  • (modified) libcxx/include/utility (+54-51)
  • (modified) libcxx/include/valarray (+106-103)
  • (modified) libcxx/include/variant (+204-201)
  • (modified) libcxx/include/vector (+51-48)
  • (modified) libcxx/include/wchar.h (+31-28)
  • (modified) libcxx/include/wctype.h (+31-28)
diff --git a/libcxx/include/algorithm b/libcxx/include/algorithm
index 14355d63f2901c..080fca8c1ca517 100644
--- a/libcxx/include/algorithm
+++ b/libcxx/include/algorithm
@@ -1827,232 +1827,235 @@ template <class BidirectionalIterator, class Compare>
 
 */
 
-#include <__config>
-
-#include <__algorithm/adjacent_find.h>
-#include <__algorithm/all_of.h>
-#include <__algorithm/any_of.h>
-#include <__algorithm/binary_search.h>
-#include <__algorithm/copy.h>
-#include <__algorithm/copy_backward.h>
-#include <__algorithm/copy_if.h>
-#include <__algorithm/copy_n.h>
-#include <__algorithm/count.h>
-#include <__algorithm/count_if.h>
-#include <__algorithm/equal.h>
-#include <__algorithm/equal_range.h>
-#include <__algorithm/fill.h>
-#include <__algorithm/fill_n.h>
-#include <__algorithm/find.h>
-#include <__algorithm/find_end.h>
-#include <__algorithm/find_first_of.h>
-#include <__algorithm/find_if.h>
-#include <__algorithm/find_if_not.h>
-#include <__algorithm/for_each.h>
-#include <__algorithm/generate.h>
-#include <__algorithm/generate_n.h>
-#include <__algorithm/includes.h>
-#include <__algorithm/inplace_merge.h>
-#include <__algorithm/is_heap.h>
-#include <__algorithm/is_heap_until.h>
-#include <__algorithm/is_partitioned.h>
-#include <__algorithm/is_permutation.h>
-#include <__algorithm/is_sorted.h>
-#include <__algorithm/is_sorted_until.h>
-#include <__algorithm/iter_swap.h>
-#include <__algorithm/lexicographical_compare.h>
-#include <__algorithm/lower_bound.h>
-#include <__algorithm/make_heap.h>
-#include <__algorithm/max.h>
-#include <__algorithm/max_element.h>
-#include <__algorithm/merge.h>
-#include <__algorithm/min.h>
-#include <__algorithm/min_element.h>
-#include <__algorithm/minmax.h>
-#include <__algorithm/minmax_element.h>
-#include <__algorithm/mismatch.h>
-#include <__algorithm/move.h>
-#include <__algorithm/move_backward.h>
-#include <__algorithm/next_permutation.h>
-#include <__algorithm/none_of.h>
-#include <__algorithm/nth_element.h>
-#include <__algorithm/partial_sort.h>
-#include <__algorithm/partial_sort_copy.h>
-#include <__algorithm/partition.h>
-#include <__algorithm/partition_copy.h>
-#include <__algorithm/partition_point.h>
-#include <__algorithm/pop_heap.h>
-#include <__algorithm/prev_permutation.h>
-#include <__algorithm/push_heap.h>
-#include <__algorithm/remove.h>
-#include <__algorithm/remove_copy.h>
-#include <__algorithm/remove_copy_if.h>
-#include <__algorithm/remove_if.h>
-#include <__algorithm/replace.h>
-#include <__algorithm/replace_copy.h>
-#include <__algorithm/replace_copy_if.h>
-#include <__algorithm/replace_if.h>
-#include <__algorithm/reverse.h>
-#include <__algorithm/reverse_copy.h>
-#include <__algorithm/rotate.h>
-#include <__algorithm/rotate_copy.h>
-#include <__algorithm/search.h>
-#include <__algorithm/search_n.h>
-#include <__algorithm/set_difference.h>
-#include <__algorithm/set_intersection.h>
-#include <__algorithm/set_symmetric_difference.h>
-#include <__algorithm/set_union.h>
-#include <__algorithm/shuffle.h>
-#include <__algorithm/sort.h>
-#include <__algorithm/sort_heap.h>
-#include <__algorithm/stable_partition.h>
-#include <__algorithm/stable_sort.h>
-#include <__algorithm/swap_ranges.h>
-#include <__algorithm/transform.h>
-#include <__algorithm/unique.h>
-#include <__algorithm/unique_copy.h>
-#include <__algorithm/upper_bound.h>
-
-#if _LIBCPP_STD_VER >= 17
-#  include <__algorithm/clamp.h>
-#  include <__algorithm/for_each_n.h>
-#  include <__algorithm/pstl.h>
-#  include <__algorithm/sample.h>
-#endif // _LIBCPP_STD_VER >= 17
-
-#if _LIBCPP_STD_VER >= 20
-#  include <__algorithm/in_found_result.h>
-#  include <__algorithm/in_fun_result.h>
-#  include <__algorithm/in_in_out_result.h>
-#  include <__algorithm/in_in_result.h>
-#  include <__algorithm/in_out_out_result.h>
-#  include <__algorithm/in_out_result.h>
-#  include <__algorithm/lexicographical_compare_three_way.h>
-#  include <__algorithm/min_max_result.h>
-#  include <__algorithm/ranges_adjacent_find.h>
-#  include <__algorithm/ranges_all_of.h>
-#  include <__algorithm/ranges_any_of.h>
-#  include <__algorithm/ranges_binary_search.h>
-#  include <__algorithm/ranges_clamp.h>
-#  include <__algorithm/ranges_contains.h>
-#  include <__algorithm/ranges_copy.h>
-#  include <__algorithm/ranges_copy_backward.h>
-#  include <__algorithm/ranges_copy_if.h>
-#  include <__algorithm/ranges_copy_n.h>
-#  include <__algorithm/ranges_count.h>
-#  include <__algorithm/ranges_count_if.h>
-#  include <__algorithm/ranges_equal.h>
-#  include <__algorithm/ranges_equal_range.h>
-#  include <__algorithm/ranges_fill.h>
-#  include <__algorithm/ranges_fill_n.h>
-#  include <__algorithm/ranges_find.h>
-#  include <__algorithm/ranges_find_end.h>
-#  include <__algorithm/ranges_find_first_of.h>
-#  include <__algorithm/ranges_find_if.h>
-#  include <__algorithm/ranges_find_if_not.h>
-#  include <__algorithm/ranges_for_each.h>
-#  include <__algorithm/ranges_for_each_n.h>
-#  include <__algorithm/ranges_generate.h>
-#  include <__algorithm/ranges_generate_n.h>
-#  include <__algorithm/ranges_includes.h>
-#  include <__algorithm/ranges_inplace_merge.h>
-#  include <__algorithm/ranges_is_heap.h>
-#  include <__algorithm/ranges_is_heap_until.h>
-#  include <__algorithm/ranges_is_partitioned.h>
-#  include <__algorithm/ranges_is_permutation.h>
-#  include <__algorithm/ranges_is_sorted.h>
-#  include <__algorithm/ranges_is_sorted_until.h>
-#  include <__algorithm/ranges_lexicographical_compare.h>
-#  include <__algorithm/ranges_lower_bound.h>
-#  include <__algorithm/ranges_make_heap.h>
-#  include <__algorithm/ranges_max.h>
-#  include <__algorithm/ranges_max_element.h>
-#  include <__algorithm/ranges_merge.h>
-#  include <__algorithm/ranges_min.h>
-#  include <__algorithm/ranges_min_element.h>
-#  include <__algorithm/ranges_minmax.h>
-#  include <__algorithm/ranges_minmax_element.h>
-#  include <__algorithm/ranges_mismatch.h>
-#  include <__algorithm/ranges_move.h>
-#  include <__algorithm/ranges_move_backward.h>
-#  include <__algorithm/ranges_next_permutation.h>
-#  include <__algorithm/ranges_none_of.h>
-#  include <__algorithm/ranges_nth_element.h>
-#  include <__algorithm/ranges_partial_sort.h>
-#  include <__algorithm/ranges_partial_sort_copy.h>
-#  include <__algorithm/ranges_partition.h>
-#  include <__algorithm/ranges_partition_copy.h>
-#  include <__algorithm/ranges_partition_point.h>
-#  include <__algorithm/ranges_pop_heap.h>
-#  include <__algorithm/ranges_prev_permutation.h>
-#  include <__algorithm/ranges_push_heap.h>
-#  include <__algorithm/ranges_remove.h>
-#  include <__algorithm/ranges_remove_copy.h>
-#  include <__algorithm/ranges_remove_copy_if.h>
-#  include <__algorithm/ranges_remove_if.h>
-#  include <__algorithm/ranges_replace.h>
-#  include <__algorithm/ranges_replace_copy.h>
-#  include <__algorithm/ranges_replace_copy_if.h>
-#  include <__algorithm/ranges_replace_if.h>
-#  include <__algorithm/ranges_reverse.h>
-#  include <__algorithm/ranges_reverse_copy.h>
-#  include <__algorithm/ranges_rotate.h>
-#  include <__algorithm/ranges_rotate_copy.h>
-#  include <__algorithm/ranges_sample.h>
-#  include <__algorithm/ranges_search.h>
-#  include <__algorithm/ranges_search_n.h>
-#  include <__algorithm/ranges_set_difference.h>
-#  include <__algorithm/ranges_set_intersection.h>
-#  include <__algorithm/ranges_set_symmetric_difference.h>
-#  include <__algorithm/ranges_set_union.h>
-#  include <__algorithm/ranges_shuffle.h>
-#  include <__algorithm/ranges_sort.h>
-#  include <__algorithm/ranges_sort_heap.h>
-#  include <__algorithm/ranges_stable_partition.h>
-#  include <__algorithm/ranges_stable_sort.h>
-#  include <__algorithm/ranges_swap_ranges.h>
-#  include <__algorithm/ranges_transform.h>
-#  include <__algorithm/ranges_unique.h>
-#  include <__algorithm/ranges_unique_copy.h>
-#  include <__algorithm/ranges_upper_bound.h>
-#  include <__algorithm/shift_left.h>
-#  include <__algorithm/shift_right.h>
-#endif
-
-#if _LIBCPP_STD_VER >= 23
-#  include <__algorithm/ranges_contains_subrange.h>
-#  include <__algorithm/ranges_ends_with.h>
-#  include <__algorithm/ranges_find_last.h>
-#  include <__algorithm/ranges_fold.h>
-#  include <__algorithm/ranges_starts_with.h>
-#endif // _LIBCPP_STD_VER >= 23
-
-#include <version>
+#if 0
+#else // 0
+#  include <__config>
+
+#  include <__algorithm/adjacent_find.h>
+#  include <__algorithm/all_of.h>
+#  include <__algorithm/any_of.h>
+#  include <__algorithm/binary_search.h>
+#  include <__algorithm/copy.h>
+#  include <__algorithm/copy_backward.h>
+#  include <__algorithm/copy_if.h>
+#  include <__algorithm/copy_n.h>
+#  include <__algorithm/count.h>
+#  include <__algorithm/count_if.h>
+#  include <__algorithm/equal.h>
+#  include <__algorithm/equal_range.h>
+#  include <__algorithm/fill.h>
+#  include <__algorithm/fill_n.h>
+#  include <__algorithm/find.h>
+#  include <__algorithm/find_end.h>
+#  include <__algorithm/find_first_of.h>
+#  include <__algorithm/find_if.h>
+#  include <__algorithm/find_if_not.h>
+#  include <__algorithm/for_each.h>
+#  include <__algorithm/generate.h>
+#  include <__algorithm/generate_n.h>
+#  include <__algorithm/includes.h>
+#  include <__algorithm/inplace_merge.h>
+#  include <__algorithm/is_heap.h>
+#  include <__algorithm/is_heap_until.h>
+#  include <__algorithm/is_partitioned.h>
+#  include <__algorithm/is_permutation.h>
+#  include <__algorithm/is_sorted.h>
+#  include <__algorithm/is_sorted_until.h>
+#  include <__algorithm/iter_swap.h>
+#  include <__algorithm/lexicographical_compare.h>
+#  include <__algorithm/lower_bound.h>
+#  include <__algorithm/make_heap.h>
+#  include <__algorithm/max.h>
+#  include <__algorithm/max_element.h>
+#  include <__algorithm/merge.h>
+#  include <__algorithm/min.h>
+#  include <__algorithm/min_element.h>
+#  include <__algorithm/minmax.h>
+#  include <__algorithm/minmax_element.h>
+#  include <__algorithm/mismatch.h>
+#  include <__algorithm/move.h>
+#  include <__algorithm/move_backward.h>
+#  include <__algorithm/next_permutation.h>
+#  include <__algorithm/none_of.h>
+#  include <__algorithm/nth_element.h>
+#  include <__algorithm/partial_sort.h>
+#  include <__algorithm/partial_sort_copy.h>
+#  include <__algorithm/partition.h>
+#  include <__algorithm/partition_copy.h>
+#  include <__algorithm/partition_point.h>
+#  include <__algorithm/pop_heap.h>
+#  include <__algorithm/prev_permutation.h>
+#  include <__algorithm/push_heap.h>
+#  include <__algorithm/remove.h>
+#  include <__algorithm/remove_copy.h>
+#  include <__algorithm/remove_copy_if.h>
+#  include <__algorithm/remove_if.h>
+#  include <__algorithm/replace.h>
+#  include <__algorithm/replace_copy.h>
+#  include <__algorithm/replace_copy_if.h>
+#  include <__algorithm/replace_if.h>
+#  include <__algorithm/reverse.h>
+#  include <__algorithm/reverse_copy.h>
+#  include <__algorithm/rotate.h>
+#  include <__algorithm/rotate_copy.h>
+#  include <__algorithm/search.h>
+#  include <__algorithm/search_n.h>
+#  include <__algorithm/set_difference.h>
+#  include <__algorithm/set_intersection.h>
+#  include <__algorithm/set_symmetric_difference.h>
+#  include <__algorithm/set_union.h>
+#  include <__algorithm/shuffle.h>
+#  include <__algorithm/sort.h>
+#  include <__algorithm/sort_heap.h>
+#  include <__algorithm/stable_partition.h>
+#  include <__algorithm/stable_sort.h>
+#  include <__algorithm/swap_ranges.h>
+#  include <__algorithm/transform.h>
+#  include <__algorithm/unique.h>
+#  include <__algorithm/unique_copy.h>
+#  include <__algorithm/upper_bound.h>
+
+#  if _LIBCPP_STD_VER >= 17
+#    include <__algorithm/clamp.h>
+#    include <__algorithm/for_each_n.h>
+#    include <__algorithm/pstl.h>
+#    include <__algorithm/sample.h>
+#  endif // _LIBCPP_STD_VER >= 17
+
+#  if _LIBCPP_STD_VER >= 20
+#    include <__algorithm/in_found_result.h>
+#    include <__algorithm/in_fun_result.h>
+#    include <__algorithm/in_in_out_result.h>
+#    include <__algorithm/in_in_result.h>
+#    include <__algorithm/in_out_out_result.h>
+#    include <__algorithm/in_out_result.h>
+#    include <__algorithm/lexicographical_compare_three_way.h>
+#    include <__algorithm/min_max_result.h>
+#    include <__algorithm/ranges_adjacent_find.h>
+#    include <__algorithm/ranges_all_of.h>
+#    include <__algorithm/ranges_any_of.h>
+#    include <__algorithm/ranges_binary_search.h>
+#    include <__algorithm/ranges_clamp.h>
+#    include <__algorithm/ranges_contains.h>
+#    include <__algorithm/ranges_copy.h>
+#    include <__algorithm/ranges_copy_backward.h>
+#    include <__algorithm/ranges_copy_if.h>
+#    include <__algorithm/ranges_copy_n.h>
+#    include <__algorithm/ranges_count.h>
+#    include <__algorithm/ranges_count_if.h>
+#    include <__algorithm/ranges_equal.h>
+#    include <__algorithm/ranges_equal_range.h>
+#    include <__algorithm/ranges_fill.h>
+#    include <__algorithm/ranges_fill_n.h>
+#    include <__algorithm/ranges_find.h>
+#    include <__algorithm/ranges_find_end.h>
+#    include <__algorithm/ranges_find_first_of.h>
+#    include <__algorithm/ranges_find_if.h>
+#    include <__algorithm/ranges_find_if_not.h>
+#    include <__algorithm/ranges_for_each.h>
+#    include <__algorithm/ranges_for_each_n.h>
+#    include <__algorithm/ranges_generate.h>
+#    include <__algorithm/ranges_generate_n.h>
+#    include <__algorithm/ranges_includes.h>
+#    include <__algorithm/ranges_inplace_merge.h>
+#    include <__algorithm/ranges_is_heap.h>
+#    include <__algorithm/ranges_is_heap_until.h>
+#    include <__algorithm/ranges_is_partitioned.h>
+#    include <__algorithm/ranges_is_permutation.h>
+#    include <__algorithm/ranges_is_sorted.h>
+#    include <__algorithm/ranges_is_sorted_until.h>
+#    include <__algorithm/ranges_lexicographical_compare.h>
+#    include <__algorithm/ranges_lower_bound.h>
+#    include <__algorithm/ranges_make_heap.h>
+#    include <__algorithm/ranges_max.h>
+#    include <__algorithm/ranges_max_element.h>
+#    include <__algorithm/ranges_merge.h>
+#    include <__algorithm/ranges_min.h>
+#    include <__algorithm/ranges_min_element.h>
+#    include <__algorithm/ranges_minmax.h>
+#    include <__algorithm/ranges_minmax_element.h>
+#    include <__algorithm/ranges_mismatch.h>
+#    include <__algorithm/ranges_move.h>
+#    include <__algorithm/ranges_move_backward.h>
+#    include <__algorithm/ranges_next_permutation.h>
+#    include <__algorithm/ranges_none_of.h>
+#    include <__algorithm/ranges_nth_element.h>
+#    include <__algorithm/ranges_partial_sort.h>
+#    include <__algorithm/ranges_partial_sort_copy.h>
+#    include <__algorithm/ranges_partition.h>
+#    include <__algorithm/ranges_partition_copy.h>
+#    include <__algorithm/ranges_partition_point.h>
+#    include <__algorithm/ranges_pop_heap.h>
+#    include <__algorithm/ranges_prev_permutation.h>
+#    include <__algorithm/ranges_push_heap.h>
+#    include <__algorithm/ranges_remove.h>
+#    include <__algorithm/ranges_remove_copy.h>
+#    include <__algorithm/ranges_remove_copy_if.h>
+#    include <__algorithm/ranges_remove_if.h>
+#    include <__algorithm/ranges_replace.h>
+#    include <__algorithm/ranges_replace_copy.h>
+#    include <__algorithm/ranges_replace_copy_if.h>
+#    include <__algorithm/ranges_replace_if.h>
+#    include <__algorithm/ranges_reverse.h>
+#    include <__algorithm/ranges_reverse_copy.h>
+#    include <__algorithm/ranges_rotate.h>
+#    include <__algorithm/ranges_rotate_copy.h>
+#    include <__algorithm/ranges_sample.h>
+#    include <__algorithm/ranges_search.h>
+#    include <__algorithm/ranges_search_n.h>
+#    include <__algorithm/ranges_set_difference.h>
+#    include <__algorithm/ranges_set_intersection.h>
+#    include <__algorithm/ranges_set_symmetric_difference.h>
+#    include <__algorithm/ranges_set_union.h>
+#    include <__algorithm/ranges_shuffle.h>
+#    include <__algorithm/ranges_sort.h>
+#    include <__algorithm/ranges_sort_heap.h>
+#    include <__algorithm/ranges_stable_partition.h>
+#    include <__algorithm/ranges_stable_sort.h>
+#    include <__algorithm/ranges_swap_ranges.h>
+#    include <__algorithm/ranges_transform.h>
+#    include <__algorithm/ranges_unique.h>
+#    include <__algorithm/ranges_unique_copy.h>
+#    include <__algorithm/ranges_upper_bound.h>
+#    include <__algorithm/shift_left.h>
+#    include <__algorithm/shift_right.h>
+#  endif
+
+#  if _LIBCPP_STD_VER >= 23
+#    include <__algorithm/ranges_contains_subrange.h>
+#    include <__algorithm/ranges_ends_with.h>
+#    include <__algorithm/ranges_find_last.h>
+#    include <__algorithm/ranges_fold.h>
+#    include <__algorithm/ranges_starts_with.h>
+#  endif // _LIBCPP_STD_VER >= 23
+
+#  include <version>
 
 // standard-mandated includes
 
 // [algorithm.syn]
-#include <initializer_list>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-#  pragma GCC system_header
-#endif
-
-#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER == 14
-#  include <execution>
-#endif
-
-#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
-#  include <atomic>
-#  include <bit>
-#  include <concepts>
-#  include <cstdlib>
-#  include <cstring>
-#  include <iterator>
-#  include <memory>
-#  include <stdexcept>
-#  include <type_traits>
-#  include <utility>
-#endif
+#  include <initializer_list>
+
+#  if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#    pragma GCC system_header
+#  endif
+
+#  if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER == 14
+#    include <execution>
+#  endif
+
+#  if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
+#    include <atomic>
+#    include <bit>
+#    include <concepts>
+#    include <cstdlib>
+#    include <cstring>
+#    include <iterator>
+#    include <memory>
+#    include <stdexcept>
+#    include <type_traits>
+#    include <utility>
+#  endif
+#endif // 0
 
 #endif // _LIBCPP_ALGORITHM
diff --git a/libcxx/include/any b/libcxx/include/any
index cae56fa376e057..c8658a468713ce 100644
--- a/libcxx/include/any
+++ b/libcxx/include/any
@@ -80,41 +80,43 @@ namespace std {
 
 */
 
-#include <__config>
-#include <__memory/allocator.h>
-#include <__memory/allocator_destructor.h>
-#include <__memory/allocator_traits.h>
-#include <__memory/unique_ptr.h>
-#include <__type_traits/add_cv_quals.h>
-#include <__type_traits/add_pointer.h>
-#include <__type_traits/aligned_storage.h>
-#include <__type_traits/conditional.h>
-#include <__type_traits/decay.h>
-#include <__type_traits/enable_if.h>
-#include <__type_traits/is_constructible.h>
-#include <__type_traits/is_function.h>
-#include <__type_traits/is_nothrow_constructible.h>
-#include <__type_traits/is_reference.h>
-#include <__type_traits/is_same.h>
-#include <__type_traits/is_void.h>
-#include <__type_traits/remove_cv.h>
-#include <__type_traits/remove_cvref.h>
-#include <__type_traits/remove_reference.h>
-#include <__utility/forward.h>
-#include <__utility/in_place.h>
-#include <__utility/move.h>
-#include <__utility/unreachable.h>
-#include <__verbose_abort>
-#include <initializer_list>
-#include <typeinfo>
-#include <version>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-#  pragma GCC system_header
-#endif
+#if 0
+#else // 0
+#  include <__config>
+#  include <__memory/allocator.h>
+#  include <__memory/allocator_destructor.h>
+#  include <__memory/allocator_traits.h>
+#  include <__memory/unique_ptr.h>
+#  include <__type_traits/add_cv_quals.h>
+#  include <__type_traits/add_pointer.h>
+#  include <__type_traits/aligned_storage.h>
+#  include <__type_traits/conditional.h>
+#  include <__type_traits/decay.h>
+#  include <__type_traits/enable_if.h>
+#  include <__type_traits/is_constructible.h>
+#  include <__type_traits/is_function.h>
+#  include <__type_traits/is_nothrow_constructible.h>
+#  include <__type_traits/is_reference.h>
+#  include <__type_traits/is_same.h>
+#  include <__type_traits/is_void.h>
+#  include <__type_traits/remove_cv.h>
+#  include <__type_traits/remove_cvref.h>
+#  include <__type_traits/remove_reference.h>
+#  include <__utility/forward.h>
+#  include <__utility/in_place.h>
+#  include <__utility/move.h>
+#  include <__utility/unreachable.h>
+#  include <__verbose_abort>
+#  include <initializer_list>
+#  include <typeinfo>
+#  include <version>
+
+#  if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#    pragma GCC system_header
+#  endif
 
 _LIBCPP_PUSH_MACROS
-#include <__undef_macros>
+#  include <__undef_...
[truncated]

Copy link

github-actions bot commented Dec 9, 2024

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

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 assuming:

  1. Green CI
  2. When you substitute back #if 0\n#else and #endif // 0 to nothing and run clang-format, this patch is a no-op.

This should be easy to check.

@philnik777 philnik777 force-pushed the cxx03_pp_main_headers branch 2 times, most recently from 52dccdb to 02c4ebe Compare December 10, 2024 00:59
@philnik777
Copy link
Contributor Author

LGTM assuming:

1. Green CI

2. When you substitute back `#if 0\n#else` and `#endif // 0` to nothing and run clang-format, this patch is a no-op.

This should be easy to check.

I've had a few hiccups due to the comments being formatted, but with a few manual fixes for that the diff was only the disagreement between my version of clang-format and the one used in the CI.

@philnik777 philnik777 force-pushed the cxx03_pp_main_headers branch from 02c4ebe to 785b0e0 Compare December 10, 2024 01:12
@philnik777 philnik777 merged commit c166a9c into llvm:main Dec 10, 2024
61 of 63 checks passed
@philnik777 philnik777 deleted the cxx03_pp_main_headers branch December 10, 2024 17:23
@philnik777
Copy link
Contributor Author

For future reference, see #109002. Basically, the 0 here will be replaced by __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) (or something very similar) in a later patch.

broxigarchen pushed a commit to broxigarchen/llvm-project that referenced this pull request Dec 10, 2024
Including The frozen C++03 headers results in a lot of formatting
changes in the main headers, so this splits these changes into a
separate commit instead.

This is part of
https://discourse.llvm.org/t/rfc-freezing-c-03-headers-in-libc.
ldionne pushed a commit that referenced this pull request Dec 11, 2024
…ll (#119541)

This has already been done for the most headers in
#119234, but I
forgot to also do it for the experimental/ and ext/ headers.

This is part of https://discourse.llvm.org/t/rfc-freezing-c-03-headers-in-libc.
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