Greetings! This patch set replaces all code that involves defining feature test macros based on loosely put together conditionals in the standard library with a unified helper for specifying and requiring feature test macros, as well as updating most usage sites, many of which have been migrated to following a pattern similar, in structure, to:
... #define __glibcxx_want_foo #include <bits/version.h> ... namespace std { ... #ifdef __cpp_lib_foo template<typename T> void foonicate(T&& t) { __builtin_foonicate_address(std::__addressof(t)); } #endif // __cpp_lib_foo ... } // namespace std In the future this should aid in preventing <version> from being dishonest about what the implementation provides, as well as reducing the amount of finicky work it takes to update FTMs. Note that this patchset is not perfect. The usage sites of various feature test macros still include "wide" condition blocks that shadow over the blocks that check for FTMs, mostly in places where features with FTMs are the exception, rather than the norm. That said, using a pair of scripts[1][2], I've tested that the code emitted in bits/stdc++.h remains unchanged (save for a misdeclared __cpp_lib_constexpr_string in !HOSTED), as well as regression-tested --enable-languages=c,c++,lto on x86_64-pc-linux-gnu, and ran the libstdc++ testsuite with --target_board="unix{,-std=c++98,-std=gnu++11,-std=gnu++20, -D_GLIBCXX_USE_CXX11_ABI=0/-D_GLIBCXX_DEBUG,-D_GLIBCXX_DEBUG, -std=gnu++23}{-fno-freestanding,-ffreestanding}" (without the line breaks) to find no relevant failures. OK for trunk? Thanks in advance, have a lovely day. [1] https://git.sr.ht/~arsen/scripts/tree/master/item/difall.bash [2] https://git.sr.ht/~arsen/scripts/tree/master/item/vercmp.bash Arsen Arsenović (2): libstdc++: Implement more maintainable <version> header libstdc++: Replace all manual FTM definitions and use libstdc++-v3/include/Makefile.am | 10 +- libstdc++-v3/include/Makefile.in | 10 +- libstdc++-v3/include/bits/algorithmfwd.h | 7 +- libstdc++-v3/include/bits/align.h | 8 +- libstdc++-v3/include/bits/alloc_traits.h | 11 +- libstdc++-v3/include/bits/allocator.h | 3 +- libstdc++-v3/include/bits/atomic_base.h | 14 +- libstdc++-v3/include/bits/atomic_wait.h | 10 +- libstdc++-v3/include/bits/basic_string.h | 24 +- libstdc++-v3/include/bits/char_traits.h | 11 +- libstdc++-v3/include/bits/chrono.h | 18 +- libstdc++-v3/include/bits/cow_string.h | 9 +- libstdc++-v3/include/bits/erase_if.h | 11 +- libstdc++-v3/include/bits/forward_list.h | 6 +- libstdc++-v3/include/bits/hashtable.h | 9 +- libstdc++-v3/include/bits/ios_base.h | 6 +- libstdc++-v3/include/bits/move.h | 8 +- .../include/bits/move_only_function.h | 9 +- libstdc++-v3/include/bits/node_handle.h | 8 +- libstdc++-v3/include/bits/ptr_traits.h | 15 +- libstdc++-v3/include/bits/range_access.h | 16 +- libstdc++-v3/include/bits/ranges_algo.h | 27 +- libstdc++-v3/include/bits/ranges_cmp.h | 14 +- libstdc++-v3/include/bits/shared_ptr.h | 10 +- libstdc++-v3/include/bits/shared_ptr_atomic.h | 6 +- libstdc++-v3/include/bits/shared_ptr_base.h | 17 +- libstdc++-v3/include/bits/specfun.h | 6 +- libstdc++-v3/include/bits/stl_algo.h | 20 +- libstdc++-v3/include/bits/stl_algobase.h | 13 +- libstdc++-v3/include/bits/stl_function.h | 28 +- libstdc++-v3/include/bits/stl_iterator.h | 21 +- libstdc++-v3/include/bits/stl_list.h | 6 +- libstdc++-v3/include/bits/stl_map.h | 6 +- libstdc++-v3/include/bits/stl_pair.h | 12 +- libstdc++-v3/include/bits/stl_queue.h | 9 +- libstdc++-v3/include/bits/stl_stack.h | 7 +- libstdc++-v3/include/bits/stl_tree.h | 7 +- libstdc++-v3/include/bits/stl_uninitialized.h | 9 +- libstdc++-v3/include/bits/stl_vector.h | 4 +- libstdc++-v3/include/bits/unique_ptr.h | 13 +- libstdc++-v3/include/bits/unordered_map.h | 8 +- .../include/bits/uses_allocator_args.h | 10 +- libstdc++-v3/include/bits/utility.h | 21 +- libstdc++-v3/include/bits/version.def | 1591 ++++++++++++++ libstdc++-v3/include/bits/version.h | 1937 +++++++++++++++++ libstdc++-v3/include/bits/version.tpl | 209 ++ .../include/c_compatibility/stdatomic.h | 9 +- libstdc++-v3/include/c_global/cmath | 18 +- libstdc++-v3/include/c_global/cstddef | 9 +- libstdc++-v3/include/std/algorithm | 10 +- libstdc++-v3/include/std/any | 9 +- libstdc++-v3/include/std/array | 9 +- libstdc++-v3/include/std/atomic | 67 +- libstdc++-v3/include/std/barrier | 11 +- libstdc++-v3/include/std/bit | 30 +- libstdc++-v3/include/std/bitset | 7 +- libstdc++-v3/include/std/charconv | 11 +- libstdc++-v3/include/std/complex | 11 +- libstdc++-v3/include/std/concepts | 10 +- libstdc++-v3/include/std/coroutine | 20 +- libstdc++-v3/include/std/deque | 9 +- libstdc++-v3/include/std/execution | 10 +- libstdc++-v3/include/std/expected | 8 +- libstdc++-v3/include/std/filesystem | 9 +- libstdc++-v3/include/std/format | 19 +- libstdc++-v3/include/std/forward_list | 10 +- libstdc++-v3/include/std/functional | 39 +- libstdc++-v3/include/std/iomanip | 9 +- libstdc++-v3/include/std/iterator | 5 +- libstdc++-v3/include/std/latch | 10 +- libstdc++-v3/include/std/list | 10 +- libstdc++-v3/include/std/memory | 15 +- libstdc++-v3/include/std/memory_resource | 20 +- libstdc++-v3/include/std/mutex | 8 +- libstdc++-v3/include/std/numbers | 8 +- libstdc++-v3/include/std/numeric | 35 +- libstdc++-v3/include/std/optional | 15 +- libstdc++-v3/include/std/ranges | 60 +- libstdc++-v3/include/std/semaphore | 9 +- libstdc++-v3/include/std/shared_mutex | 12 +- libstdc++-v3/include/std/source_location | 9 +- libstdc++-v3/include/std/span | 11 +- libstdc++-v3/include/std/spanstream | 11 +- libstdc++-v3/include/std/stacktrace | 10 +- libstdc++-v3/include/std/stop_token | 5 +- libstdc++-v3/include/std/string | 9 +- libstdc++-v3/include/std/string_view | 23 +- libstdc++-v3/include/std/syncstream | 17 +- libstdc++-v3/include/std/thread | 3 + libstdc++-v3/include/std/tuple | 25 +- libstdc++-v3/include/std/type_traits | 141 +- libstdc++-v3/include/std/utility | 38 +- libstdc++-v3/include/std/variant | 13 +- libstdc++-v3/include/std/vector | 9 +- libstdc++-v3/include/std/version | 350 +-- libstdc++-v3/libsupc++/compare | 11 +- libstdc++-v3/libsupc++/exception | 6 +- libstdc++-v3/libsupc++/new | 20 +- libstdc++-v3/libsupc++/typeinfo | 7 +- .../array/tuple_interface/get_neg.cc | 6 +- 100 files changed, 4445 insertions(+), 1064 deletions(-) create mode 100644 libstdc++-v3/include/bits/version.def create mode 100644 libstdc++-v3/include/bits/version.h create mode 100644 libstdc++-v3/include/bits/version.tpl -- 2.40.1