diff --git a/libcxx/include/CMakeLists.txt b/libcxx/include/CMakeLists.txt --- a/libcxx/include/CMakeLists.txt +++ b/libcxx/include/CMakeLists.txt @@ -4,76 +4,76 @@ __algorithm/any_of.h __algorithm/binary_search.h __algorithm/clamp.h - __algorithm/comp_ref_type.h __algorithm/comp.h + __algorithm/comp_ref_type.h + __algorithm/copy.h __algorithm/copy_backward.h __algorithm/copy_if.h __algorithm/copy_n.h - __algorithm/copy.h - __algorithm/count_if.h __algorithm/count.h - __algorithm/equal_range.h + __algorithm/count_if.h __algorithm/equal.h - __algorithm/fill_n.h + __algorithm/equal_range.h __algorithm/fill.h + __algorithm/fill_n.h + __algorithm/find.h __algorithm/find_end.h __algorithm/find_first_of.h - __algorithm/find_if_not.h __algorithm/find_if.h - __algorithm/find.h - __algorithm/for_each_n.h + __algorithm/find_if_not.h __algorithm/for_each.h - __algorithm/generate_n.h + __algorithm/for_each_n.h __algorithm/generate.h + __algorithm/generate_n.h __algorithm/half_positive.h __algorithm/includes.h __algorithm/inplace_merge.h - __algorithm/is_heap_until.h __algorithm/is_heap.h + __algorithm/is_heap_until.h __algorithm/is_partitioned.h __algorithm/is_permutation.h - __algorithm/is_sorted_until.h __algorithm/is_sorted.h + __algorithm/is_sorted_until.h __algorithm/iter_swap.h __algorithm/lexicographical_compare.h __algorithm/lower_bound.h __algorithm/make_heap.h - __algorithm/max_element.h __algorithm/max.h + __algorithm/max_element.h __algorithm/merge.h - __algorithm/min_element.h __algorithm/min.h - __algorithm/minmax_element.h + __algorithm/min_element.h __algorithm/minmax.h + __algorithm/minmax_element.h __algorithm/mismatch.h - __algorithm/move_backward.h __algorithm/move.h + __algorithm/move_backward.h __algorithm/next_permutation.h __algorithm/none_of.h __algorithm/nth_element.h - __algorithm/partial_sort_copy.h __algorithm/partial_sort.h + __algorithm/partial_sort_copy.h + __algorithm/partition.h __algorithm/partition_copy.h __algorithm/partition_point.h - __algorithm/partition.h __algorithm/pop_heap.h __algorithm/prev_permutation.h __algorithm/push_heap.h - __algorithm/remove_copy_if.h + __algorithm/remove.h __algorithm/remove_copy.h + __algorithm/remove_copy_if.h __algorithm/remove_if.h - __algorithm/remove.h - __algorithm/replace_copy_if.h + __algorithm/replace.h __algorithm/replace_copy.h + __algorithm/replace_copy_if.h __algorithm/replace_if.h - __algorithm/replace.h - __algorithm/reverse_copy.h __algorithm/reverse.h - __algorithm/rotate_copy.h + __algorithm/reverse_copy.h __algorithm/rotate.h + __algorithm/rotate_copy.h __algorithm/sample.h - __algorithm/search_n.h __algorithm/search.h + __algorithm/search_n.h __algorithm/set_difference.h __algorithm/set_intersection.h __algorithm/set_symmetric_difference.h @@ -82,20 +82,20 @@ __algorithm/shift_right.h __algorithm/shuffle.h __algorithm/sift_down.h - __algorithm/sort_heap.h __algorithm/sort.h + __algorithm/sort_heap.h __algorithm/stable_partition.h __algorithm/stable_sort.h __algorithm/swap_ranges.h __algorithm/transform.h - __algorithm/unique_copy.h __algorithm/unique.h + __algorithm/unique_copy.h __algorithm/unwrap_iter.h __algorithm/upper_bound.h __availability - __bit_reference __bit/bit_cast.h __bit/byteswap.h + __bit_reference __bits __bsd_locale_defaults.h __bsd_locale_fallbacks.h @@ -150,8 +150,8 @@ __filesystem/file_type.h __filesystem/filesystem_error.h __filesystem/operations.h - __filesystem/path_iterator.h __filesystem/path.h + __filesystem/path_iterator.h __filesystem/perm_options.h __filesystem/perms.h __filesystem/recursive_directory_iterator.h @@ -173,12 +173,11 @@ __format/formatter_string.h __format/parser_std_format_spec.h __function_like.h - __functional_base __functional/binary_function.h __functional/binary_negate.h + __functional/bind.h __functional/bind_back.h __functional/bind_front.h - __functional/bind.h __functional/binder1st.h __functional/binder2nd.h __functional/compose.h @@ -201,6 +200,7 @@ __functional/unary_negate.h __functional/unwrap_ref.h __functional/weak_result_type.h + __functional_base __hash_table __iterator/access.h __iterator/advance.h @@ -221,8 +221,8 @@ __iterator/istreambuf_iterator.h __iterator/iter_move.h __iterator/iter_swap.h - __iterator/iterator_traits.h __iterator/iterator.h + __iterator/iterator_traits.h __iterator/move_iterator.h __iterator/next.h __iterator/ostream_iterator.h @@ -240,9 +240,9 @@ __mbstate_t.h __memory/addressof.h __memory/allocation_guard.h + __memory/allocator.h __memory/allocator_arg_t.h __memory/allocator_traits.h - __memory/allocator.h __memory/auto_ptr.h __memory/compressed_pair.h __memory/concepts.h @@ -257,6 +257,8 @@ __memory/uses_allocator.h __memory/voidify.h __mutex_base + __node_handle + __nullptr __numeric/accumulate.h __numeric/adjacent_difference.h __numeric/exclusive_scan.h @@ -270,8 +272,6 @@ __numeric/transform_exclusive_scan.h __numeric/transform_inclusive_scan.h __numeric/transform_reduce.h - __node_handle - __nullptr __random/bernoulli_distribution.h __random/binomial_distribution.h __random/cauchy_distribution.h @@ -317,8 +317,8 @@ __ranges/dangling.h __ranges/data.h __ranges/drop_view.h - __ranges/empty_view.h __ranges/empty.h + __ranges/empty_view.h __ranges/enable_borrowed_range.h __ranges/enable_view.h __ranges/iota_view.h @@ -500,8 +500,8 @@ stdlib.h streambuf string - string_view string.h + string_view strstream system_error tgmath.h diff --git a/libcxx/include/module.modulemap b/libcxx/include/module.modulemap --- a/libcxx/include/module.modulemap +++ b/libcxx/include/module.modulemap @@ -430,8 +430,8 @@ module __coroutine { module coroutine_handle { private header "__coroutine/coroutine_handle.h" } module coroutine_traits { private header "__coroutine/coroutine_traits.h" } - module trivial_awaitables { private header "__coroutine/trivial_awaitables.h" } module noop_coroutine_handle { private header "__coroutine/noop_coroutine_handle.h" } + module trivial_awaitables { private header "__coroutine/trivial_awaitables.h" } } } module deque { @@ -461,8 +461,8 @@ module file_type { private header "__filesystem/file_type.h" } module filesystem_error { private header "__filesystem/filesystem_error.h" } module operations { private header "__filesystem/operations.h" } - module path_iterator { private header "__filesystem/path_iterator.h" } module path { private header "__filesystem/path.h" } + module path_iterator { private header "__filesystem/path_iterator.h" } module perm_options { private header "__filesystem/perm_options.h" } module perms { private header "__filesystem/perms.h" } module recursive_directory_iterator { private header "__filesystem/recursive_directory_iterator.h" } @@ -797,8 +797,8 @@ module range_adaptor { private header "__ranges/range_adaptor.h" } module ref_view { private header "__ranges/ref_view.h" } module reverse_view { private header "__ranges/reverse_view.h" } - module size { private header "__ranges/size.h" } module single_view { private header "__ranges/single_view.h" } + module size { private header "__ranges/size.h" } module subrange { private header "__ranges/subrange.h" } module take_view { private header "__ranges/take_view.h" } module transform_view { diff --git a/libcxx/utils/CMakeLists.txt b/libcxx/utils/CMakeLists.txt --- a/libcxx/utils/CMakeLists.txt +++ b/libcxx/utils/CMakeLists.txt @@ -15,9 +15,19 @@ COMMAND "${Python3_EXECUTABLE}" "${LIBCXX_SOURCE_DIR}/utils/generate_private_header_tests.py" COMMENT "Generate tests for ensuring that detail headers are private.") +add_custom_target(libcxx-lint-cmakelists + COMMAND "${Python3_EXECUTABLE}" "${LIBCXX_SOURCE_DIR}/utils/lint_cmakelists.py" + COMMENT "Verify that the libc++ CMakeLists.txt is in alphabetical order.") + +add_custom_target(libcxx-lint-modulemap + COMMAND "${Python3_EXECUTABLE}" "${LIBCXX_SOURCE_DIR}/utils/lint_modulemap.py" + COMMENT "Verify that the libc++ modulemap is in alphabetical order.") + add_custom_target(libcxx-generate-files DEPENDS libcxx-generate-public-header-transitive-inclusion-tests libcxx-generate-public-header-tests libcxx-generate-feature-test-macros libcxx-generate-private-header-tests + libcxx-lint-cmakelists + libcxx-lint-modulemap COMMENT "Create all the auto-generated files in libc++ and its tests.") diff --git a/libcxx/utils/lint_cmakelists.py b/libcxx/utils/lint_cmakelists.py new file mode 100644 --- /dev/null +++ b/libcxx/utils/lint_cmakelists.py @@ -0,0 +1,30 @@ +#!/usr/bin/env python + +import os + + +def get_cmakelists_name(): + utils_path = os.path.dirname(os.path.abspath(__file__)) + assert os.path.exists(utils_path) + cmakelists_name = os.path.join(os.path.dirname(utils_path), 'include', 'CMakeLists.txt') + assert os.path.exists(cmakelists_name) + return cmakelists_name + + +if __name__ == '__main__': + with open(get_cmakelists_name(), 'r') as f: + lines = f.readlines() + assert lines[0] == 'set(files\n' + + okay = True + prevline = lines[1] + for line in lines[2:]: + if (line == ' )\n'): + break + if (line < prevline): + okay = False + print('LINES OUT OF ORDER in libcxx/include/CMakeLists.txt!') + print(prevline) + print(line) + prevline = line + assert okay diff --git a/libcxx/utils/lint_modulemap.py b/libcxx/utils/lint_modulemap.py new file mode 100644 --- /dev/null +++ b/libcxx/utils/lint_modulemap.py @@ -0,0 +1,29 @@ +#!/usr/bin/env python + +import os +import re + + +def get_modulemap_name(): + utils_path = os.path.dirname(os.path.abspath(__file__)) + assert os.path.exists(utils_path) + modulemap_name = os.path.join(os.path.dirname(utils_path), 'include', 'module.modulemap') + assert os.path.exists(modulemap_name) + return modulemap_name + + +if __name__ == '__main__': + okay = True + prevline = None + with open(get_modulemap_name(), 'r') as f: + for line in f.readlines(): + if re.match(r'^\s*module.*[{]\s*private', line): + if (prevline is not None) and (line < prevline): + okay = False + print('LINES OUT OF ORDER in libcxx/include/module.modulemap!') + print(prevline) + print(line) + prevline = line + else: + prevline = None + assert okay