summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Fiselier <eric@efcs.ca>2019-01-16 01:37:43 +0000
committerEric Fiselier <eric@efcs.ca>2019-01-16 01:37:43 +0000
commitd85c37c76bde8d5016c2aca4b8e8c9eb7b064134 (patch)
tree2723a36421d57a034fcfb75e78e642071934d1da
parent7dc11df1a3342a8b3ca10221fc182003d92d6295 (diff)
Implement feature test macros using a script.linaro-local/ci/tcwg_kernel/llvm-master-aarch64-next-allyesconfig
Summary: This patch implements all the feature test macros libc++ currently supports, as specified by the standard or cppreference prior to C++2a. The tests and `<version>` header are generated using a script. The script contains a table of each feature test macro, the headers it should be accessible from, and its values of each dialect of C++. When a new feature test macro is added or needed, the table should be updated and the script re-run. Reviewers: mclow.lists, jfb, serge-sans-paille Reviewed By: mclow.lists Subscribers: arphaman, jfb, ldionne, libcxx-commits Differential Revision: https://reviews.llvm.org/D56750
-rw-r--r--libcxx/docs/DesignDocs/FeatureTestMacros.rst44
-rw-r--r--libcxx/docs/FeatureTestMacroTable.rst200
-rw-r--r--libcxx/docs/index.rst7
-rw-r--r--libcxx/include/version278
-rw-r--r--libcxx/test/std/language.support/support.limits/support.limits.general/algorithm.version.pass.cpp195
-rw-r--r--libcxx/test/std/language.support/support.limits/support.limits.general/any.version.pass.cpp55
-rw-r--r--libcxx/test/std/language.support/support.limits/support.limits.general/array.version.pass.cpp105
-rw-r--r--libcxx/test/std/language.support/support.limits/support.limits.general/atomic.version.pass.cpp127
-rw-r--r--libcxx/test/std/language.support/support.limits/support.limits.general/bit.version.pass.cpp58
-rw-r--r--libcxx/test/std/language.support/support.limits/support.limits.general/chrono.version.pass.cpp82
-rw-r--r--libcxx/test/std/language.support/support.limits/support.limits.general/cmath.version.pass.cpp91
-rw-r--r--libcxx/test/std/language.support/support.limits/support.limits.general/compare.version.pass.cpp57
-rw-r--r--libcxx/test/std/language.support/support.limits/support.limits.general/complex.version.pass.cpp58
-rw-r--r--libcxx/test/std/language.support/support.limits/support.limits.general/cstddef.version.pass.cpp55
-rw-r--r--libcxx/test/std/language.support/support.limits/support.limits.general/deque.version.pass.cpp112
-rw-r--r--libcxx/test/std/language.support/support.limits/support.limits.general/exception.version.pass.cpp55
-rw-r--r--libcxx/test/std/language.support/support.limits/support.limits.general/filesystem.version.pass.cpp98
-rw-r--r--libcxx/test/std/language.support/support.limits/support.limits.general/forward_list.version.pass.cpp163
-rw-r--r--libcxx/test/std/language.support/support.limits/support.limits.general/functional.version.pass.cpp252
-rwxr-xr-xlibcxx/test/std/language.support/support.limits/support.limits.general/generate_feature_test_macro_components.py959
-rw-r--r--libcxx/test/std/language.support/support.limits/support.limits.general/iomanip.version.pass.cpp58
-rw-r--r--libcxx/test/std/language.support/support.limits/support.limits.general/istream.version.pass.cpp64
-rw-r--r--libcxx/test/std/language.support/support.limits/support.limits.general/iterator.version.pass.cpp185
-rw-r--r--libcxx/test/std/language.support/support.limits/support.limits.general/limits.version.pass.cpp64
-rw-r--r--libcxx/test/std/language.support/support.limits/support.limits.general/list.version.pass.cpp163
-rw-r--r--libcxx/test/std/language.support/support.limits/support.limits.general/locale.version.pass.cpp64
-rw-r--r--libcxx/test/std/language.support/support.limits/support.limits.general/map.version.pass.cpp187
-rw-r--r--libcxx/test/std/language.support/support.limits/support.limits.general/memory.version.pass.cpp255
-rw-r--r--libcxx/test/std/language.support/support.limits/support.limits.general/mutex.version.pass.cpp55
-rw-r--r--libcxx/test/std/language.support/support.limits/support.limits.general/new.version.pass.cpp105
-rw-r--r--libcxx/test/std/language.support/support.limits/support.limits.general/numeric.version.pass.cpp91
-rw-r--r--libcxx/test/std/language.support/support.limits/support.limits.general/optional.version.pass.cpp55
-rw-r--r--libcxx/test/std/language.support/support.limits/support.limits.general/ostream.version.pass.cpp64
-rw-r--r--libcxx/test/std/language.support/support.limits/support.limits.general/regex.version.pass.cpp55
-rw-r--r--libcxx/test/std/language.support/support.limits/support.limits.general/scoped_allocator.version.pass.cpp55
-rw-r--r--libcxx/test/std/language.support/support.limits/support.limits.general/set.version.pass.cpp163
-rw-r--r--libcxx/test/std/language.support/support.limits/support.limits.general/shared_mutex.version.pass.cpp84
-rw-r--r--libcxx/test/std/language.support/support.limits/support.limits.general/string.version.pass.cpp192
-rw-r--r--libcxx/test/std/language.support/support.limits/support.limits.general/string_view.version.pass.cpp116
-rw-r--r--libcxx/test/std/language.support/support.limits/support.limits.general/tuple.version.pass.cpp159
-rw-r--r--libcxx/test/std/language.support/support.limits/support.limits.general/type_traits.version.pass.cpp413
-rw-r--r--libcxx/test/std/language.support/support.limits/support.limits.general/unordered_map.version.pass.cpp179
-rw-r--r--libcxx/test/std/language.support/support.limits/support.limits.general/unordered_set.version.pass.cpp162
-rw-r--r--libcxx/test/std/language.support/support.limits/support.limits.general/utility.version.pass.cpp197
-rw-r--r--libcxx/test/std/language.support/support.limits/support.limits.general/variant.version.pass.cpp55
-rw-r--r--libcxx/test/std/language.support/support.limits/support.limits.general/vector.version.pass.cpp136
-rw-r--r--libcxx/test/std/language.support/support.limits/support.limits.general/version.version.pass.cpp2235
-rw-r--r--libcxx/test/support/test_macros.h1
48 files changed, 7518 insertions, 1145 deletions
diff --git a/libcxx/docs/DesignDocs/FeatureTestMacros.rst b/libcxx/docs/DesignDocs/FeatureTestMacros.rst
new file mode 100644
index 00000000000..d55af96c674
--- /dev/null
+++ b/libcxx/docs/DesignDocs/FeatureTestMacros.rst
@@ -0,0 +1,44 @@
+===================
+Feature Test Macros
+===================
+
+.. contents::
+ :local:
+
+Overview
+========
+
+Libc++ implements the C++ feature test macros as specified in the C++2a standard,
+and before that in non-normative guiding documents (`See cppreference <https://en.cppreference.com/w/User:D41D8CD98F/feature_testing_macros>`)
+
+Design
+======
+
+Feature test macros are tricky to track, implement, test, and document correctly.
+They must be available from a list of headers, they may have different values in
+different dialects, and they may or may not be implemented by libc++. In order to
+track all of these conditions correctly and easily, we want a Single Source of
+Truth (SSoT) that defines each feature test macro, its values, the headers it
+lives in, and whether or not is is implemented by libc++. From this SSoA we
+have enough information to automatically generate the `<version>` header,
+the tests, and the documentation.
+
+Therefore we maintain a SSoA in
+`libcxx/test/std/language.support/support.limits/support.limits.general/generate_feature_test_macro_components.py`
+which doubles as a script to generate the following components:
+
+* The `<version>` header.
+* The version tests under `support.limits.general`.
+* Documentation of libc++'s implementation of each macro.
+
+Usage
+=====
+
+The `generate_feature_test_macro_components.py` script is used to track and
+update feature test macros in libc++.
+
+Whenever a feature test macro is added or changed, the table should be updated
+and the script should be re-ran. The script will clobber the existing test files
+and the documentation and it will generate a new `<version>` header as a
+temporary file. The generated `<version>` header should be merged with the
+existing one. \ No newline at end of file
diff --git a/libcxx/docs/FeatureTestMacroTable.rst b/libcxx/docs/FeatureTestMacroTable.rst
new file mode 100644
index 00000000000..d900497eba7
--- /dev/null
+++ b/libcxx/docs/FeatureTestMacroTable.rst
@@ -0,0 +1,200 @@
+.. _FeatureTestMacroTable:
+
+==========================
+Feature Test Macro Support
+==========================
+
+.. contents::
+ :local:
+
+Overview
+========
+
+This file documents the feature test macros currently supported by libc++.
+
+.. _feature-status:
+
+Status
+======
+
+.. table:: Current Status
+ :name: feature-status-table
+ :widths: auto
+
+ ================================================= =================
+ Macro Name Value
+ ================================================= =================
+ **C++ 14**
+ -------------------------------------------------------------------
+ ``__cpp_lib_chrono_udls`` ``201304L``
+ ------------------------------------------------- -----------------
+ ``__cpp_lib_complex_udls`` ``201309L``
+ ------------------------------------------------- -----------------
+ ``__cpp_lib_exchange_function`` ``201304L``
+ ------------------------------------------------- -----------------
+ ``__cpp_lib_generic_associative_lookup`` ``201304L``
+ ------------------------------------------------- -----------------
+ ``__cpp_lib_integer_sequence`` ``201304L``
+ ------------------------------------------------- -----------------
+ ``__cpp_lib_integral_constant_callable`` ``201304L``
+ ------------------------------------------------- -----------------
+ ``__cpp_lib_is_final`` ``201402L``
+ ------------------------------------------------- -----------------
+ ``__cpp_lib_is_null_pointer`` ``201309L``
+ ------------------------------------------------- -----------------
+ ``__cpp_lib_make_reverse_iterator`` ``201402L``
+ ------------------------------------------------- -----------------
+ ``__cpp_lib_make_unique`` ``201304L``
+ ------------------------------------------------- -----------------
+ ``__cpp_lib_null_iterators`` ``201304L``
+ ------------------------------------------------- -----------------
+ ``__cpp_lib_quoted_string_io`` ``201304L``
+ ------------------------------------------------- -----------------
+ ``__cpp_lib_result_of_sfinae`` ``201210L``
+ ------------------------------------------------- -----------------
+ ``__cpp_lib_robust_nonmodifying_seq_ops`` ``201304L``
+ ------------------------------------------------- -----------------
+ ``__cpp_lib_shared_timed_mutex`` ``201402L``
+ ------------------------------------------------- -----------------
+ ``__cpp_lib_string_udls`` ``201304L``
+ ------------------------------------------------- -----------------
+ ``__cpp_lib_transformation_trait_aliases`` ``201304L``
+ ------------------------------------------------- -----------------
+ ``__cpp_lib_transparent_operators`` ``201210L``
+ ------------------------------------------------- -----------------
+ ``__cpp_lib_tuple_element_t`` ``201402L``
+ ------------------------------------------------- -----------------
+ ``__cpp_lib_tuples_by_type`` ``201304L``
+ ------------------------------------------------- -----------------
+ **C++ 17**
+ -------------------------------------------------------------------
+ ``__cpp_lib_addressof_constexpr`` ``201603L``
+ ------------------------------------------------- -----------------
+ ``__cpp_lib_allocator_traits_is_always_equal`` ``201411L``
+ ------------------------------------------------- -----------------
+ ``__cpp_lib_any`` ``201606L``
+ ------------------------------------------------- -----------------
+ ``__cpp_lib_apply`` ``201603L``
+ ------------------------------------------------- -----------------
+ ``__cpp_lib_array_constexpr`` ``201603L``
+ ------------------------------------------------- -----------------
+ ``__cpp_lib_as_const`` ``201510L``
+ ------------------------------------------------- -----------------
+ ``__cpp_lib_atomic_is_always_lock_free`` ``201603L``
+ ------------------------------------------------- -----------------
+ ``__cpp_lib_bool_constant`` ``201505L``
+ ------------------------------------------------- -----------------
+ ``__cpp_lib_boyer_moore_searcher`` *unimplemented*
+ ------------------------------------------------- -----------------
+ ``__cpp_lib_byte`` ``201603L``
+ ------------------------------------------------- -----------------
+ ``__cpp_lib_chrono`` ``201611L``
+ ------------------------------------------------- -----------------
+ ``__cpp_lib_clamp`` ``201603L``
+ ------------------------------------------------- -----------------
+ ``__cpp_lib_enable_shared_from_this`` ``201603L``
+ ------------------------------------------------- -----------------
+ ``__cpp_lib_execution`` *unimplemented*
+ ------------------------------------------------- -----------------
+ ``__cpp_lib_filesystem`` ``201703L``
+ ------------------------------------------------- -----------------
+ ``__cpp_lib_gcd_lcm`` ``201606L``
+ ------------------------------------------------- -----------------
+ ``__cpp_lib_hardware_interference_size`` ``201703L``
+ ------------------------------------------------- -----------------
+ ``__cpp_lib_has_unique_object_representations`` ``201606L``
+ ------------------------------------------------- -----------------
+ ``__cpp_lib_hypot`` ``201603L``
+ ------------------------------------------------- -----------------
+ ``__cpp_lib_incomplete_container_elements`` ``201505L``
+ ------------------------------------------------- -----------------
+ ``__cpp_lib_invoke`` ``201411L``
+ ------------------------------------------------- -----------------
+ ``__cpp_lib_is_aggregate`` ``201703L``
+ ------------------------------------------------- -----------------
+ ``__cpp_lib_is_invocable`` ``201703L``
+ ------------------------------------------------- -----------------
+ ``__cpp_lib_is_swappable`` ``201603L``
+ ------------------------------------------------- -----------------
+ ``__cpp_lib_launder`` ``201606L``
+ ------------------------------------------------- -----------------
+ ``__cpp_lib_logical_traits`` ``201510L``
+ ------------------------------------------------- -----------------
+ ``__cpp_lib_make_from_tuple`` ``201606L``
+ ------------------------------------------------- -----------------
+ ``__cpp_lib_map_try_emplace`` ``201411L``
+ ------------------------------------------------- -----------------
+ ``__cpp_lib_math_special_functions`` *unimplemented*
+ ------------------------------------------------- -----------------
+ ``__cpp_lib_memory_resource`` *unimplemented*
+ ------------------------------------------------- -----------------
+ ``__cpp_lib_node_extract`` ``201606L``
+ ------------------------------------------------- -----------------
+ ``__cpp_lib_nonmember_container_access`` ``201411L``
+ ------------------------------------------------- -----------------
+ ``__cpp_lib_not_fn`` ``201603L``
+ ------------------------------------------------- -----------------
+ ``__cpp_lib_optional`` ``201606L``
+ ------------------------------------------------- -----------------
+ ``__cpp_lib_parallel_algorithm`` *unimplemented*
+ ------------------------------------------------- -----------------
+ ``__cpp_lib_raw_memory_algorithms`` ``201606L``
+ ------------------------------------------------- -----------------
+ ``__cpp_lib_sample`` ``201603L``
+ ------------------------------------------------- -----------------
+ ``__cpp_lib_scoped_lock`` ``201703L``
+ ------------------------------------------------- -----------------
+ ``__cpp_lib_shared_mutex`` ``201505L``
+ ------------------------------------------------- -----------------
+ ``__cpp_lib_shared_ptr_arrays`` *unimplemented*
+ ------------------------------------------------- -----------------
+ ``__cpp_lib_shared_ptr_weak_type`` ``201606L``
+ ------------------------------------------------- -----------------
+ ``__cpp_lib_string_view`` ``201606L``
+ ------------------------------------------------- -----------------
+ ``__cpp_lib_to_chars`` *unimplemented*
+ ------------------------------------------------- -----------------
+ ``__cpp_lib_transparent_operators`` ``201510L``
+ ------------------------------------------------- -----------------
+ ``__cpp_lib_type_trait_variable_templates`` ``201510L``
+ ------------------------------------------------- -----------------
+ ``__cpp_lib_uncaught_exceptions`` ``201411L``
+ ------------------------------------------------- -----------------
+ ``__cpp_lib_unordered_map_try_emplace`` ``201411L``
+ ------------------------------------------------- -----------------
+ ``__cpp_lib_variant`` ``201606L``
+ ------------------------------------------------- -----------------
+ ``__cpp_lib_void_t`` ``201411L``
+ ------------------------------------------------- -----------------
+ **C++ 2a**
+ -------------------------------------------------------------------
+ ``__cpp_lib_atomic_ref`` *unimplemented*
+ ------------------------------------------------- -----------------
+ ``__cpp_lib_bind_front`` *unimplemented*
+ ------------------------------------------------- -----------------
+ ``__cpp_lib_bit_cast`` *unimplemented*
+ ------------------------------------------------- -----------------
+ ``__cpp_lib_char8_t`` ``201811L``
+ ------------------------------------------------- -----------------
+ ``__cpp_lib_concepts`` *unimplemented*
+ ------------------------------------------------- -----------------
+ ``__cpp_lib_constexpr_misc`` *unimplemented*
+ ------------------------------------------------- -----------------
+ ``__cpp_lib_constexpr_swap_algorithms`` *unimplemented*
+ ------------------------------------------------- -----------------
+ ``__cpp_lib_destroying_delete`` *unimplemented*
+ ------------------------------------------------- -----------------
+ ``__cpp_lib_erase_if`` ``201811L``
+ ------------------------------------------------- -----------------
+ ``__cpp_lib_generic_unordered_lookup`` *unimplemented*
+ ------------------------------------------------- -----------------
+ ``__cpp_lib_is_constant_evaluated`` *unimplemented*
+ ------------------------------------------------- -----------------
+ ``__cpp_lib_list_remove_return_type`` *unimplemented*
+ ------------------------------------------------- -----------------
+ ``__cpp_lib_ranges`` *unimplemented*
+ ------------------------------------------------- -----------------
+ ``__cpp_lib_three_way_comparison`` *unimplemented*
+ ================================================= =================
+
+
diff --git a/libcxx/docs/index.rst b/libcxx/docs/index.rst
index bb56f2da0cf..fddf74b66a9 100644
--- a/libcxx/docs/index.rst
+++ b/libcxx/docs/index.rst
@@ -40,6 +40,11 @@ Getting Started with libc++
TestingLibcxx
+.. toctree::
+ :hidden:
+
+ FeatureTestMacroTable
+
Current Status
--------------
@@ -107,6 +112,7 @@ C++ Dialect Support
* `C++14 - Complete <http://libcxx.llvm.org/cxx1y_status.html>`__
* `C++17 - In Progress <http://libcxx.llvm.org/cxx1z_status.html>`__
* `Post C++14 Technical Specifications - In Progress <http://libcxx.llvm.org/ts1z_status.html>`__
+* :ref:`C++ Feature Test Macro Status <feature-status>`
Notes and Known Issues
----------------------
@@ -136,6 +142,7 @@ Design Documents
DesignDocs/VisibilityMacros
DesignDocs/ThreadingSupportAPI
DesignDocs/FileTimeType
+ DesignDocs/FeatureTestMacros
* `<atomic> design <http://libcxx.llvm.org/atomic_design.html>`_
* `<type_traits> design <http://libcxx.llvm.org/type_traits_design.html>`_
diff --git a/libcxx/include/version b/libcxx/include/version
index d6ccb138f6e..d37aba139af 100644
--- a/libcxx/include/version
+++ b/libcxx/include/version
@@ -12,92 +12,105 @@
#define _LIBCPP_VERSIONH
/*
- version synopsis
+ version synopsis
- Table 35 — Standard library feature-test macros
-Macro name Value Headers
-__cpp_lib_addressof_constexpr 201603L <memory>
-__cpp_lib_allocator_traits_is_always_equal 201411L <memory> <scoped_allocator> <string>
- <deque> <forward_list> <list> <vector>
- <map> <set> <unordered_map> <unordered_set>
-__cpp_lib_any 201606L <any>
-__cpp_lib_apply 201603L <tuple>
-__cpp_lib_array_constexpr 201603L <iterator> <array>
-__cpp_lib_as_const 201510L <utility>
-__cpp_lib_atomic_is_always_lock_free 201603L <atomic>
-__cpp_lib_atomic_ref 201806L <atomic>
-__cpp_lib_bit_cast 201806L <bit>
-__cpp_lib_bool_constant 201505L <type_traits>
-__cpp_lib_boyer_moore_searcher 201603L <functional>
-__cpp_lib_byte 201603L <cstddef>
-__cpp_lib_char8_t 201811L <atomic> <filesystem> <istream> <limits>
- <locale> <ostream> <string> <string_view>
-__cpp_lib_chrono 201611L <chrono>
-__cpp_lib_chrono_udls 201304L <chrono>
-__cpp_lib_clamp 201603L <algorithm>
-__cpp_lib_complex_udls 201309L <complex>
-__cpp_lib_concepts 201806L <concepts>
-__cpp_lib_constexpr_swap_algorithms 201806L <algorithm>
-__cpp_lib_enable_shared_from_this 201603L <memory>
-__cpp_lib_erase_if 201811L <string> <deque> <forward_list> <list>
- <vector> <map> <set> <unordered_map>
- <unordered_set>
-__cpp_lib_exchange_function 201304L <utility>
-__cpp_lib_execution 201603L <execution>
-__cpp_lib_filesystem 201703L <filesystem>
-__cpp_lib_gcd_lcm 201606L <numeric>
-__cpp_lib_generic_associative_lookup 201304L <map> <set>
-__cpp_lib_hardware_interference_size 201703L <new>
-__cpp_lib_has_unique_object_representations 201606L <type_traits>
-__cpp_lib_hypot 201603L <cmath>
-__cpp_lib_incomplete_container_elements 201505L <forward_list> <list> <vector>
-__cpp_lib_integer_sequence 201304L <utility>
-__cpp_lib_integral_constant_callable 201304L <type_traits>
-__cpp_lib_invoke 201411L <functional>
-__cpp_lib_is_aggregate 201703L <type_traits>
-__cpp_lib_is_final 201402L <type_traits>
-__cpp_lib_is_invocable 201703L <type_traits>
-__cpp_lib_is_null_pointer 201309L <type_traits>
-__cpp_lib_is_swappable 201603L <type_traits>
-__cpp_lib_launder 201606L <new>
-__cpp_lib_list_remove_return_type 201806L <forward_list> <list>
-__cpp_lib_logical_traits 201510L <type_traits>
-__cpp_lib_make_from_tuple 201606L <tuple>
-__cpp_lib_make_reverse_iterator 201402L <iterator>
-__cpp_lib_make_unique 201304L <memory>
-__cpp_lib_map_try_emplace 201411L <map>
-__cpp_lib_math_special_functions 201603L <cmath>
-__cpp_lib_memory_resource 201603L <memory_resource>
-__cpp_lib_node_extract 201606L <map> <set> <unordered_map> <unordered_set>
-__cpp_lib_nonmember_container_access 201411L <iterator> <array> <deque> <forward_list>
- <list> <map> <regex> <set> <string>
- <unordered_map> <unordered_set> <vector>
-__cpp_lib_not_fn 201603L <functional>
-__cpp_lib_null_iterators 201304L <iterator>
-__cpp_lib_optional 201606L <optional>
-__cpp_lib_parallel_algorithm 201603L <algorithm> <numeric>
-__cpp_lib_quoted_string_io 201304L <iomanip>
-__cpp_lib_raw_memory_algorithms 201606L <memory>
-__cpp_lib_result_of_sfinae 201210L <functional> <type_traits>
-__cpp_lib_robust_nonmodifying_seq_ops 201304L <algorithm>
-__cpp_lib_sample 201603L <algorithm>
-__cpp_lib_scoped_lock 201703L <mutex>
-__cpp_lib_shared_mutex 201505L <shared_mutex>
-__cpp_lib_shared_ptr_arrays 201611L <memory>
-__cpp_lib_shared_ptr_weak_type 201606L <memory>
-__cpp_lib_shared_timed_mutex 201402L <shared_mutex>
-__cpp_lib_string_udls 201304L <string>
-__cpp_lib_string_view 201606L <string> <string_view>
-__cpp_lib_to_chars 201611L <charconv>
-__cpp_lib_transformation_trait_aliases 201304L <type_traits>
-__cpp_lib_transparent_operators 201510L <memory> <functional>
-__cpp_lib_tuple_element_t 201402L <tuple>
-__cpp_lib_tuples_by_type 201304L <utility> <tuple>
-__cpp_lib_type_trait_variable_templates 201510L <type_traits>
-__cpp_lib_uncaught_exceptions 201411L <exception>
-__cpp_lib_unordered_map_try_emplace 201411L <unordered_map>
-__cpp_lib_variant 201606L <variant>
-__cpp_lib_void_t 201411L <type_traits>
+Macro name Value Headers
+__cpp_lib_addressof_constexpr 201603L <memory>
+__cpp_lib_allocator_traits_is_always_equal 201411L <memory> <scoped_allocator> <string>
+ <deque> <forward_list> <list>
+ <vector> <map> <set>
+ <unordered_map> <unordered_set>
+__cpp_lib_any 201606L <any>
+__cpp_lib_apply 201603L <tuple>
+__cpp_lib_array_constexpr 201603L <iterator> <array>
+__cpp_lib_as_const 201510L <utility>
+__cpp_lib_atomic_is_always_lock_free 201603L <atomic>
+__cpp_lib_atomic_ref 201806L <atomic>
+__cpp_lib_bind_front 201811L <functional>
+__cpp_lib_bit_cast 201806L <bit>
+__cpp_lib_bool_constant 201505L <type_traits>
+__cpp_lib_boyer_moore_searcher 201603L <functional>
+__cpp_lib_byte 201603L <cstddef>
+__cpp_lib_char8_t 201811L <atomic> <filesystem> <istream>
+ <limits> <locale> <ostream>
+ <string> <string_view>
+__cpp_lib_chrono 201611L <chrono>
+__cpp_lib_chrono_udls 201304L <chrono>
+__cpp_lib_clamp 201603L <algorithm>
+__cpp_lib_complex_udls 201309L <complex>
+__cpp_lib_concepts 201806L <concepts>
+__cpp_lib_constexpr_misc 201811L <array> <functional> <iterator>
+ <string_view> <tuple> <utility>
+__cpp_lib_constexpr_swap_algorithms 201806L <algorithm>
+__cpp_lib_destroying_delete 201806L <new>
+__cpp_lib_enable_shared_from_this 201603L <memory>
+__cpp_lib_erase_if 201811L <string> <deque> <forward_list>
+ <list> <vector> <map>
+ <set> <unordered_map> <unordered_set>
+__cpp_lib_exchange_function 201304L <utility>
+__cpp_lib_execution 201603L <execution>
+__cpp_lib_filesystem 201703L <filesystem>
+__cpp_lib_gcd_lcm 201606L <numeric>
+__cpp_lib_generic_associative_lookup 201304L <map> <set>
+__cpp_lib_generic_unordered_lookup 201811L <unordered_map> <unordered_set>
+__cpp_lib_hardware_interference_size 201703L <new>
+__cpp_lib_has_unique_object_representations 201606L <type_traits>
+__cpp_lib_hypot 201603L <cmath>
+__cpp_lib_incomplete_container_elements 201505L <forward_list> <list> <vector>
+__cpp_lib_integer_sequence 201304L <utility>
+__cpp_lib_integral_constant_callable 201304L <type_traits>
+__cpp_lib_invoke 201411L <functional>
+__cpp_lib_is_aggregate 201703L <type_traits>
+__cpp_lib_is_constant_evaluated 201811L <type_traits>
+__cpp_lib_is_final 201402L <type_traits>
+__cpp_lib_is_invocable 201703L <type_traits>
+__cpp_lib_is_null_pointer 201309L <type_traits>
+__cpp_lib_is_swappable 201603L <type_traits>
+__cpp_lib_launder 201606L <new>
+__cpp_lib_list_remove_return_type 201806L <forward_list> <list>
+__cpp_lib_logical_traits 201510L <type_traits>
+__cpp_lib_make_from_tuple 201606L <tuple>
+__cpp_lib_make_reverse_iterator 201402L <iterator>
+__cpp_lib_make_unique 201304L <memory>
+__cpp_lib_map_try_emplace 201411L <map>
+__cpp_lib_math_special_functions 201603L <cmath>
+__cpp_lib_memory_resource 201603L <memory_resource>
+__cpp_lib_node_extract 201606L <map> <set> <unordered_map>
+ <unordered_set>
+__cpp_lib_nonmember_container_access 201411L <iterator> <array> <deque>
+ <forward_list> <list> <map>
+ <regex> <set> <string>
+ <unordered_map> <unordered_set> <vector>
+__cpp_lib_not_fn 201603L <functional>
+__cpp_lib_null_iterators 201304L <iterator>
+__cpp_lib_optional 201606L <optional>
+__cpp_lib_parallel_algorithm 201603L <algorithm> <numeric>
+__cpp_lib_quoted_string_io 201304L <iomanip>
+__cpp_lib_ranges 201811L <algorithm> <functional> <iterator>
+ <memory> <ranges>
+__cpp_lib_raw_memory_algorithms 201606L <memory>
+__cpp_lib_result_of_sfinae 201210L <functional> <type_traits>
+__cpp_lib_robust_nonmodifying_seq_ops 201304L <algorithm>
+__cpp_lib_sample 201603L <algorithm>
+__cpp_lib_scoped_lock 201703L <mutex>
+__cpp_lib_shared_mutex 201505L <shared_mutex>
+__cpp_lib_shared_ptr_arrays 201611L <memory>
+__cpp_lib_shared_ptr_weak_type 201606L <memory>
+__cpp_lib_shared_timed_mutex 201402L <shared_mutex>
+__cpp_lib_string_udls 201304L <string>
+__cpp_lib_string_view 201606L <string> <string_view>
+__cpp_lib_three_way_comparison 201711L <compare>
+__cpp_lib_to_chars 201611L <utility>
+__cpp_lib_transformation_trait_aliases 201304L <type_traits>
+__cpp_lib_transparent_operators 201510L <functional>
+ 201210L // C++14
+__cpp_lib_tuple_element_t 201402L <tuple>
+__cpp_lib_tuples_by_type 201304L <utility> <tuple>
+__cpp_lib_type_trait_variable_templates 201510L <type_traits>
+__cpp_lib_uncaught_exceptions 201411L <exception>
+__cpp_lib_unordered_map_try_emplace 201411L <unordered_map>
+__cpp_lib_variant 201606L <variant>
+__cpp_lib_void_t 201411L <type_traits>
*/
@@ -108,21 +121,104 @@ __cpp_lib_void_t 201411L <type_traits>
#endif
#if _LIBCPP_STD_VER > 11
+# define __cpp_lib_chrono_udls 201304L
+# define __cpp_lib_complex_udls 201309L
+# define __cpp_lib_exchange_function 201304L
+# define __cpp_lib_generic_associative_lookup 201304L
+# define __cpp_lib_integer_sequence 201304L
+# define __cpp_lib_integral_constant_callable 201304L
+# define __cpp_lib_is_final 201402L
+# define __cpp_lib_is_null_pointer 201309L
+# define __cpp_lib_make_reverse_iterator 201402L
+# define __cpp_lib_make_unique 201304L
+# define __cpp_lib_null_iterators 201304L
+# define __cpp_lib_quoted_string_io 201304L
+# define __cpp_lib_result_of_sfinae 201210L
+# define __cpp_lib_robust_nonmodifying_seq_ops 201304L
+# define __cpp_lib_shared_timed_mutex 201402L
+# define __cpp_lib_string_udls 201304L
+# define __cpp_lib_transformation_trait_aliases 201304L
+# define __cpp_lib_transparent_operators 201210L
+# define __cpp_lib_tuple_element_t 201402L
+# define __cpp_lib_tuples_by_type 201304L
#endif
#if _LIBCPP_STD_VER > 14
+# if !defined(_LIBCPP_HAS_NO_BUILTIN_ADDRESSOF)
+# define __cpp_lib_addressof_constexpr 201603L
+# endif
+# define __cpp_lib_allocator_traits_is_always_equal 201411L
+# define __cpp_lib_any 201606L
+# define __cpp_lib_apply 201603L
+# define __cpp_lib_array_constexpr 201603L
+# define __cpp_lib_as_const 201510L
# define __cpp_lib_atomic_is_always_lock_free 201603L
+# define __cpp_lib_bool_constant 201505L
+// # define __cpp_lib_boyer_moore_searcher 201603L
+# define __cpp_lib_byte 201603L
+# define __cpp_lib_chrono 201611L
+# define __cpp_lib_clamp 201603L
+# define __cpp_lib_enable_shared_from_this 201603L
+// # define __cpp_lib_execution 201603L
# define __cpp_lib_filesystem 201703L
+# define __cpp_lib_gcd_lcm 201606L
+# define __cpp_lib_hardware_interference_size 201703L
+# if defined(_LIBCPP_HAS_UNIQUE_OBJECT_REPRESENTATIONS)
+# define __cpp_lib_has_unique_object_representations 201606L
+# endif
+# define __cpp_lib_hypot 201603L
+# define __cpp_lib_incomplete_container_elements 201505L
# define __cpp_lib_invoke 201411L
-# define __cpp_lib_void_t 201411L
+# if !defined(_LIBCPP_HAS_NO_IS_AGGREGATE)
+# define __cpp_lib_is_aggregate 201703L
+# endif
+# define __cpp_lib_is_invocable 201703L
+# define __cpp_lib_is_swappable 201603L
+# define __cpp_lib_launder 201606L
+# define __cpp_lib_logical_traits 201510L
+# define __cpp_lib_make_from_tuple 201606L
+# define __cpp_lib_map_try_emplace 201411L
+// # define __cpp_lib_math_special_functions 201603L
+// # define __cpp_lib_memory_resource 201603L
# define __cpp_lib_node_extract 201606L
+# define __cpp_lib_nonmember_container_access 201411L
+# define __cpp_lib_not_fn 201603L
+# define __cpp_lib_optional 201606L
+// # define __cpp_lib_parallel_algorithm 201603L
+# define __cpp_lib_raw_memory_algorithms 201606L
+# define __cpp_lib_sample 201603L
+# define __cpp_lib_scoped_lock 201703L
+# define __cpp_lib_shared_mutex 201505L
+// # define __cpp_lib_shared_ptr_arrays 201611L
+# define __cpp_lib_shared_ptr_weak_type 201606L
+# define __cpp_lib_string_view 201606L
+// # define __cpp_lib_to_chars 201611L
+# undef __cpp_lib_transparent_operators
+# define __cpp_lib_transparent_operators 201510L
+# define __cpp_lib_type_trait_variable_templates 201510L
+# define __cpp_lib_uncaught_exceptions 201411L
+# define __cpp_lib_unordered_map_try_emplace 201411L
+# define __cpp_lib_variant 201606L
+# define __cpp_lib_void_t 201411L
#endif
#if _LIBCPP_STD_VER > 17
-#ifndef _LIBCPP_NO_HAS_CHAR8_T
-# define __cpp_lib_char8_t 201811L
-#endif
-#define __cpp_lib_erase_if 201811L
+// # define __cpp_lib_atomic_ref 201806L
+// # define __cpp_lib_bind_front 201811L
+// # define __cpp_lib_bit_cast 201806L
+# if !defined(_LIBCPP_NO_HAS_CHAR8_T)
+# define __cpp_lib_char8_t 201811L
+# endif
+// # define __cpp_lib_concepts 201806L
+// # define __cpp_lib_constexpr_misc 201811L
+// # define __cpp_lib_constexpr_swap_algorithms 201806L
+// # define __cpp_lib_destroying_delete 201806L
+# define __cpp_lib_erase_if 201811L
+// # define __cpp_lib_generic_unordered_lookup 201811L
+// # define __cpp_lib_is_constant_evaluated 201811L
+// # define __cpp_lib_list_remove_return_type 201806L
+// # define __cpp_lib_ranges 201811L
+// # define __cpp_lib_three_way_comparison 201711L
#endif
-#endif // _LIBCPP_VERSIONH
+#endif // _LIBCPP_VERSIONH
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/algorithm.version.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/algorithm.version.pass.cpp
index 24d2f8002d6..860cbab09bd 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/algorithm.version.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/algorithm.version.pass.cpp
@@ -1,4 +1,3 @@
-
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
@@ -8,30 +7,186 @@
//
//===----------------------------------------------------------------------===//
//
-// <algorithm> feature macros
+// WARNING: This test was generated by generate_feature_test_macros_tests.py and
+// should not be edited manually.
+
+// <algorithm>
-/* Constant Value
- __cpp_lib_clamp 201603L
- __cpp_lib_constexpr_swap_algorithms 201806L
- __cpp_lib_parallel_algorithm 201603L
- __cpp_lib_robust_nonmodifying_seq_ops 201304L
- __cpp_lib_sample 201603L
+// Test the feature test macros defined by <algorithm>
+/* Constant Value
+ __cpp_lib_clamp 201603L [C++17]
+ __cpp_lib_constexpr_swap_algorithms 201806L [C++2a]
+ __cpp_lib_parallel_algorithm 201603L [C++17]
+ __cpp_lib_ranges 201811L [C++2a]
+ __cpp_lib_robust_nonmodifying_seq_ops 201304L [C++14]
+ __cpp_lib_sample 201603L [C++17]
*/
#include <algorithm>
-#include <cassert>
#include "test_macros.h"
-int main()
-{
-// ensure that the macros that are supposed to be defined in <algorithm> are defined.
+#if TEST_STD_VER < 14
-/*
-#if !defined(__cpp_lib_fooby)
-# error "__cpp_lib_fooby is not defined"
-#elif __cpp_lib_fooby < 201606L
-# error "__cpp_lib_fooby has an invalid value"
-#endif
-*/
-}
+# ifdef __cpp_lib_clamp
+# error "__cpp_lib_clamp should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_constexpr_swap_algorithms
+# error "__cpp_lib_constexpr_swap_algorithms should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_parallel_algorithm
+# error "__cpp_lib_parallel_algorithm should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_ranges
+# error "__cpp_lib_ranges should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_robust_nonmodifying_seq_ops
+# error "__cpp_lib_robust_nonmodifying_seq_ops should not be defined before c++14"
+# endif
+
+# ifdef __cpp_lib_sample
+# error "__cpp_lib_sample should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 14
+
+# ifdef __cpp_lib_clamp
+# error "__cpp_lib_clamp should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_constexpr_swap_algorithms
+# error "__cpp_lib_constexpr_swap_algorithms should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_parallel_algorithm
+# error "__cpp_lib_parallel_algorithm should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_ranges
+# error "__cpp_lib_ranges should not be defined before c++2a"
+# endif
+
+# ifndef __cpp_lib_robust_nonmodifying_seq_ops
+# error "__cpp_lib_robust_nonmodifying_seq_ops should be defined in c++14"
+# endif
+# if __cpp_lib_robust_nonmodifying_seq_ops != 201304L
+# error "__cpp_lib_robust_nonmodifying_seq_ops should have the value 201304L in c++14"
+# endif
+
+# ifdef __cpp_lib_sample
+# error "__cpp_lib_sample should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 17
+
+# ifndef __cpp_lib_clamp
+# error "__cpp_lib_clamp should be defined in c++17"
+# endif
+# if __cpp_lib_clamp != 201603L
+# error "__cpp_lib_clamp should have the value 201603L in c++17"
+# endif
+
+# ifdef __cpp_lib_constexpr_swap_algorithms
+# error "__cpp_lib_constexpr_swap_algorithms should not be defined before c++2a"
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_parallel_algorithm
+# error "__cpp_lib_parallel_algorithm should be defined in c++17"
+# endif
+# if __cpp_lib_parallel_algorithm != 201603L
+# error "__cpp_lib_parallel_algorithm should have the value 201603L in c++17"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_parallel_algorithm
+# error "__cpp_lib_parallel_algorithm should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+# ifdef __cpp_lib_ranges
+# error "__cpp_lib_ranges should not be defined before c++2a"
+# endif
+
+# ifndef __cpp_lib_robust_nonmodifying_seq_ops
+# error "__cpp_lib_robust_nonmodifying_seq_ops should be defined in c++17"
+# endif
+# if __cpp_lib_robust_nonmodifying_seq_ops != 201304L
+# error "__cpp_lib_robust_nonmodifying_seq_ops should have the value 201304L in c++17"
+# endif
+
+# ifndef __cpp_lib_sample
+# error "__cpp_lib_sample should be defined in c++17"
+# endif
+# if __cpp_lib_sample != 201603L
+# error "__cpp_lib_sample should have the value 201603L in c++17"
+# endif
+
+#elif TEST_STD_VER > 17
+
+# ifndef __cpp_lib_clamp
+# error "__cpp_lib_clamp should be defined in c++2a"
+# endif
+# if __cpp_lib_clamp != 201603L
+# error "__cpp_lib_clamp should have the value 201603L in c++2a"
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_constexpr_swap_algorithms
+# error "__cpp_lib_constexpr_swap_algorithms should be defined in c++2a"
+# endif
+# if __cpp_lib_constexpr_swap_algorithms != 201806L
+# error "__cpp_lib_constexpr_swap_algorithms should have the value 201806L in c++2a"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_constexpr_swap_algorithms
+# error "__cpp_lib_constexpr_swap_algorithms should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_parallel_algorithm
+# error "__cpp_lib_parallel_algorithm should be defined in c++2a"
+# endif
+# if __cpp_lib_parallel_algorithm != 201603L
+# error "__cpp_lib_parallel_algorithm should have the value 201603L in c++2a"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_parallel_algorithm
+# error "__cpp_lib_parallel_algorithm should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_ranges
+# error "__cpp_lib_ranges should be defined in c++2a"
+# endif
+# if __cpp_lib_ranges != 201811L
+# error "__cpp_lib_ranges should have the value 201811L in c++2a"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_ranges
+# error "__cpp_lib_ranges should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+# ifndef __cpp_lib_robust_nonmodifying_seq_ops
+# error "__cpp_lib_robust_nonmodifying_seq_ops should be defined in c++2a"
+# endif
+# if __cpp_lib_robust_nonmodifying_seq_ops != 201304L
+# error "__cpp_lib_robust_nonmodifying_seq_ops should have the value 201304L in c++2a"
+# endif
+
+# ifndef __cpp_lib_sample
+# error "__cpp_lib_sample should be defined in c++2a"
+# endif
+# if __cpp_lib_sample != 201603L
+# error "__cpp_lib_sample should have the value 201603L in c++2a"
+# endif
+
+#endif // TEST_STD_VER > 17
+
+int main() {}
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/any.version.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/any.version.pass.cpp
index 933730442e0..8e8174323cc 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/any.version.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/any.version.pass.cpp
@@ -1,4 +1,3 @@
-
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
@@ -8,26 +7,50 @@
//
//===----------------------------------------------------------------------===//
//
-// <any> feature macros
+// WARNING: This test was generated by generate_feature_test_macros_tests.py and
+// should not be edited manually.
+
+// <any>
-/* Constant Value
- __cpp_lib_any 201606L
+// Test the feature test macros defined by <any>
+/* Constant Value
+ __cpp_lib_any 201606L [C++17]
*/
#include <any>
-#include <cassert>
#include "test_macros.h"
-int main()
-{
-// ensure that the macros that are supposed to be defined in <any> are defined.
+#if TEST_STD_VER < 14
-/*
-#if !defined(__cpp_lib_fooby)
-# error "__cpp_lib_fooby is not defined"
-#elif __cpp_lib_fooby < 201606L
-# error "__cpp_lib_fooby has an invalid value"
-#endif
-*/
-}
+# ifdef __cpp_lib_any
+# error "__cpp_lib_any should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 14
+
+# ifdef __cpp_lib_any
+# error "__cpp_lib_any should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 17
+
+# ifndef __cpp_lib_any
+# error "__cpp_lib_any should be defined in c++17"
+# endif
+# if __cpp_lib_any != 201606L
+# error "__cpp_lib_any should have the value 201606L in c++17"
+# endif
+
+#elif TEST_STD_VER > 17
+
+# ifndef __cpp_lib_any
+# error "__cpp_lib_any should be defined in c++2a"
+# endif
+# if __cpp_lib_any != 201606L
+# error "__cpp_lib_any should have the value 201606L in c++2a"
+# endif
+
+#endif // TEST_STD_VER > 17
+
+int main() {}
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/array.version.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/array.version.pass.cpp
index 5d25c628b31..75c2785815c 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/array.version.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/array.version.pass.cpp
@@ -1,4 +1,3 @@
-
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
@@ -8,27 +7,99 @@
//
//===----------------------------------------------------------------------===//
//
-// <array> feature macros
+// WARNING: This test was generated by generate_feature_test_macros_tests.py and
+// should not be edited manually.
+
+// <array>
-/* Constant Value
- __cpp_lib_array_constexpr 201603L
- __cpp_lib_nonmember_container_access 201411L
+// Test the feature test macros defined by <array>
+/* Constant Value
+ __cpp_lib_array_constexpr 201603L [C++17]
+ __cpp_lib_constexpr_misc 201811L [C++2a]
+ __cpp_lib_nonmember_container_access 201411L [C++17]
*/
#include <array>
-#include <cassert>
#include "test_macros.h"
-int main()
-{
-// ensure that the macros that are supposed to be defined in <array> are defined.
+#if TEST_STD_VER < 14
-/*
-#if !defined(__cpp_lib_fooby)
-# error "__cpp_lib_fooby is not defined"
-#elif __cpp_lib_fooby < 201606L
-# error "__cpp_lib_fooby has an invalid value"
-#endif
-*/
-}
+# ifdef __cpp_lib_array_constexpr
+# error "__cpp_lib_array_constexpr should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_constexpr_misc
+# error "__cpp_lib_constexpr_misc should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_nonmember_container_access
+# error "__cpp_lib_nonmember_container_access should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 14
+
+# ifdef __cpp_lib_array_constexpr
+# error "__cpp_lib_array_constexpr should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_constexpr_misc
+# error "__cpp_lib_constexpr_misc should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_nonmember_container_access
+# error "__cpp_lib_nonmember_container_access should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 17
+
+# ifndef __cpp_lib_array_constexpr
+# error "__cpp_lib_array_constexpr should be defined in c++17"
+# endif
+# if __cpp_lib_array_constexpr != 201603L
+# error "__cpp_lib_array_constexpr should have the value 201603L in c++17"
+# endif
+
+# ifdef __cpp_lib_constexpr_misc
+# error "__cpp_lib_constexpr_misc should not be defined before c++2a"
+# endif
+
+# ifndef __cpp_lib_nonmember_container_access
+# error "__cpp_lib_nonmember_container_access should be defined in c++17"
+# endif
+# if __cpp_lib_nonmember_container_access != 201411L
+# error "__cpp_lib_nonmember_container_access should have the value 201411L in c++17"
+# endif
+
+#elif TEST_STD_VER > 17
+
+# ifndef __cpp_lib_array_constexpr
+# error "__cpp_lib_array_constexpr should be defined in c++2a"
+# endif
+# if __cpp_lib_array_constexpr != 201603L
+# error "__cpp_lib_array_constexpr should have the value 201603L in c++2a"
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_constexpr_misc
+# error "__cpp_lib_constexpr_misc should be defined in c++2a"
+# endif
+# if __cpp_lib_constexpr_misc != 201811L
+# error "__cpp_lib_constexpr_misc should have the value 201811L in c++2a"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_constexpr_misc
+# error "__cpp_lib_constexpr_misc should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+# ifndef __cpp_lib_nonmember_container_access
+# error "__cpp_lib_nonmember_container_access should be defined in c++2a"
+# endif
+# if __cpp_lib_nonmember_container_access != 201411L
+# error "__cpp_lib_nonmember_container_access should have the value 201411L in c++2a"
+# endif
+
+#endif // TEST_STD_VER > 17
+
+int main() {}
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/atomic.version.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/atomic.version.pass.cpp
index 78ee09d2f7f..4c0b351213a 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/atomic.version.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/atomic.version.pass.cpp
@@ -1,4 +1,3 @@
-
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
@@ -8,48 +7,102 @@
//
//===----------------------------------------------------------------------===//
//
-// <atomic> feature macros
+// WARNING: This test was generated by generate_feature_test_macros_tests.py and
+// should not be edited manually.
-/* Constant Value
- __cpp_lib_char8_t 201811L
- __cpp_lib_atomic_is_always_lock_free 201603L
- __cpp_lib_atomic_ref 201806L
+// <atomic>
-*/
+// Test the feature test macros defined by <atomic>
-// UNSUPPORTED: libcpp-has-no-threads
+/* Constant Value
+ __cpp_lib_atomic_is_always_lock_free 201603L [C++17]
+ __cpp_lib_atomic_ref 201806L [C++2a]
+ __cpp_lib_char8_t 201811L [C++2a]
+*/
#include <atomic>
-#include <cassert>
#include "test_macros.h"
-int main()
-{
-// ensure that the macros that are supposed to be defined in <atomic> are defined.
+#if TEST_STD_VER < 14
+
+# ifdef __cpp_lib_atomic_is_always_lock_free
+# error "__cpp_lib_atomic_is_always_lock_free should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_atomic_ref
+# error "__cpp_lib_atomic_ref should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_char8_t
+# error "__cpp_lib_char8_t should not be defined before c++2a"
+# endif
+
+#elif TEST_STD_VER == 14
+
+# ifdef __cpp_lib_atomic_is_always_lock_free
+# error "__cpp_lib_atomic_is_always_lock_free should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_atomic_ref
+# error "__cpp_lib_atomic_ref should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_char8_t
+# error "__cpp_lib_char8_t should not be defined before c++2a"
+# endif
+
+#elif TEST_STD_VER == 17
-#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
-# if !defined(__cpp_lib_char8_t)
- LIBCPP_STATIC_ASSERT(false, "__cpp_lib_char8_t is not defined");
+# ifndef __cpp_lib_atomic_is_always_lock_free
+# error "__cpp_lib_atomic_is_always_lock_free should be defined in c++17"
+# endif
+# if __cpp_lib_atomic_is_always_lock_free != 201603L
+# error "__cpp_lib_atomic_is_always_lock_free should have the value 201603L in c++17"
+# endif
+
+# ifdef __cpp_lib_atomic_ref
+# error "__cpp_lib_atomic_ref should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_char8_t
+# error "__cpp_lib_char8_t should not be defined before c++2a"
+# endif
+
+#elif TEST_STD_VER > 17
+
+# ifndef __cpp_lib_atomic_is_always_lock_free
+# error "__cpp_lib_atomic_is_always_lock_free should be defined in c++2a"
+# endif
+# if __cpp_lib_atomic_is_always_lock_free != 201603L
+# error "__cpp_lib_atomic_is_always_lock_free should have the value 201603L in c++2a"
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_atomic_ref
+# error "__cpp_lib_atomic_ref should be defined in c++2a"
+# endif
+# if __cpp_lib_atomic_ref != 201806L
+# error "__cpp_lib_atomic_ref should have the value 201806L in c++2a"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_atomic_ref
+# error "__cpp_lib_atomic_ref should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+# if defined(__cpp_char8_t)
+# ifndef __cpp_lib_char8_t
+# error "__cpp_lib_char8_t should be defined in c++2a"
+# endif
+# if __cpp_lib_char8_t != 201811L
+# error "__cpp_lib_char8_t should have the value 201811L in c++2a"
+# endif
# else
-# if __cpp_lib_char8_t < 201811L
-# error "__cpp_lib_char8_t has an invalid value"
-# endif
-# endif
-#endif
-
-#if TEST_STD_VER > 14
-# if !defined(__cpp_lib_atomic_is_always_lock_free)
-# error "__cpp_lib_atomic_is_always_lock_free is not defined"
-# elif __cpp_lib_atomic_is_always_lock_free < 201603L
-# error "__cpp_lib_atomic_is_always_lock_free has an invalid value"
-# endif
-#endif
-
-/*
-#if !defined(__cpp_lib_fooby)
-# error "__cpp_lib_fooby is not defined"
-#elif __cpp_lib_fooby < 201606L
-# error "__cpp_lib_fooby has an invalid value"
-#endif
-*/
-}
+# ifdef __cpp_lib_char8_t
+# error "__cpp_lib_char8_t should not be defined when defined(__cpp_char8_t) is not defined!"
+# endif
+# endif
+
+#endif // TEST_STD_VER > 17
+
+int main() {}
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/bit.version.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/bit.version.pass.cpp
index 5dd7d049a5c..c3e6a56c604 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/bit.version.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/bit.version.pass.cpp
@@ -1,4 +1,3 @@
-
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
@@ -8,26 +7,53 @@
//
//===----------------------------------------------------------------------===//
//
-// <bit> feature macros
+// WARNING: This test was generated by generate_feature_test_macros_tests.py and
+// should not be edited manually.
+
+// <bit>
-/* Constant Value
- __cpp_lib_bit_cast 201806L
+// Test the feature test macros defined by <bit>
+/* Constant Value
+ __cpp_lib_bit_cast 201806L [C++2a]
*/
#include <bit>
-#include <cassert>
#include "test_macros.h"
-int main()
-{
-// ensure that the macros that are supposed to be defined in <bit> are defined.
+#if TEST_STD_VER < 14
-/*
-#if !defined(__cpp_lib_fooby)
-# error "__cpp_lib_fooby is not defined"
-#elif __cpp_lib_fooby < 201606L
-# error "__cpp_lib_fooby has an invalid value"
-#endif
-*/
-}
+# ifdef __cpp_lib_bit_cast
+# error "__cpp_lib_bit_cast should not be defined before c++2a"
+# endif
+
+#elif TEST_STD_VER == 14
+
+# ifdef __cpp_lib_bit_cast
+# error "__cpp_lib_bit_cast should not be defined before c++2a"
+# endif
+
+#elif TEST_STD_VER == 17
+
+# ifdef __cpp_lib_bit_cast
+# error "__cpp_lib_bit_cast should not be defined before c++2a"
+# endif
+
+#elif TEST_STD_VER > 17
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_bit_cast
+# error "__cpp_lib_bit_cast should be defined in c++2a"
+# endif
+# if __cpp_lib_bit_cast != 201806L
+# error "__cpp_lib_bit_cast should have the value 201806L in c++2a"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_bit_cast
+# error "__cpp_lib_bit_cast should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+#endif // TEST_STD_VER > 17
+
+int main() {}
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/chrono.version.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/chrono.version.pass.cpp
index 1d0a79ec14e..f777fff8868 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/chrono.version.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/chrono.version.pass.cpp
@@ -1,4 +1,3 @@
-
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
@@ -8,27 +7,76 @@
//
//===----------------------------------------------------------------------===//
//
-// <chrono> feature macros
+// WARNING: This test was generated by generate_feature_test_macros_tests.py and
+// should not be edited manually.
+
+// <chrono>
-/* Constant Value
- __cpp_lib_chrono 201611L
- __cpp_lib_chrono_udls 201304L
+// Test the feature test macros defined by <chrono>
+/* Constant Value
+ __cpp_lib_chrono 201611L [C++17]
+ __cpp_lib_chrono_udls 201304L [C++14]
*/
#include <chrono>
-#include <cassert>
#include "test_macros.h"
-int main()
-{
-// ensure that the macros that are supposed to be defined in <chrono> are defined.
+#if TEST_STD_VER < 14
-/*
-#if !defined(__cpp_lib_fooby)
-# error "__cpp_lib_fooby is not defined"
-#elif __cpp_lib_fooby < 201606L
-# error "__cpp_lib_fooby has an invalid value"
-#endif
-*/
-}
+# ifdef __cpp_lib_chrono
+# error "__cpp_lib_chrono should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_chrono_udls
+# error "__cpp_lib_chrono_udls should not be defined before c++14"
+# endif
+
+#elif TEST_STD_VER == 14
+
+# ifdef __cpp_lib_chrono
+# error "__cpp_lib_chrono should not be defined before c++17"
+# endif
+
+# ifndef __cpp_lib_chrono_udls
+# error "__cpp_lib_chrono_udls should be defined in c++14"
+# endif
+# if __cpp_lib_chrono_udls != 201304L
+# error "__cpp_lib_chrono_udls should have the value 201304L in c++14"
+# endif
+
+#elif TEST_STD_VER == 17
+
+# ifndef __cpp_lib_chrono
+# error "__cpp_lib_chrono should be defined in c++17"
+# endif
+# if __cpp_lib_chrono != 201611L
+# error "__cpp_lib_chrono should have the value 201611L in c++17"
+# endif
+
+# ifndef __cpp_lib_chrono_udls
+# error "__cpp_lib_chrono_udls should be defined in c++17"
+# endif
+# if __cpp_lib_chrono_udls != 201304L
+# error "__cpp_lib_chrono_udls should have the value 201304L in c++17"
+# endif
+
+#elif TEST_STD_VER > 17
+
+# ifndef __cpp_lib_chrono
+# error "__cpp_lib_chrono should be defined in c++2a"
+# endif
+# if __cpp_lib_chrono != 201611L
+# error "__cpp_lib_chrono should have the value 201611L in c++2a"
+# endif
+
+# ifndef __cpp_lib_chrono_udls
+# error "__cpp_lib_chrono_udls should be defined in c++2a"
+# endif
+# if __cpp_lib_chrono_udls != 201304L
+# error "__cpp_lib_chrono_udls should have the value 201304L in c++2a"
+# endif
+
+#endif // TEST_STD_VER > 17
+
+int main() {}
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/cmath.version.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/cmath.version.pass.cpp
index b5b0309f803..02c7c00a583 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/cmath.version.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/cmath.version.pass.cpp
@@ -1,4 +1,3 @@
-
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
@@ -8,27 +7,85 @@
//
//===----------------------------------------------------------------------===//
//
-// <cmath> feature macros
+// WARNING: This test was generated by generate_feature_test_macros_tests.py and
+// should not be edited manually.
+
+// <cmath>
-/* Constant Value
- __cpp_lib_hypot 201603L
- __cpp_lib_math_special_functions 201603L
+// Test the feature test macros defined by <cmath>
+/* Constant Value
+ __cpp_lib_hypot 201603L [C++17]
+ __cpp_lib_math_special_functions 201603L [C++17]
*/
#include <cmath>
-#include <cassert>
#include "test_macros.h"
-int main()
-{
-// ensure that the macros that are supposed to be defined in <cmath> are defined.
+#if TEST_STD_VER < 14
-/*
-#if !defined(__cpp_lib_fooby)
-# error "__cpp_lib_fooby is not defined"
-#elif __cpp_lib_fooby < 201606L
-# error "__cpp_lib_fooby has an invalid value"
-#endif
-*/
-}
+# ifdef __cpp_lib_hypot
+# error "__cpp_lib_hypot should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_math_special_functions
+# error "__cpp_lib_math_special_functions should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 14
+
+# ifdef __cpp_lib_hypot
+# error "__cpp_lib_hypot should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_math_special_functions
+# error "__cpp_lib_math_special_functions should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 17
+
+# ifndef __cpp_lib_hypot
+# error "__cpp_lib_hypot should be defined in c++17"
+# endif
+# if __cpp_lib_hypot != 201603L
+# error "__cpp_lib_hypot should have the value 201603L in c++17"
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_math_special_functions
+# error "__cpp_lib_math_special_functions should be defined in c++17"
+# endif
+# if __cpp_lib_math_special_functions != 201603L
+# error "__cpp_lib_math_special_functions should have the value 201603L in c++17"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_math_special_functions
+# error "__cpp_lib_math_special_functions should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+#elif TEST_STD_VER > 17
+
+# ifndef __cpp_lib_hypot
+# error "__cpp_lib_hypot should be defined in c++2a"
+# endif
+# if __cpp_lib_hypot != 201603L
+# error "__cpp_lib_hypot should have the value 201603L in c++2a"
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_math_special_functions
+# error "__cpp_lib_math_special_functions should be defined in c++2a"
+# endif
+# if __cpp_lib_math_special_functions != 201603L
+# error "__cpp_lib_math_special_functions should have the value 201603L in c++2a"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_math_special_functions
+# error "__cpp_lib_math_special_functions should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+#endif // TEST_STD_VER > 17
+
+int main() {}
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/compare.version.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/compare.version.pass.cpp
index eff2cb293e4..e2d8ab88b9e 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/compare.version.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/compare.version.pass.cpp
@@ -7,26 +7,53 @@
//
//===----------------------------------------------------------------------===//
//
-// <new> feature macros
+// WARNING: This test was generated by generate_feature_test_macros_tests.py and
+// should not be edited manually.
-/* Constant Value
- __cpp_lib_three_way_comparison 201711L
+// <compare>
+// Test the feature test macros defined by <compare>
+
+/* Constant Value
+ __cpp_lib_three_way_comparison 201711L [C++2a]
*/
#include <compare>
-#include <cassert>
#include "test_macros.h"
-int main()
-{
-// ensure that the macros that are supposed to be defined in <compare> are defined.
+#if TEST_STD_VER < 14
-/*
-#if !defined(__cpp_lib_fooby)
-# error "__cpp_lib_fooby is not defined"
-#elif __cpp_lib_fooby < 201606L
-# error "__cpp_lib_fooby has an invalid value"
-#endif
-*/
-}
+# ifdef __cpp_lib_three_way_comparison
+# error "__cpp_lib_three_way_comparison should not be defined before c++2a"
+# endif
+
+#elif TEST_STD_VER == 14
+
+# ifdef __cpp_lib_three_way_comparison
+# error "__cpp_lib_three_way_comparison should not be defined before c++2a"
+# endif
+
+#elif TEST_STD_VER == 17
+
+# ifdef __cpp_lib_three_way_comparison
+# error "__cpp_lib_three_way_comparison should not be defined before c++2a"
+# endif
+
+#elif TEST_STD_VER > 17
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_three_way_comparison
+# error "__cpp_lib_three_way_comparison should be defined in c++2a"
+# endif
+# if __cpp_lib_three_way_comparison != 201711L
+# error "__cpp_lib_three_way_comparison should have the value 201711L in c++2a"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_three_way_comparison
+# error "__cpp_lib_three_way_comparison should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+#endif // TEST_STD_VER > 17
+
+int main() {}
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/complex.version.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/complex.version.pass.cpp
index be25d793dbd..889aea0fcef 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/complex.version.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/complex.version.pass.cpp
@@ -1,4 +1,3 @@
-
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
@@ -8,26 +7,53 @@
//
//===----------------------------------------------------------------------===//
//
-// <complex> feature macros
+// WARNING: This test was generated by generate_feature_test_macros_tests.py and
+// should not be edited manually.
+
+// <complex>
-/* Constant Value
- __cpp_lib_complex_udls 201309L
+// Test the feature test macros defined by <complex>
+/* Constant Value
+ __cpp_lib_complex_udls 201309L [C++14]
*/
#include <complex>
-#include <cassert>
#include "test_macros.h"
-int main()
-{
-// ensure that the macros that are supposed to be defined in <complex> are defined.
+#if TEST_STD_VER < 14
-/*
-#if !defined(__cpp_lib_fooby)
-# error "__cpp_lib_fooby is not defined"
-#elif __cpp_lib_fooby < 201606L
-# error "__cpp_lib_fooby has an invalid value"
-#endif
-*/
-}
+# ifdef __cpp_lib_complex_udls
+# error "__cpp_lib_complex_udls should not be defined before c++14"
+# endif
+
+#elif TEST_STD_VER == 14
+
+# ifndef __cpp_lib_complex_udls
+# error "__cpp_lib_complex_udls should be defined in c++14"
+# endif
+# if __cpp_lib_complex_udls != 201309L
+# error "__cpp_lib_complex_udls should have the value 201309L in c++14"
+# endif
+
+#elif TEST_STD_VER == 17
+
+# ifndef __cpp_lib_complex_udls
+# error "__cpp_lib_complex_udls should be defined in c++17"
+# endif
+# if __cpp_lib_complex_udls != 201309L
+# error "__cpp_lib_complex_udls should have the value 201309L in c++17"
+# endif
+
+#elif TEST_STD_VER > 17
+
+# ifndef __cpp_lib_complex_udls
+# error "__cpp_lib_complex_udls should be defined in c++2a"
+# endif
+# if __cpp_lib_complex_udls != 201309L
+# error "__cpp_lib_complex_udls should have the value 201309L in c++2a"
+# endif
+
+#endif // TEST_STD_VER > 17
+
+int main() {}
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/cstddef.version.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/cstddef.version.pass.cpp
index ad743b51e25..55a16288b77 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/cstddef.version.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/cstddef.version.pass.cpp
@@ -1,4 +1,3 @@
-
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
@@ -8,26 +7,50 @@
//
//===----------------------------------------------------------------------===//
//
-// <cstddef> feature macros
+// WARNING: This test was generated by generate_feature_test_macros_tests.py and
+// should not be edited manually.
+
+// <cstddef>
-/* Constant Value
- __cpp_lib_byte 201603L
+// Test the feature test macros defined by <cstddef>
+/* Constant Value
+ __cpp_lib_byte 201603L [C++17]
*/
#include <cstddef>
-#include <cassert>
#include "test_macros.h"
-int main()
-{
-// ensure that the macros that are supposed to be defined in <cstddef> are defined.
+#if TEST_STD_VER < 14
-/*
-#if !defined(__cpp_lib_fooby)
-# error "__cpp_lib_fooby is not defined"
-#elif __cpp_lib_fooby < 201606L
-# error "__cpp_lib_fooby has an invalid value"
-#endif
-*/
-}
+# ifdef __cpp_lib_byte
+# error "__cpp_lib_byte should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 14
+
+# ifdef __cpp_lib_byte
+# error "__cpp_lib_byte should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 17
+
+# ifndef __cpp_lib_byte
+# error "__cpp_lib_byte should be defined in c++17"
+# endif
+# if __cpp_lib_byte != 201603L
+# error "__cpp_lib_byte should have the value 201603L in c++17"
+# endif
+
+#elif TEST_STD_VER > 17
+
+# ifndef __cpp_lib_byte
+# error "__cpp_lib_byte should be defined in c++2a"
+# endif
+# if __cpp_lib_byte != 201603L
+# error "__cpp_lib_byte should have the value 201603L in c++2a"
+# endif
+
+#endif // TEST_STD_VER > 17
+
+int main() {}
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/deque.version.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/deque.version.pass.cpp
index 188d2f3c0ac..94cb8290b72 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/deque.version.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/deque.version.pass.cpp
@@ -1,4 +1,3 @@
-
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
@@ -8,38 +7,93 @@
//
//===----------------------------------------------------------------------===//
//
-// <deque> feature macros
+// WARNING: This test was generated by generate_feature_test_macros_tests.py and
+// should not be edited manually.
+
+// <deque>
-/* Constant Value
- __cpp_lib_allocator_traits_is_always_equal 201411L
- __cpp_lib_erase_if 201811L
- __cpp_lib_nonmember_container_access 201411L
+// Test the feature test macros defined by <deque>
+/* Constant Value
+ __cpp_lib_allocator_traits_is_always_equal 201411L [C++17]
+ __cpp_lib_erase_if 201811L [C++2a]
+ __cpp_lib_nonmember_container_access 201411L [C++17]
*/
#include <deque>
-#include <cassert>
#include "test_macros.h"
-int main()
-{
-// ensure that the macros that are supposed to be defined in <deque> are defined.
-
-#if TEST_STD_VER > 17
-# if !defined(__cpp_lib_erase_if)
- LIBCPP_STATIC_ASSERT(false, "__cpp_lib_erase_if is not defined");
-# else
-# if __cpp_lib_erase_if < 201811L
-# error "__cpp_lib_erase_if has an invalid value"
-# endif
-# endif
-#endif
-
-/*
-#if !defined(__cpp_lib_fooby)
-# error "__cpp_lib_fooby is not defined"
-#elif __cpp_lib_fooby < 201606L
-# error "__cpp_lib_fooby has an invalid value"
-#endif
-*/
-}
+#if TEST_STD_VER < 14
+
+# ifdef __cpp_lib_allocator_traits_is_always_equal
+# error "__cpp_lib_allocator_traits_is_always_equal should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_erase_if
+# error "__cpp_lib_erase_if should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_nonmember_container_access
+# error "__cpp_lib_nonmember_container_access should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 14
+
+# ifdef __cpp_lib_allocator_traits_is_always_equal
+# error "__cpp_lib_allocator_traits_is_always_equal should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_erase_if
+# error "__cpp_lib_erase_if should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_nonmember_container_access
+# error "__cpp_lib_nonmember_container_access should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 17
+
+# ifndef __cpp_lib_allocator_traits_is_always_equal
+# error "__cpp_lib_allocator_traits_is_always_equal should be defined in c++17"
+# endif
+# if __cpp_lib_allocator_traits_is_always_equal != 201411L
+# error "__cpp_lib_allocator_traits_is_always_equal should have the value 201411L in c++17"
+# endif
+
+# ifdef __cpp_lib_erase_if
+# error "__cpp_lib_erase_if should not be defined before c++2a"
+# endif
+
+# ifndef __cpp_lib_nonmember_container_access
+# error "__cpp_lib_nonmember_container_access should be defined in c++17"
+# endif
+# if __cpp_lib_nonmember_container_access != 201411L
+# error "__cpp_lib_nonmember_container_access should have the value 201411L in c++17"
+# endif
+
+#elif TEST_STD_VER > 17
+
+# ifndef __cpp_lib_allocator_traits_is_always_equal
+# error "__cpp_lib_allocator_traits_is_always_equal should be defined in c++2a"
+# endif
+# if __cpp_lib_allocator_traits_is_always_equal != 201411L
+# error "__cpp_lib_allocator_traits_is_always_equal should have the value 201411L in c++2a"
+# endif
+
+# ifndef __cpp_lib_erase_if
+# error "__cpp_lib_erase_if should be defined in c++2a"
+# endif
+# if __cpp_lib_erase_if != 201811L
+# error "__cpp_lib_erase_if should have the value 201811L in c++2a"
+# endif
+
+# ifndef __cpp_lib_nonmember_container_access
+# error "__cpp_lib_nonmember_container_access should be defined in c++2a"
+# endif
+# if __cpp_lib_nonmember_container_access != 201411L
+# error "__cpp_lib_nonmember_container_access should have the value 201411L in c++2a"
+# endif
+
+#endif // TEST_STD_VER > 17
+
+int main() {}
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/exception.version.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/exception.version.pass.cpp
index 3ea235bdbee..25a7c385209 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/exception.version.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/exception.version.pass.cpp
@@ -1,4 +1,3 @@
-
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
@@ -8,26 +7,50 @@
//
//===----------------------------------------------------------------------===//
//
-// <exception> feature macros
+// WARNING: This test was generated by generate_feature_test_macros_tests.py and
+// should not be edited manually.
+
+// <exception>
-/* Constant Value
- __cpp_lib_uncaught_exceptions 201411L
+// Test the feature test macros defined by <exception>
+/* Constant Value
+ __cpp_lib_uncaught_exceptions 201411L [C++17]
*/
#include <exception>
-#include <cassert>
#include "test_macros.h"
-int main()
-{
-// ensure that the macros that are supposed to be defined in <exception> are defined.
+#if TEST_STD_VER < 14
-/*
-#if !defined(__cpp_lib_fooby)
-# error "__cpp_lib_fooby is not defined"
-#elif __cpp_lib_fooby < 201606L
-# error "__cpp_lib_fooby has an invalid value"
-#endif
-*/
-}
+# ifdef __cpp_lib_uncaught_exceptions
+# error "__cpp_lib_uncaught_exceptions should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 14
+
+# ifdef __cpp_lib_uncaught_exceptions
+# error "__cpp_lib_uncaught_exceptions should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 17
+
+# ifndef __cpp_lib_uncaught_exceptions
+# error "__cpp_lib_uncaught_exceptions should be defined in c++17"
+# endif
+# if __cpp_lib_uncaught_exceptions != 201411L
+# error "__cpp_lib_uncaught_exceptions should have the value 201411L in c++17"
+# endif
+
+#elif TEST_STD_VER > 17
+
+# ifndef __cpp_lib_uncaught_exceptions
+# error "__cpp_lib_uncaught_exceptions should be defined in c++2a"
+# endif
+# if __cpp_lib_uncaught_exceptions != 201411L
+# error "__cpp_lib_uncaught_exceptions should have the value 201411L in c++2a"
+# endif
+
+#endif // TEST_STD_VER > 17
+
+int main() {}
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/filesystem.version.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/filesystem.version.pass.cpp
index 4d03634c292..9bd9f08fc40 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/filesystem.version.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/filesystem.version.pass.cpp
@@ -1,4 +1,3 @@
-
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
@@ -8,45 +7,76 @@
//
//===----------------------------------------------------------------------===//
//
-// <filesystem> feature macros
+// WARNING: This test was generated by generate_feature_test_macros_tests.py and
+// should not be edited manually.
+
+// <filesystem>
-/* Constant Value
- __cpp_lib_char8_t 201811L
- __cpp_lib_filesystem 201703L
+// Test the feature test macros defined by <filesystem>
+/* Constant Value
+ __cpp_lib_char8_t 201811L [C++2a]
+ __cpp_lib_filesystem 201703L [C++17]
*/
#include <filesystem>
-#include <cassert>
#include "test_macros.h"
-int main()
-{
-// ensure that the macros that are supposed to be defined in <filesystem> are defined.
+#if TEST_STD_VER < 14
+
+# ifdef __cpp_lib_char8_t
+# error "__cpp_lib_char8_t should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_filesystem
+# error "__cpp_lib_filesystem should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 14
-#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
-# if !defined(__cpp_lib_char8_t)
- LIBCPP_STATIC_ASSERT(false, "__cpp_lib_char8_t is not defined");
+# ifdef __cpp_lib_char8_t
+# error "__cpp_lib_char8_t should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_filesystem
+# error "__cpp_lib_filesystem should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 17
+
+# ifdef __cpp_lib_char8_t
+# error "__cpp_lib_char8_t should not be defined before c++2a"
+# endif
+
+# ifndef __cpp_lib_filesystem
+# error "__cpp_lib_filesystem should be defined in c++17"
+# endif
+# if __cpp_lib_filesystem != 201703L
+# error "__cpp_lib_filesystem should have the value 201703L in c++17"
+# endif
+
+#elif TEST_STD_VER > 17
+
+# if defined(__cpp_char8_t)
+# ifndef __cpp_lib_char8_t
+# error "__cpp_lib_char8_t should be defined in c++2a"
+# endif
+# if __cpp_lib_char8_t != 201811L
+# error "__cpp_lib_char8_t should have the value 201811L in c++2a"
+# endif
# else
-# if __cpp_lib_char8_t < 201811L
-# error "__cpp_lib_char8_t has an invalid value"
-# endif
-# endif
-#endif
-
-#if TEST_STD_VER > 14
-# if !defined(__cpp_lib_filesystem)
-# error "__cpp_lib_filesystem is not defined"
-# elif __cpp_lib_filesystem < 201703L
-# error "__cpp_lib_filesystem has an invalid value"
-# endif
-#endif
-
-/*
-#if !defined(__cpp_lib_fooby)
-# error "__cpp_lib_fooby is not defined"
-#elif __cpp_lib_fooby < 201606L
-# error "__cpp_lib_fooby has an invalid value"
-#endif
-*/
-}
+# ifdef __cpp_lib_char8_t
+# error "__cpp_lib_char8_t should not be defined when defined(__cpp_char8_t) is not defined!"
+# endif
+# endif
+
+# ifndef __cpp_lib_filesystem
+# error "__cpp_lib_filesystem should be defined in c++2a"
+# endif
+# if __cpp_lib_filesystem != 201703L
+# error "__cpp_lib_filesystem should have the value 201703L in c++2a"
+# endif
+
+#endif // TEST_STD_VER > 17
+
+int main() {}
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/forward_list.version.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/forward_list.version.pass.cpp
index 9b44f6e2c46..41e4b774928 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/forward_list.version.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/forward_list.version.pass.cpp
@@ -1,4 +1,3 @@
-
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
@@ -8,40 +7,142 @@
//
//===----------------------------------------------------------------------===//
//
-// <forward_list> feature macros
+// WARNING: This test was generated by generate_feature_test_macros_tests.py and
+// should not be edited manually.
+
+// <forward_list>
-/* Constant Value
- __cpp_lib_allocator_traits_is_always_equal 201411L
- __cpp_lib_erase_if 201811L
- __cpp_lib_incomplete_container_elements 201505L
- __cpp_lib_list_remove_return_type 201806L
- __cpp_lib_nonmember_container_access 201411L
+// Test the feature test macros defined by <forward_list>
+/* Constant Value
+ __cpp_lib_allocator_traits_is_always_equal 201411L [C++17]
+ __cpp_lib_erase_if 201811L [C++2a]
+ __cpp_lib_incomplete_container_elements 201505L [C++17]
+ __cpp_lib_list_remove_return_type 201806L [C++2a]
+ __cpp_lib_nonmember_container_access 201411L [C++17]
*/
#include <forward_list>
-#include <cassert>
#include "test_macros.h"
-int main()
-{
-// ensure that the macros that are supposed to be defined in <forward_list> are defined.
-
-#if TEST_STD_VER > 17
-# if !defined(__cpp_lib_erase_if)
- LIBCPP_STATIC_ASSERT(false, "__cpp_lib_erase_if is not defined");
-# else
-# if __cpp_lib_erase_if < 201811L
-# error "__cpp_lib_erase_if has an invalid value"
-# endif
-# endif
-#endif
-
-/*
-#if !defined(__cpp_lib_fooby)
-# error "__cpp_lib_fooby is not defined"
-#elif __cpp_lib_fooby < 201606L
-# error "__cpp_lib_fooby has an invalid value"
-#endif
-*/
-}
+#if TEST_STD_VER < 14
+
+# ifdef __cpp_lib_allocator_traits_is_always_equal
+# error "__cpp_lib_allocator_traits_is_always_equal should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_erase_if
+# error "__cpp_lib_erase_if should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_incomplete_container_elements
+# error "__cpp_lib_incomplete_container_elements should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_list_remove_return_type
+# error "__cpp_lib_list_remove_return_type should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_nonmember_container_access
+# error "__cpp_lib_nonmember_container_access should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 14
+
+# ifdef __cpp_lib_allocator_traits_is_always_equal
+# error "__cpp_lib_allocator_traits_is_always_equal should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_erase_if
+# error "__cpp_lib_erase_if should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_incomplete_container_elements
+# error "__cpp_lib_incomplete_container_elements should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_list_remove_return_type
+# error "__cpp_lib_list_remove_return_type should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_nonmember_container_access
+# error "__cpp_lib_nonmember_container_access should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 17
+
+# ifndef __cpp_lib_allocator_traits_is_always_equal
+# error "__cpp_lib_allocator_traits_is_always_equal should be defined in c++17"
+# endif
+# if __cpp_lib_allocator_traits_is_always_equal != 201411L
+# error "__cpp_lib_allocator_traits_is_always_equal should have the value 201411L in c++17"
+# endif
+
+# ifdef __cpp_lib_erase_if
+# error "__cpp_lib_erase_if should not be defined before c++2a"
+# endif
+
+# ifndef __cpp_lib_incomplete_container_elements
+# error "__cpp_lib_incomplete_container_elements should be defined in c++17"
+# endif
+# if __cpp_lib_incomplete_container_elements != 201505L
+# error "__cpp_lib_incomplete_container_elements should have the value 201505L in c++17"
+# endif
+
+# ifdef __cpp_lib_list_remove_return_type
+# error "__cpp_lib_list_remove_return_type should not be defined before c++2a"
+# endif
+
+# ifndef __cpp_lib_nonmember_container_access
+# error "__cpp_lib_nonmember_container_access should be defined in c++17"
+# endif
+# if __cpp_lib_nonmember_container_access != 201411L
+# error "__cpp_lib_nonmember_container_access should have the value 201411L in c++17"
+# endif
+
+#elif TEST_STD_VER > 17
+
+# ifndef __cpp_lib_allocator_traits_is_always_equal
+# error "__cpp_lib_allocator_traits_is_always_equal should be defined in c++2a"
+# endif
+# if __cpp_lib_allocator_traits_is_always_equal != 201411L
+# error "__cpp_lib_allocator_traits_is_always_equal should have the value 201411L in c++2a"
+# endif
+
+# ifndef __cpp_lib_erase_if
+# error "__cpp_lib_erase_if should be defined in c++2a"
+# endif
+# if __cpp_lib_erase_if != 201811L
+# error "__cpp_lib_erase_if should have the value 201811L in c++2a"
+# endif
+
+# ifndef __cpp_lib_incomplete_container_elements
+# error "__cpp_lib_incomplete_container_elements should be defined in c++2a"
+# endif
+# if __cpp_lib_incomplete_container_elements != 201505L
+# error "__cpp_lib_incomplete_container_elements should have the value 201505L in c++2a"
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_list_remove_return_type
+# error "__cpp_lib_list_remove_return_type should be defined in c++2a"
+# endif
+# if __cpp_lib_list_remove_return_type != 201806L
+# error "__cpp_lib_list_remove_return_type should have the value 201806L in c++2a"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_list_remove_return_type
+# error "__cpp_lib_list_remove_return_type should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+# ifndef __cpp_lib_nonmember_container_access
+# error "__cpp_lib_nonmember_container_access should be defined in c++2a"
+# endif
+# if __cpp_lib_nonmember_container_access != 201411L
+# error "__cpp_lib_nonmember_container_access should have the value 201411L in c++2a"
+# endif
+
+#endif // TEST_STD_VER > 17
+
+int main() {}
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/functional.version.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/functional.version.pass.cpp
index 57978cbb30c..4958d4d4cd2 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/functional.version.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/functional.version.pass.cpp
@@ -1,4 +1,3 @@
-
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
@@ -8,38 +7,239 @@
//
//===----------------------------------------------------------------------===//
//
-// <functional> feature macros
+// WARNING: This test was generated by generate_feature_test_macros_tests.py and
+// should not be edited manually.
+
+// <functional>
-/* Constant Value
- __cpp_lib_boyer_moore_searcher 201603L
- __cpp_lib_invoke 201411L
- __cpp_lib_not_fn 201603L
- __cpp_lib_result_of_sfinae 201210L
- __cpp_lib_transparent_operators 201510L
+// Test the feature test macros defined by <functional>
+/* Constant Value
+ __cpp_lib_bind_front 201811L [C++2a]
+ __cpp_lib_boyer_moore_searcher 201603L [C++17]
+ __cpp_lib_constexpr_misc 201811L [C++2a]
+ __cpp_lib_invoke 201411L [C++17]
+ __cpp_lib_not_fn 201603L [C++17]
+ __cpp_lib_ranges 201811L [C++2a]
+ __cpp_lib_result_of_sfinae 201210L [C++14]
+ __cpp_lib_transparent_operators 201210L [C++14]
+ 201510L [C++17]
*/
#include <functional>
-#include <cassert>
#include "test_macros.h"
-int main()
-{
-// ensure that the macros that are supposed to be defined in <functional> are defined.
+#if TEST_STD_VER < 14
-#if TEST_STD_VER > 14
-# if !defined(__cpp_lib_invoke)
-# error "__cpp_lib_invoke is not defined"
-# elif __cpp_lib_invoke < 201411L
-# error "__cpp_lib_invoke has an invalid value"
+# ifdef __cpp_lib_bind_front
+# error "__cpp_lib_bind_front should not be defined before c++2a"
# endif
-#endif
-/*
-#if !defined(__cpp_lib_fooby)
-# error "__cpp_lib_fooby is not defined"
-#elif __cpp_lib_fooby < 201606L
-# error "__cpp_lib_fooby has an invalid value"
-#endif
-*/
-}
+# ifdef __cpp_lib_boyer_moore_searcher
+# error "__cpp_lib_boyer_moore_searcher should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_constexpr_misc
+# error "__cpp_lib_constexpr_misc should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_invoke
+# error "__cpp_lib_invoke should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_not_fn
+# error "__cpp_lib_not_fn should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_ranges
+# error "__cpp_lib_ranges should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_result_of_sfinae
+# error "__cpp_lib_result_of_sfinae should not be defined before c++14"
+# endif
+
+# ifdef __cpp_lib_transparent_operators
+# error "__cpp_lib_transparent_operators should not be defined before c++14"
+# endif
+
+#elif TEST_STD_VER == 14
+
+# ifdef __cpp_lib_bind_front
+# error "__cpp_lib_bind_front should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_boyer_moore_searcher
+# error "__cpp_lib_boyer_moore_searcher should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_constexpr_misc
+# error "__cpp_lib_constexpr_misc should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_invoke
+# error "__cpp_lib_invoke should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_not_fn
+# error "__cpp_lib_not_fn should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_ranges
+# error "__cpp_lib_ranges should not be defined before c++2a"
+# endif
+
+# ifndef __cpp_lib_result_of_sfinae
+# error "__cpp_lib_result_of_sfinae should be defined in c++14"
+# endif
+# if __cpp_lib_result_of_sfinae != 201210L
+# error "__cpp_lib_result_of_sfinae should have the value 201210L in c++14"
+# endif
+
+# ifndef __cpp_lib_transparent_operators
+# error "__cpp_lib_transparent_operators should be defined in c++14"
+# endif
+# if __cpp_lib_transparent_operators != 201210L
+# error "__cpp_lib_transparent_operators should have the value 201210L in c++14"
+# endif
+
+#elif TEST_STD_VER == 17
+
+# ifdef __cpp_lib_bind_front
+# error "__cpp_lib_bind_front should not be defined before c++2a"
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_boyer_moore_searcher
+# error "__cpp_lib_boyer_moore_searcher should be defined in c++17"
+# endif
+# if __cpp_lib_boyer_moore_searcher != 201603L
+# error "__cpp_lib_boyer_moore_searcher should have the value 201603L in c++17"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_boyer_moore_searcher
+# error "__cpp_lib_boyer_moore_searcher should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+# ifdef __cpp_lib_constexpr_misc
+# error "__cpp_lib_constexpr_misc should not be defined before c++2a"
+# endif
+
+# ifndef __cpp_lib_invoke
+# error "__cpp_lib_invoke should be defined in c++17"
+# endif
+# if __cpp_lib_invoke != 201411L
+# error "__cpp_lib_invoke should have the value 201411L in c++17"
+# endif
+
+# ifndef __cpp_lib_not_fn
+# error "__cpp_lib_not_fn should be defined in c++17"
+# endif
+# if __cpp_lib_not_fn != 201603L
+# error "__cpp_lib_not_fn should have the value 201603L in c++17"
+# endif
+
+# ifdef __cpp_lib_ranges
+# error "__cpp_lib_ranges should not be defined before c++2a"
+# endif
+
+# ifndef __cpp_lib_result_of_sfinae
+# error "__cpp_lib_result_of_sfinae should be defined in c++17"
+# endif
+# if __cpp_lib_result_of_sfinae != 201210L
+# error "__cpp_lib_result_of_sfinae should have the value 201210L in c++17"
+# endif
+
+# ifndef __cpp_lib_transparent_operators
+# error "__cpp_lib_transparent_operators should be defined in c++17"
+# endif
+# if __cpp_lib_transparent_operators != 201510L
+# error "__cpp_lib_transparent_operators should have the value 201510L in c++17"
+# endif
+
+#elif TEST_STD_VER > 17
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_bind_front
+# error "__cpp_lib_bind_front should be defined in c++2a"
+# endif
+# if __cpp_lib_bind_front != 201811L
+# error "__cpp_lib_bind_front should have the value 201811L in c++2a"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_bind_front
+# error "__cpp_lib_bind_front should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_boyer_moore_searcher
+# error "__cpp_lib_boyer_moore_searcher should be defined in c++2a"
+# endif
+# if __cpp_lib_boyer_moore_searcher != 201603L
+# error "__cpp_lib_boyer_moore_searcher should have the value 201603L in c++2a"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_boyer_moore_searcher
+# error "__cpp_lib_boyer_moore_searcher should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_constexpr_misc
+# error "__cpp_lib_constexpr_misc should be defined in c++2a"
+# endif
+# if __cpp_lib_constexpr_misc != 201811L
+# error "__cpp_lib_constexpr_misc should have the value 201811L in c++2a"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_constexpr_misc
+# error "__cpp_lib_constexpr_misc should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+# ifndef __cpp_lib_invoke
+# error "__cpp_lib_invoke should be defined in c++2a"
+# endif
+# if __cpp_lib_invoke != 201411L
+# error "__cpp_lib_invoke should have the value 201411L in c++2a"
+# endif
+
+# ifndef __cpp_lib_not_fn
+# error "__cpp_lib_not_fn should be defined in c++2a"
+# endif
+# if __cpp_lib_not_fn != 201603L
+# error "__cpp_lib_not_fn should have the value 201603L in c++2a"
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_ranges
+# error "__cpp_lib_ranges should be defined in c++2a"
+# endif
+# if __cpp_lib_ranges != 201811L
+# error "__cpp_lib_ranges should have the value 201811L in c++2a"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_ranges
+# error "__cpp_lib_ranges should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+# ifndef __cpp_lib_result_of_sfinae
+# error "__cpp_lib_result_of_sfinae should be defined in c++2a"
+# endif
+# if __cpp_lib_result_of_sfinae != 201210L
+# error "__cpp_lib_result_of_sfinae should have the value 201210L in c++2a"
+# endif
+
+# ifndef __cpp_lib_transparent_operators
+# error "__cpp_lib_transparent_operators should be defined in c++2a"
+# endif
+# if __cpp_lib_transparent_operators != 201510L
+# error "__cpp_lib_transparent_operators should have the value 201510L in c++2a"
+# endif
+
+#endif // TEST_STD_VER > 17
+
+int main() {}
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/generate_feature_test_macro_components.py b/libcxx/test/std/language.support/support.limits/support.limits.general/generate_feature_test_macro_components.py
new file mode 100755
index 00000000000..d51df45431f
--- /dev/null
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/generate_feature_test_macro_components.py
@@ -0,0 +1,959 @@
+#!/usr/bin/env python
+
+import os
+import tempfile
+
+def get_libcxx_paths():
+ script_path = os.path.dirname(os.path.abspath(__file__))
+ assert os.path.exists(script_path)
+ depth = 5
+ src_root = script_path
+ for _ in xrange(0, 5):
+ src_root = os.path.dirname(src_root)
+ include_path = os.path.join(src_root, 'include')
+ assert os.path.exists(include_path)
+ docs_path = os.path.join(src_root, 'docs')
+ assert os.path.exists(docs_path)
+ return script_path, src_root, include_path, docs_path
+
+
+script_path, source_root, include_path, docs_path = get_libcxx_paths()
+
+def has_header(h):
+ h_path = os.path.join(include_path, h)
+ return os.path.exists(h_path)
+
+def add_version_header(tc):
+ tc["headers"].append("version")
+ return tc
+
+feature_test_macros = sorted([ add_version_header(x) for x in [
+ # C++14 macros
+ {"name": "__cpp_lib_integer_sequence",
+ "values": {
+ "c++14": 201304L
+ },
+ "headers": ["utility"],
+ },
+ {"name": "__cpp_lib_exchange_function",
+ "values": {
+ "c++14": 201304L
+ },
+ "headers": ["utility"],
+ },
+ {"name": "__cpp_lib_tuples_by_type",
+ "values": {
+ "c++14": 201304L
+ },
+ "headers": ["utility", "tuple"],
+ },
+ {"name": "__cpp_lib_tuple_element_t",
+ "values": {
+ "c++14": 201402L
+ },
+ "headers": ["tuple"],
+ },
+ {"name": "__cpp_lib_make_unique",
+ "values": {
+ "c++14": 201304L
+ },
+ "headers": ["memory"],
+ },
+ {"name": "__cpp_lib_transparent_operators",
+ "values": {
+ "c++14": 201210L,
+ "c++17": 201510L,
+ },
+ "headers": ["functional"],
+ },
+ {"name": "__cpp_lib_integral_constant_callable",
+ "values": {
+ "c++14": 201304L
+ },
+ "headers": ["type_traits"],
+ },
+ {"name": "__cpp_lib_transformation_trait_aliases",
+ "values": {
+ "c++14": 201304L,
+ },
+ "headers": ["type_traits"]
+ },
+ {"name": "__cpp_lib_result_of_sfinae",
+ "values": {
+ "c++14": 201210L,
+ },
+ "headers": ["functional", "type_traits"]
+ },
+ {"name": "__cpp_lib_is_final",
+ "values": {
+ "c++14": 201402L,
+ },
+ "headers": ["type_traits"]
+ },
+ {"name": "__cpp_lib_is_null_pointer",
+ "values": {
+ "c++14": 201309L,
+ },
+ "headers": ["type_traits"]
+ },
+ {"name": "__cpp_lib_chrono_udls",
+ "values": {
+ "c++14": 201304L,
+ },
+ "headers": ["chrono"]
+ },
+ {"name": "__cpp_lib_string_udls",
+ "values": {
+ "c++14": 201304L,
+ },
+ "headers": ["string"]
+ },
+ {"name": "__cpp_lib_generic_associative_lookup",
+ "values": {
+ "c++14": 201304L,
+ },
+ "headers": ["map", "set"]
+ },
+ {"name": "__cpp_lib_null_iterators",
+ "values": {
+ "c++14": 201304L,
+ },
+ "headers": ["iterator"]
+ },
+ {"name": "__cpp_lib_make_reverse_iterator",
+ "values": {
+ "c++14": 201402L,
+ },
+ "headers": ["iterator"]
+ },
+ {"name": "__cpp_lib_robust_nonmodifying_seq_ops",
+ "values": {
+ "c++14": 201304L,
+ },
+ "headers": ["algorithm"]
+ },
+ {"name": "__cpp_lib_complex_udls",
+ "values": {
+ "c++14": 201309L,
+ },
+ "headers": ["complex"]
+ },
+ {"name": "__cpp_lib_quoted_string_io",
+ "values": {
+ "c++14": 201304L,
+ },
+ "headers": ["iomanip"]
+ },
+ {"name": "__cpp_lib_shared_timed_mutex",
+ "values": {
+ "c++14": 201402L,
+ },
+ "headers": ["shared_mutex"]
+ },
+ # C++17 macros
+ {"name": "__cpp_lib_atomic_is_always_lock_free",
+ "values": {
+ "c++17": 201603L,
+ },
+ "headers": ["atomic"]
+ },
+ {"name": "__cpp_lib_filesystem",
+ "values": {
+ "c++17": 201703L,
+ },
+ "headers": ["filesystem"]
+ },
+ {"name": "__cpp_lib_invoke",
+ "values": {
+ "c++17": 201411L,
+ },
+ "headers": ["functional"]
+ },
+ {"name": "__cpp_lib_void_t",
+ "values": {
+ "c++17": 201411L,
+ },
+ "headers": ["type_traits"]
+ },
+ {"name": "__cpp_lib_node_extract",
+ "values": {
+ "c++17": 201606L,
+ },
+ "headers": ["map", "set", "unordered_map", "unordered_set"]
+ },
+ {"name": "__cpp_lib_byte",
+ "values": {
+ "c++17": 201603L,
+ },
+ "headers": ["cstddef"],
+ },
+ {"name": "__cpp_lib_hardware_interference_size",
+ "values": {
+ "c++17": 201703L,
+ },
+ "headers": ["new"],
+ },
+ {"name": "__cpp_lib_launder",
+ "values": {
+ "c++17": 201606L,
+ },
+ "headers": ["new"],
+ },
+ {"name": "__cpp_lib_uncaught_exceptions",
+ "values": {
+ "c++17": 201411L,
+ },
+ "headers": ["exception"],
+ },
+ {"name": "__cpp_lib_as_const",
+ "values": {
+ "c++17": 201510L,
+ },
+ "headers": ["utility"],
+ },
+ {"name": "__cpp_lib_make_from_tuple",
+ "values": {
+ "c++17": 201606L,
+ },
+ "headers": ["tuple"],
+ },
+ {"name": "__cpp_lib_apply",
+ "values": {
+ "c++17": 201603L,
+ },
+ "headers": ["tuple"],
+ },
+ {"name": "__cpp_lib_optional",
+ "values": {
+ "c++17": 201606L,
+ },
+ "headers": ["optional"],
+ },
+ {"name": "__cpp_lib_variant",
+ "values": {
+ "c++17": 201606L,
+ },
+ "headers": ["variant"],
+ },
+ {"name": "__cpp_lib_any",
+ "values": {
+ "c++17": 201606L,
+ },
+ "headers": ["any"],
+ },
+ {"name": "__cpp_lib_addressof_constexpr",
+ "values": {
+ "c++17": 201603L,
+ },
+ "headers": ["memory"],
+ "depends": "TEST_HAS_BUILTIN(__builtin_addressof) || TEST_GCC_VER >= 700",
+ "internal_depends": "!defined(_LIBCPP_HAS_NO_BUILTIN_ADDRESSOF)",
+ },
+ {"name": "__cpp_lib_raw_memory_algorithms",
+ "values": {
+ "c++17": 201606L,
+ },
+ "headers": ["memory"],
+ },
+ {"name": "__cpp_lib_enable_shared_from_this",
+ "values": {
+ "c++17": 201603L,
+ },
+ "headers": ["memory"],
+ },
+ {"name": "__cpp_lib_shared_ptr_weak_type",
+ "values": {
+ "c++17": 201606L,
+ },
+ "headers": ["memory"],
+ },
+ {"name": "__cpp_lib_shared_ptr_arrays",
+ "values": {
+ "c++17": 201611L,
+ },
+ "headers": ["memory"],
+ "unimplemented": True,
+ },
+ {"name": "__cpp_lib_memory_resource",
+ "values": {
+ "c++17": 201603L,
+ },
+ "headers": ["memory_resource"],
+ "unimplemented": True,
+ },
+ {"name": "__cpp_lib_boyer_moore_searcher",
+ "values": {
+ "c++17": 201603L,
+ },
+ "headers": ["functional"],
+ "unimplemented": True,
+ },
+ {"name": "__cpp_lib_not_fn",
+ "values": {
+ "c++17": 201603L,
+ },
+ "headers": ["functional"],
+ },
+ {"name": "__cpp_lib_bool_constant",
+ "values": {
+ "c++17": 201505L,
+ },
+ "headers": ["type_traits"],
+ },
+ {"name": "__cpp_lib_type_trait_variable_templates",
+ "values": {
+ "c++17": 201510L,
+ },
+ "headers": ["type_traits"],
+ },
+ {"name": "__cpp_lib_logical_traits",
+ "values": {
+ "c++17": 201510L,
+ },
+ "headers": ["type_traits"],
+ },
+ {"name": "__cpp_lib_is_swappable",
+ "values": {
+ "c++17": 201603L,
+ },
+ "headers": ["type_traits"],
+ },
+ {"name": "__cpp_lib_is_invocable",
+ "values": {
+ "c++17": 201703L,
+ },
+ "headers": ["type_traits"],
+ },
+ {"name": "__cpp_lib_has_unique_object_representations",
+ "values": {
+ "c++17": 201606L,
+ },
+ "headers": ["type_traits"],
+ "depends": "TEST_HAS_BUILTIN_IDENTIFIER(__has_unique_object_representations) || TEST_GCC_VER >= 700",
+ "internal_depends": "defined(_LIBCPP_HAS_UNIQUE_OBJECT_REPRESENTATIONS)",
+ },
+ {"name": "__cpp_lib_is_aggregate",
+ "values": {
+ "c++17": 201703L,
+ },
+ "headers": ["type_traits"],
+ "depends": "TEST_HAS_BUILTIN_IDENTIFIER(__is_aggregate) || TEST_GCC_VER_NEW >= 7001",
+ "internal_depends": "!defined(_LIBCPP_HAS_NO_IS_AGGREGATE)",
+ },
+ {"name": "__cpp_lib_chrono",
+ "values": {
+ "c++17": 201611L,
+ },
+ "headers": ["chrono"],
+ },
+ {"name": "__cpp_lib_execution",
+ "values": {
+ "c++17": 201603L,
+ },
+ "headers": ["execution"],
+ "unimplemented": True
+ },
+ {"name": "__cpp_lib_parallel_algorithm",
+ "values": {
+ "c++17": 201603L,
+ },
+ "headers": ["algorithm", "numeric"],
+ "unimplemented": True,
+ },
+ {"name": "__cpp_lib_to_chars",
+ "values": {
+ "c++17": 201611L,
+ },
+ "headers": ["utility"],
+ "unimplemented": True,
+ },
+ {"name": "__cpp_lib_string_view",
+ "values": {
+ "c++17": 201606L,
+ },
+ "headers": ["string", "string_view"],
+ },
+ {"name": "__cpp_lib_allocator_traits_is_always_equal",
+ "values": {
+ "c++17": 201411L,
+ },
+ "headers": ["memory", "scoped_allocator", "string", "deque", "forward_list", "list", "vector", "map", "set", "unordered_map", "unordered_set"],
+ },
+ {"name": "__cpp_lib_incomplete_container_elements",
+ "values": {
+ "c++17": 201505L,
+ },
+ "headers": ["forward_list", "list", "vector"],
+ },
+ {"name": "__cpp_lib_map_try_emplace",
+ "values": {
+ "c++17": 201411L,
+ },
+ "headers": ["map"],
+ },
+ {"name": "__cpp_lib_unordered_map_try_emplace",
+ "values": {
+ "c++17": 201411L,
+ },
+ "headers": ["unordered_map"],
+ },
+ {"name": "__cpp_lib_array_constexpr",
+ "values": {
+ "c++17": 201603L,
+ },
+ "headers": ["iterator", "array"],
+ },
+ {"name": "__cpp_lib_nonmember_container_access",
+ "values": {
+ "c++17": 201411L,
+ },
+ "headers": ["iterator", "array", "deque", "forward_list", "list", "map", "regex",
+ "set", "string", "unordered_map", "unordered_set", "vector"],
+ },
+ {"name": "__cpp_lib_sample",
+ "values": {
+ "c++17": 201603L,
+ },
+ "headers": ["algorithm"],
+ },
+ {"name": "__cpp_lib_clamp",
+ "values": {
+ "c++17": 201603L,
+ },
+ "headers": ["algorithm"],
+ },
+ {"name": "__cpp_lib_gcd_lcm",
+ "values": {
+ "c++17": 201606L,
+ },
+ "headers": ["numeric"],
+ },
+ {"name": "__cpp_lib_hypot",
+ "values": {
+ "c++17": 201603L,
+ },
+ "headers": ["cmath"],
+ },
+ {"name": "__cpp_lib_math_special_functions",
+ "values": {
+ "c++17": 201603L,
+ },
+ "headers": ["cmath"],
+ "unimplemented": True,
+ },
+ {"name": "__cpp_lib_shared_mutex",
+ "values": {
+ "c++17": 201505L,
+ },
+ "headers": ["shared_mutex"],
+ },
+ {"name": "__cpp_lib_scoped_lock",
+ "values": {
+ "c++17": 201703L,
+ },
+ "headers": ["mutex"],
+ },
+ # C++2a
+ {"name": "__cpp_lib_char8_t",
+ "values": {
+ "c++2a": 201811L,
+ },
+ "headers": ["atomic", "filesystem", "istream", "limits", "locale", "ostream",
+ "string", "string_view"],
+ "depends": "defined(__cpp_char8_t)",
+ "internal_depends": "!defined(_LIBCPP_NO_HAS_CHAR8_T)",
+ },
+ {"name": "__cpp_lib_erase_if",
+ "values": {
+ "c++2a": 201811L,
+ },
+ "headers": ["string", "deque", "forward_list", "list", "vector", "map",
+ "set", "unordered_map", "unordered_set"]
+ },
+ {"name": "__cpp_lib_destroying_delete",
+ "values": {
+ "c++2a": 201806L,
+ },
+ "headers": ["new"],
+ "unimplemented": True,
+ },
+ {"name": "__cpp_lib_three_way_comparison",
+ "values": {
+ "c++2a": 201711L,
+ },
+ "headers": ["compare"],
+ "unimplemented": True,
+ },
+ {"name": "__cpp_lib_concepts",
+ "values": {
+ "c++2a": 201806L,
+ },
+ "headers": ["concepts"],
+ "unimplemented": True,
+ },
+ {"name": "__cpp_lib_constexpr_swap_algorithms",
+ "values": {
+ "c++2a": 201806L,
+ },
+ "headers": ["algorithm"],
+ "unimplemented": True,
+ },
+ {"name": "__cpp_lib_constexpr_misc",
+ "values": {
+ "c++2a": 201811L,
+ },
+ "headers": ["array", "functional", "iterator", "string_view", "tuple", "utility"],
+ "unimplemented": True,
+ },
+ {"name": "__cpp_lib_bind_front",
+ "values": {
+ "c++2a": 201811L,
+ },
+ "headers": ["functional"],
+ "unimplemented": True,
+ },
+ {"name": "__cpp_lib_is_constant_evaluated",
+ "values": {
+ "c++2a": 201811L,
+ },
+ "headers": ["type_traits"],
+ "unimplemented": True,
+ },
+ {"name": "__cpp_lib_list_remove_return_type",
+ "values": {
+ "c++2a": 201806L,
+ },
+ "headers": ["forward_list", "list"],
+ "unimplemented": True,
+ },
+ {"name": "__cpp_lib_generic_unordered_lookup",
+ "values": {
+ "c++2a": 201811L,
+ },
+ "headers": ["unordered_map", "unordered_set"],
+ "unimplemented": True,
+ },
+ {"name": "__cpp_lib_ranges",
+ "values": {
+ "c++2a": 201811L,
+ },
+ "headers": ["algorithm", "functional", "iterator", "memory", "ranges"],
+ "unimplemented": True,
+ },
+ {"name": "__cpp_lib_bit_cast",
+ "values": {
+ "c++2a": 201806L,
+ },
+ "headers": ["bit"],
+ "unimplemented": True,
+ },
+ {"name": "__cpp_lib_atomic_ref",
+ "values": {
+ "c++2a": 201806L,
+ },
+ "headers": ["atomic"],
+ "unimplemented": True,
+ },
+]], key=lambda tc: tc["name"])
+
+def get_std_dialects():
+ std_dialects = ['c++14', 'c++17', 'c++2a']
+ return list(std_dialects)
+
+def get_first_std(d):
+ for s in get_std_dialects():
+ if s in d.keys():
+ return s
+ return None
+
+def get_last_std(d):
+ rev_dialects = get_std_dialects()
+ rev_dialects.reverse()
+ for s in rev_dialects:
+ if s in d.keys():
+ return s
+ return None
+
+def get_std_before(d, std):
+ std_dialects = get_std_dialects()
+ candidates = std_dialects[0:std_dialects.index(std)]
+ candidates.reverse()
+ for cand in candidates:
+ if cand in d.keys():
+ return cand
+ return None
+
+def get_value_before(d, std):
+ new_std = get_std_before(d, std)
+ if new_std is None:
+ return None
+ return d[new_std]
+
+def get_for_std(d, std):
+ # This catches the C++11 case for which there should be no defined feature
+ # test macros.
+ std_dialects = get_std_dialects()
+ if std not in std_dialects:
+ return None
+ # Find the value for the newest C++ dialect between C++14 and std
+ std_list = list(std_dialects[0:std_dialects.index(std)+1])
+ std_list.reverse()
+ for s in std_list:
+ if s in d.keys():
+ return d[s]
+ return None
+
+
+"""
+ Functions to produce the <version> header
+"""
+
+def produce_macros_definition_for_std(std):
+ result = ""
+ indent = 56
+ for tc in feature_test_macros:
+ if std not in tc["values"]:
+ continue
+ inner_indent = 1
+ if 'depends' in tc.keys():
+ assert 'internal_depends' in tc.keys()
+ result += "# if %s\n" % tc["internal_depends"]
+ inner_indent += 2
+ if get_value_before(tc["values"], std) is not None:
+ assert 'depends' not in tc.keys()
+ result += "# undef %s\n" % tc["name"]
+ line = "#%sdefine %s" % ((" " * inner_indent), tc["name"])
+ line += " " * (indent - len(line))
+ line += "%sL" % tc["values"][std]
+ if 'unimplemented' in tc.keys():
+ line = "// " + line
+ result += line
+ result += "\n"
+ if 'depends' in tc.keys():
+ result += "# endif\n"
+ return result
+
+def chunks(l, n):
+ """Yield successive n-sized chunks from l."""
+ for i in range(0, len(l), n):
+ yield l[i:i + n]
+
+def produce_version_synopsis():
+ indent = 56
+ header_indent = 56 + len("20XXYYL ")
+ result = ""
+ def indent_to(s, val):
+ if len(s) >= val:
+ return s
+ s += " " * (val - len(s))
+ return s
+ line = indent_to("Macro name", indent) + "Value"
+ line = indent_to(line, header_indent) + "Headers"
+ result += line + "\n"
+ for tc in feature_test_macros:
+ prev_defined_std = get_last_std(tc["values"])
+ line = "{name: <{indent}}{value}L ".format(name=tc['name'], indent=indent,
+ value=tc["values"][prev_defined_std])
+ headers = list(tc["headers"])
+ headers.remove("version")
+ for chunk in chunks(headers, 3):
+ line = indent_to(line, header_indent)
+ chunk = ['<%s>' % header for header in chunk]
+ line += ' '.join(chunk)
+ result += line
+ result += "\n"
+ line = ""
+ while True:
+ prev_defined_std = get_std_before(tc["values"], prev_defined_std)
+ if prev_defined_std is None:
+ break
+ result += "%s%sL // %s\n" % (indent_to("", indent), tc["values"][prev_defined_std],
+ prev_defined_std.replace("c++", "C++"))
+ return result
+
+
+def produce_version_header():
+ template="""// -*- C++ -*-
+//===--------------------------- version ----------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_VERSIONH
+#define _LIBCPP_VERSIONH
+
+/*
+ version synopsis
+
+{synopsis}
+
+*/
+
+#include <__config>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+#if _LIBCPP_STD_VER > 11
+{cxx14_macros}
+#endif
+
+#if _LIBCPP_STD_VER > 14
+{cxx17_macros}
+#endif
+
+#if _LIBCPP_STD_VER > 17
+{cxx2a_macros}
+#endif
+
+#endif // _LIBCPP_VERSIONH
+"""
+ return template.format(
+ synopsis=produce_version_synopsis().strip(),
+ cxx14_macros=produce_macros_definition_for_std('c++14').strip(),
+ cxx17_macros=produce_macros_definition_for_std('c++17').strip(),
+ cxx2a_macros=produce_macros_definition_for_std('c++2a').strip())
+
+"""
+ Functions to produce test files
+"""
+
+test_types = {
+ "undefined": """
+# ifdef {name}
+# error "{name} should not be defined before {std_first}"
+# endif
+""",
+
+ "depends": """
+# if {depends}
+# ifndef {name}
+# error "{name} should be defined in {std}"
+# endif
+# if {name} != {value}
+# error "{name} should have the value {value} in {std}"
+# endif
+# else
+# ifdef {name}
+# error "{name} should not be defined when {depends} is not defined!"
+# endif
+# endif
+""",
+
+ "unimplemented": """
+# if !defined(_LIBCPP_VERSION)
+# ifndef {name}
+# error "{name} should be defined in {std}"
+# endif
+# if {name} != {value}
+# error "{name} should have the value {value} in {std}"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef {name}
+# error "{name} should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+""",
+
+ "defined":"""
+# ifndef {name}
+# error "{name} should be defined in {std}"
+# endif
+# if {name} != {value}
+# error "{name} should have the value {value} in {std}"
+# endif
+"""
+}
+
+def generate_std_test(test_list, std):
+ result = ""
+ for tc in test_list:
+ val = get_for_std(tc["values"], std)
+ if val is not None:
+ val = "%sL" % val
+ if val is None:
+ result += test_types["undefined"].format(name=tc["name"], std_first=get_first_std(tc["values"]))
+ elif 'unimplemented' in tc.keys():
+ result += test_types["unimplemented"].format(name=tc["name"], value=val, std=std)
+ elif "depends" in tc.keys():
+ result += test_types["depends"].format(name=tc["name"], value=val, std=std, depends=tc["depends"])
+ else:
+ result += test_types["defined"].format(name=tc["name"], value=val, std=std)
+ return result
+
+def generate_synopsis(test_list):
+ max_name_len = max([len(tc["name"]) for tc in test_list])
+ indent = max_name_len + 8
+ def mk_line(prefix, suffix):
+ return "{prefix: <{max_len}}{suffix}\n".format(prefix=prefix, suffix=suffix,
+ max_len=indent)
+ result = ""
+ result += mk_line("/* Constant", "Value")
+ for tc in test_list:
+ prefix = " %s" % tc["name"]
+ for std in [s for s in get_std_dialects() if s in tc["values"].keys()]:
+ result += mk_line(prefix, "%sL [%s]" % (tc["values"][std], std.replace("c++", "C++")))
+ prefix = ""
+ result += "*/"
+ return result
+
+def produce_tests():
+ headers = set([h for tc in feature_test_macros for h in tc["headers"]])
+ for h in headers:
+ test_list = [tc for tc in feature_test_macros if h in tc["headers"]]
+ if not has_header(h):
+ for tc in test_list:
+ assert 'unimplemented' in tc.keys()
+ continue
+ test_body = \
+"""//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// WARNING: This test was generated by generate_feature_test_macros_tests.py and
+// should not be edited manually.
+
+// <{header}>
+
+// Test the feature test macros defined by <{header}>
+
+{synopsis}
+
+#include <{header}>
+#include "test_macros.h"
+
+#if TEST_STD_VER < 14
+
+{cxx11_tests}
+
+#elif TEST_STD_VER == 14
+
+{cxx14_tests}
+
+#elif TEST_STD_VER == 17
+
+{cxx17_tests}
+
+#elif TEST_STD_VER > 17
+
+{cxx2a_tests}
+
+#endif // TEST_STD_VER > 17
+
+int main() {{}}
+""".format(header=h,
+ synopsis=generate_synopsis(test_list),
+ cxx11_tests=generate_std_test(test_list, 'c++11').strip(),
+ cxx14_tests=generate_std_test(test_list, 'c++14').strip(),
+ cxx17_tests=generate_std_test(test_list, 'c++17').strip(),
+ cxx2a_tests=generate_std_test(test_list, 'c++2a').strip())
+ test_name = "{header}.version.pass.cpp".format(header=h)
+ out_path = os.path.join(script_path, test_name)
+ with open(out_path, 'w') as f:
+ f.write(test_body)
+
+"""
+ Produce documentation for the feature test macros
+"""
+
+def make_widths(grid):
+ widths = []
+ for i in range(0, len(grid[0])):
+ cell_width = 2 + max(reduce(lambda x,y: x+y, [[len(row[i])] for row in grid], []))
+ widths += [cell_width]
+ return widths
+
+def create_table(grid, indent):
+ indent_str = ' '*indent
+ col_widths = make_widths(grid)
+ num_cols = len(grid[0])
+ result = indent_str + add_divider(col_widths, 2)
+ header_flag = 2
+ for row_i in xrange(0, len(grid)):
+ row = grid[row_i]
+ result = result + indent_str + ' '.join([pad_cell(row[i], col_widths[i]) for i in range(0, len(row))]) + '\n'
+ is_cxx_header = row[0].startswith('**')
+ if row_i == len(grid) - 1:
+ header_flag = 2
+ result = result + indent_str + add_divider(col_widths, 1 if is_cxx_header else header_flag)
+ header_flag = 0
+ return result
+
+def add_divider(widths, header_flag):
+ if header_flag == 2:
+ return ' '.join(['='*w for w in widths]) + '\n'
+ if header_flag == 1:
+ return '-'.join(['-'*w for w in widths]) + '\n'
+ else:
+ return ' '.join(['-'*w for w in widths]) + '\n'
+
+def pad_cell(s, length, left_align=True):
+ padding = ((length - len(s)) * ' ')
+ return s + padding
+
+
+def get_status_table():
+ table = [["Macro Name", "Value"]]
+ for std in get_std_dialects():
+ table += [["**" + std.replace("c++", "C++ ") + "**", ""]]
+ for tc in feature_test_macros:
+ if std not in tc["values"].keys():
+ continue
+ value = "``%sL``" % tc["values"][std]
+ if 'unimplemented' in tc.keys():
+ value = '*unimplemented*'
+ table += [["``%s``" % tc["name"], value]]
+ return table
+
+def produce_docs():
+ doc_str = """.. _FeatureTestMacroTable:
+
+==========================
+Feature Test Macro Support
+==========================
+
+.. contents::
+ :local:
+
+Overview
+========
+
+This file documents the feature test macros currently supported by libc++.
+
+.. _feature-status:
+
+Status
+======
+
+.. table:: Current Status
+ :name: feature-status-table
+ :widths: auto
+
+{status_tables}
+
+""".format(status_tables=create_table(get_status_table(), 4))
+
+ table_doc_path = os.path.join(docs_path, 'FeatureTestMacroTable.rst')
+ with open(table_doc_path, 'w') as f:
+ f.write(doc_str)
+
+def main():
+ with tempfile.NamedTemporaryFile(mode='w', prefix='version.', delete=False) as tmp_file:
+ print("producing new <version> header as %s" % tmp_file.name)
+ tmp_file.write(produce_version_header())
+ produce_tests()
+ produce_docs()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/iomanip.version.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/iomanip.version.pass.cpp
index 74ab48e3ca9..f82e5ba046f 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/iomanip.version.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/iomanip.version.pass.cpp
@@ -1,4 +1,3 @@
-
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
@@ -8,26 +7,53 @@
//
//===----------------------------------------------------------------------===//
//
-// <iomanip> feature macros
+// WARNING: This test was generated by generate_feature_test_macros_tests.py and
+// should not be edited manually.
+
+// <iomanip>
-/* Constant Value
- __cpp_lib_quoted_string_io 201304L
+// Test the feature test macros defined by <iomanip>
+/* Constant Value
+ __cpp_lib_quoted_string_io 201304L [C++14]
*/
#include <iomanip>
-#include <cassert>
#include "test_macros.h"
-int main()
-{
-// ensure that the macros that are supposed to be defined in <iomanip> are defined.
+#if TEST_STD_VER < 14
-/*
-#if !defined(__cpp_lib_fooby)
-# error "__cpp_lib_fooby is not defined"
-#elif __cpp_lib_fooby < 201606L
-# error "__cpp_lib_fooby has an invalid value"
-#endif
-*/
-}
+# ifdef __cpp_lib_quoted_string_io
+# error "__cpp_lib_quoted_string_io should not be defined before c++14"
+# endif
+
+#elif TEST_STD_VER == 14
+
+# ifndef __cpp_lib_quoted_string_io
+# error "__cpp_lib_quoted_string_io should be defined in c++14"
+# endif
+# if __cpp_lib_quoted_string_io != 201304L
+# error "__cpp_lib_quoted_string_io should have the value 201304L in c++14"
+# endif
+
+#elif TEST_STD_VER == 17
+
+# ifndef __cpp_lib_quoted_string_io
+# error "__cpp_lib_quoted_string_io should be defined in c++17"
+# endif
+# if __cpp_lib_quoted_string_io != 201304L
+# error "__cpp_lib_quoted_string_io should have the value 201304L in c++17"
+# endif
+
+#elif TEST_STD_VER > 17
+
+# ifndef __cpp_lib_quoted_string_io
+# error "__cpp_lib_quoted_string_io should be defined in c++2a"
+# endif
+# if __cpp_lib_quoted_string_io != 201304L
+# error "__cpp_lib_quoted_string_io should have the value 201304L in c++2a"
+# endif
+
+#endif // TEST_STD_VER > 17
+
+int main() {}
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/istream.version.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/istream.version.pass.cpp
index 7ede323ca5a..195ca2d0b00 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/istream.version.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/istream.version.pass.cpp
@@ -1,4 +1,3 @@
-
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
@@ -8,36 +7,53 @@
//
//===----------------------------------------------------------------------===//
//
-// <istream> feature macros
+// WARNING: This test was generated by generate_feature_test_macros_tests.py and
+// should not be edited manually.
+
+// <istream>
-/* Constant Value
- __cpp_lib_char8_t 201811L
+// Test the feature test macros defined by <istream>
+/* Constant Value
+ __cpp_lib_char8_t 201811L [C++2a]
*/
#include <istream>
-#include <cassert>
#include "test_macros.h"
-int main()
-{
-// ensure that the macros that are supposed to be defined in <istream> are defined.
+#if TEST_STD_VER < 14
+
+# ifdef __cpp_lib_char8_t
+# error "__cpp_lib_char8_t should not be defined before c++2a"
+# endif
+
+#elif TEST_STD_VER == 14
+
+# ifdef __cpp_lib_char8_t
+# error "__cpp_lib_char8_t should not be defined before c++2a"
+# endif
+
+#elif TEST_STD_VER == 17
+
+# ifdef __cpp_lib_char8_t
+# error "__cpp_lib_char8_t should not be defined before c++2a"
+# endif
+
+#elif TEST_STD_VER > 17
-#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
-# if !defined(__cpp_lib_char8_t)
- LIBCPP_STATIC_ASSERT(false, "__cpp_lib_char8_t is not defined");
+# if defined(__cpp_char8_t)
+# ifndef __cpp_lib_char8_t
+# error "__cpp_lib_char8_t should be defined in c++2a"
+# endif
+# if __cpp_lib_char8_t != 201811L
+# error "__cpp_lib_char8_t should have the value 201811L in c++2a"
+# endif
# else
-# if __cpp_lib_char8_t < 201811L
-# error "__cpp_lib_char8_t has an invalid value"
-# endif
+# ifdef __cpp_lib_char8_t
+# error "__cpp_lib_char8_t should not be defined when defined(__cpp_char8_t) is not defined!"
+# endif
# endif
-#endif
-
-/*
-#if !defined(__cpp_lib_fooby)
-# error "__cpp_lib_fooby is not defined"
-#elif __cpp_lib_fooby < 201606L
-# error "__cpp_lib_fooby has an invalid value"
-#endif
-*/
-}
+
+#endif // TEST_STD_VER > 17
+
+int main() {}
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/iterator.version.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/iterator.version.pass.cpp
index 50c582fd857..7113bd3ae64 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/iterator.version.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/iterator.version.pass.cpp
@@ -1,4 +1,3 @@
-
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
@@ -8,29 +7,177 @@
//
//===----------------------------------------------------------------------===//
//
-// <iterator> feature macros
+// WARNING: This test was generated by generate_feature_test_macros_tests.py and
+// should not be edited manually.
+
+// <iterator>
-/* Constant Value
- __cpp_lib_array_constexpr 201603L
- __cpp_lib_make_reverse_iterator 201402L
- __cpp_lib_nonmember_container_access 201411L
- __cpp_lib_null_iterators 201304L
+// Test the feature test macros defined by <iterator>
+/* Constant Value
+ __cpp_lib_array_constexpr 201603L [C++17]
+ __cpp_lib_constexpr_misc 201811L [C++2a]
+ __cpp_lib_make_reverse_iterator 201402L [C++14]
+ __cpp_lib_nonmember_container_access 201411L [C++17]
+ __cpp_lib_null_iterators 201304L [C++14]
+ __cpp_lib_ranges 201811L [C++2a]
*/
#include <iterator>
-#include <cassert>
#include "test_macros.h"
-int main()
-{
-// ensure that the macros that are supposed to be defined in <iterator> are defined.
+#if TEST_STD_VER < 14
-/*
-#if !defined(__cpp_lib_fooby)
-# error "__cpp_lib_fooby is not defined"
-#elif __cpp_lib_fooby < 201606L
-# error "__cpp_lib_fooby has an invalid value"
-#endif
-*/
-}
+# ifdef __cpp_lib_array_constexpr
+# error "__cpp_lib_array_constexpr should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_constexpr_misc
+# error "__cpp_lib_constexpr_misc should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_make_reverse_iterator
+# error "__cpp_lib_make_reverse_iterator should not be defined before c++14"
+# endif
+
+# ifdef __cpp_lib_nonmember_container_access
+# error "__cpp_lib_nonmember_container_access should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_null_iterators
+# error "__cpp_lib_null_iterators should not be defined before c++14"
+# endif
+
+# ifdef __cpp_lib_ranges
+# error "__cpp_lib_ranges should not be defined before c++2a"
+# endif
+
+#elif TEST_STD_VER == 14
+
+# ifdef __cpp_lib_array_constexpr
+# error "__cpp_lib_array_constexpr should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_constexpr_misc
+# error "__cpp_lib_constexpr_misc should not be defined before c++2a"
+# endif
+
+# ifndef __cpp_lib_make_reverse_iterator
+# error "__cpp_lib_make_reverse_iterator should be defined in c++14"
+# endif
+# if __cpp_lib_make_reverse_iterator != 201402L
+# error "__cpp_lib_make_reverse_iterator should have the value 201402L in c++14"
+# endif
+
+# ifdef __cpp_lib_nonmember_container_access
+# error "__cpp_lib_nonmember_container_access should not be defined before c++17"
+# endif
+
+# ifndef __cpp_lib_null_iterators
+# error "__cpp_lib_null_iterators should be defined in c++14"
+# endif
+# if __cpp_lib_null_iterators != 201304L
+# error "__cpp_lib_null_iterators should have the value 201304L in c++14"
+# endif
+
+# ifdef __cpp_lib_ranges
+# error "__cpp_lib_ranges should not be defined before c++2a"
+# endif
+
+#elif TEST_STD_VER == 17
+
+# ifndef __cpp_lib_array_constexpr
+# error "__cpp_lib_array_constexpr should be defined in c++17"
+# endif
+# if __cpp_lib_array_constexpr != 201603L
+# error "__cpp_lib_array_constexpr should have the value 201603L in c++17"
+# endif
+
+# ifdef __cpp_lib_constexpr_misc
+# error "__cpp_lib_constexpr_misc should not be defined before c++2a"
+# endif
+
+# ifndef __cpp_lib_make_reverse_iterator
+# error "__cpp_lib_make_reverse_iterator should be defined in c++17"
+# endif
+# if __cpp_lib_make_reverse_iterator != 201402L
+# error "__cpp_lib_make_reverse_iterator should have the value 201402L in c++17"
+# endif
+
+# ifndef __cpp_lib_nonmember_container_access
+# error "__cpp_lib_nonmember_container_access should be defined in c++17"
+# endif
+# if __cpp_lib_nonmember_container_access != 201411L
+# error "__cpp_lib_nonmember_container_access should have the value 201411L in c++17"
+# endif
+
+# ifndef __cpp_lib_null_iterators
+# error "__cpp_lib_null_iterators should be defined in c++17"
+# endif
+# if __cpp_lib_null_iterators != 201304L
+# error "__cpp_lib_null_iterators should have the value 201304L in c++17"
+# endif
+
+# ifdef __cpp_lib_ranges
+# error "__cpp_lib_ranges should not be defined before c++2a"
+# endif
+
+#elif TEST_STD_VER > 17
+
+# ifndef __cpp_lib_array_constexpr
+# error "__cpp_lib_array_constexpr should be defined in c++2a"
+# endif
+# if __cpp_lib_array_constexpr != 201603L
+# error "__cpp_lib_array_constexpr should have the value 201603L in c++2a"
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_constexpr_misc
+# error "__cpp_lib_constexpr_misc should be defined in c++2a"
+# endif
+# if __cpp_lib_constexpr_misc != 201811L
+# error "__cpp_lib_constexpr_misc should have the value 201811L in c++2a"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_constexpr_misc
+# error "__cpp_lib_constexpr_misc should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+# ifndef __cpp_lib_make_reverse_iterator
+# error "__cpp_lib_make_reverse_iterator should be defined in c++2a"
+# endif
+# if __cpp_lib_make_reverse_iterator != 201402L
+# error "__cpp_lib_make_reverse_iterator should have the value 201402L in c++2a"
+# endif
+
+# ifndef __cpp_lib_nonmember_container_access
+# error "__cpp_lib_nonmember_container_access should be defined in c++2a"
+# endif
+# if __cpp_lib_nonmember_container_access != 201411L
+# error "__cpp_lib_nonmember_container_access should have the value 201411L in c++2a"
+# endif
+
+# ifndef __cpp_lib_null_iterators
+# error "__cpp_lib_null_iterators should be defined in c++2a"
+# endif
+# if __cpp_lib_null_iterators != 201304L
+# error "__cpp_lib_null_iterators should have the value 201304L in c++2a"
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_ranges
+# error "__cpp_lib_ranges should be defined in c++2a"
+# endif
+# if __cpp_lib_ranges != 201811L
+# error "__cpp_lib_ranges should have the value 201811L in c++2a"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_ranges
+# error "__cpp_lib_ranges should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+#endif // TEST_STD_VER > 17
+
+int main() {}
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/limits.version.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/limits.version.pass.cpp
index 7f18692370b..91f0d7cedc7 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/limits.version.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/limits.version.pass.cpp
@@ -1,4 +1,3 @@
-
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
@@ -8,36 +7,53 @@
//
//===----------------------------------------------------------------------===//
//
-// <limits> feature macros
+// WARNING: This test was generated by generate_feature_test_macros_tests.py and
+// should not be edited manually.
+
+// <limits>
-/* Constant Value
- __cpp_lib_char8_t 201811L
+// Test the feature test macros defined by <limits>
+/* Constant Value
+ __cpp_lib_char8_t 201811L [C++2a]
*/
#include <limits>
-#include <cassert>
#include "test_macros.h"
-int main()
-{
-// ensure that the macros that are supposed to be defined in <limits> are defined.
+#if TEST_STD_VER < 14
+
+# ifdef __cpp_lib_char8_t
+# error "__cpp_lib_char8_t should not be defined before c++2a"
+# endif
+
+#elif TEST_STD_VER == 14
+
+# ifdef __cpp_lib_char8_t
+# error "__cpp_lib_char8_t should not be defined before c++2a"
+# endif
+
+#elif TEST_STD_VER == 17
+
+# ifdef __cpp_lib_char8_t
+# error "__cpp_lib_char8_t should not be defined before c++2a"
+# endif
+
+#elif TEST_STD_VER > 17
-#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
-# if !defined(__cpp_lib_char8_t)
- LIBCPP_STATIC_ASSERT(false, "__cpp_lib_char8_t is not defined");
+# if defined(__cpp_char8_t)
+# ifndef __cpp_lib_char8_t
+# error "__cpp_lib_char8_t should be defined in c++2a"
+# endif
+# if __cpp_lib_char8_t != 201811L
+# error "__cpp_lib_char8_t should have the value 201811L in c++2a"
+# endif
# else
-# if __cpp_lib_char8_t < 201811L
-# error "__cpp_lib_char8_t has an invalid value"
-# endif
+# ifdef __cpp_lib_char8_t
+# error "__cpp_lib_char8_t should not be defined when defined(__cpp_char8_t) is not defined!"
+# endif
# endif
-#endif
-
-/*
-#if !defined(__cpp_lib_fooby)
-# error "__cpp_lib_fooby is not defined"
-#elif __cpp_lib_fooby < 201606L
-# error "__cpp_lib_fooby has an invalid value"
-#endif
-*/
-}
+
+#endif // TEST_STD_VER > 17
+
+int main() {}
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/list.version.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/list.version.pass.cpp
index e6e65655b92..12e683f263f 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/list.version.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/list.version.pass.cpp
@@ -1,4 +1,3 @@
-
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
@@ -8,40 +7,142 @@
//
//===----------------------------------------------------------------------===//
//
-// <list> feature macros
+// WARNING: This test was generated by generate_feature_test_macros_tests.py and
+// should not be edited manually.
+
+// <list>
-/* Constant Value
- __cpp_lib_allocator_traits_is_always_equal 201411L
- __cpp_lib_erase_if 201811L
- __cpp_lib_incomplete_container_elements 201505L
- __cpp_lib_list_remove_return_type 201806L
- __cpp_lib_nonmember_container_access 201411L
+// Test the feature test macros defined by <list>
+/* Constant Value
+ __cpp_lib_allocator_traits_is_always_equal 201411L [C++17]
+ __cpp_lib_erase_if 201811L [C++2a]
+ __cpp_lib_incomplete_container_elements 201505L [C++17]
+ __cpp_lib_list_remove_return_type 201806L [C++2a]
+ __cpp_lib_nonmember_container_access 201411L [C++17]
*/
#include <list>
-#include <cassert>
#include "test_macros.h"
-int main()
-{
-// ensure that the macros that are supposed to be defined in <list> are defined.
-
-#if TEST_STD_VER > 17
-# if !defined(__cpp_lib_erase_if)
- LIBCPP_STATIC_ASSERT(false, "__cpp_lib_erase_if is not defined");
-# else
-# if __cpp_lib_erase_if < 201811L
-# error "__cpp_lib_erase_if has an invalid value"
-# endif
-# endif
-#endif
-
-/*
-#if !defined(__cpp_lib_fooby)
-# error "__cpp_lib_fooby is not defined"
-#elif __cpp_lib_fooby < 201606L
-# error "__cpp_lib_fooby has an invalid value"
-#endif
-*/
-}
+#if TEST_STD_VER < 14
+
+# ifdef __cpp_lib_allocator_traits_is_always_equal
+# error "__cpp_lib_allocator_traits_is_always_equal should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_erase_if
+# error "__cpp_lib_erase_if should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_incomplete_container_elements
+# error "__cpp_lib_incomplete_container_elements should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_list_remove_return_type
+# error "__cpp_lib_list_remove_return_type should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_nonmember_container_access
+# error "__cpp_lib_nonmember_container_access should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 14
+
+# ifdef __cpp_lib_allocator_traits_is_always_equal
+# error "__cpp_lib_allocator_traits_is_always_equal should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_erase_if
+# error "__cpp_lib_erase_if should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_incomplete_container_elements
+# error "__cpp_lib_incomplete_container_elements should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_list_remove_return_type
+# error "__cpp_lib_list_remove_return_type should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_nonmember_container_access
+# error "__cpp_lib_nonmember_container_access should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 17
+
+# ifndef __cpp_lib_allocator_traits_is_always_equal
+# error "__cpp_lib_allocator_traits_is_always_equal should be defined in c++17"
+# endif
+# if __cpp_lib_allocator_traits_is_always_equal != 201411L
+# error "__cpp_lib_allocator_traits_is_always_equal should have the value 201411L in c++17"
+# endif
+
+# ifdef __cpp_lib_erase_if
+# error "__cpp_lib_erase_if should not be defined before c++2a"
+# endif
+
+# ifndef __cpp_lib_incomplete_container_elements
+# error "__cpp_lib_incomplete_container_elements should be defined in c++17"
+# endif
+# if __cpp_lib_incomplete_container_elements != 201505L
+# error "__cpp_lib_incomplete_container_elements should have the value 201505L in c++17"
+# endif
+
+# ifdef __cpp_lib_list_remove_return_type
+# error "__cpp_lib_list_remove_return_type should not be defined before c++2a"
+# endif
+
+# ifndef __cpp_lib_nonmember_container_access
+# error "__cpp_lib_nonmember_container_access should be defined in c++17"
+# endif
+# if __cpp_lib_nonmember_container_access != 201411L
+# error "__cpp_lib_nonmember_container_access should have the value 201411L in c++17"
+# endif
+
+#elif TEST_STD_VER > 17
+
+# ifndef __cpp_lib_allocator_traits_is_always_equal
+# error "__cpp_lib_allocator_traits_is_always_equal should be defined in c++2a"
+# endif
+# if __cpp_lib_allocator_traits_is_always_equal != 201411L
+# error "__cpp_lib_allocator_traits_is_always_equal should have the value 201411L in c++2a"
+# endif
+
+# ifndef __cpp_lib_erase_if
+# error "__cpp_lib_erase_if should be defined in c++2a"
+# endif
+# if __cpp_lib_erase_if != 201811L
+# error "__cpp_lib_erase_if should have the value 201811L in c++2a"
+# endif
+
+# ifndef __cpp_lib_incomplete_container_elements
+# error "__cpp_lib_incomplete_container_elements should be defined in c++2a"
+# endif
+# if __cpp_lib_incomplete_container_elements != 201505L
+# error "__cpp_lib_incomplete_container_elements should have the value 201505L in c++2a"
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_list_remove_return_type
+# error "__cpp_lib_list_remove_return_type should be defined in c++2a"
+# endif
+# if __cpp_lib_list_remove_return_type != 201806L
+# error "__cpp_lib_list_remove_return_type should have the value 201806L in c++2a"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_list_remove_return_type
+# error "__cpp_lib_list_remove_return_type should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+# ifndef __cpp_lib_nonmember_container_access
+# error "__cpp_lib_nonmember_container_access should be defined in c++2a"
+# endif
+# if __cpp_lib_nonmember_container_access != 201411L
+# error "__cpp_lib_nonmember_container_access should have the value 201411L in c++2a"
+# endif
+
+#endif // TEST_STD_VER > 17
+
+int main() {}
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/locale.version.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/locale.version.pass.cpp
index 60227332987..e77aa71068a 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/locale.version.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/locale.version.pass.cpp
@@ -1,4 +1,3 @@
-
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
@@ -8,36 +7,53 @@
//
//===----------------------------------------------------------------------===//
//
-// <locale> feature macros
+// WARNING: This test was generated by generate_feature_test_macros_tests.py and
+// should not be edited manually.
+
+// <locale>
-/* Constant Value
- __cpp_lib_char8_t 201811L
+// Test the feature test macros defined by <locale>
+/* Constant Value
+ __cpp_lib_char8_t 201811L [C++2a]
*/
#include <locale>
-#include <cassert>
#include "test_macros.h"
-int main()
-{
-// ensure that the macros that are supposed to be defined in <locale> are defined.
+#if TEST_STD_VER < 14
+
+# ifdef __cpp_lib_char8_t
+# error "__cpp_lib_char8_t should not be defined before c++2a"
+# endif
+
+#elif TEST_STD_VER == 14
+
+# ifdef __cpp_lib_char8_t
+# error "__cpp_lib_char8_t should not be defined before c++2a"
+# endif
+
+#elif TEST_STD_VER == 17
+
+# ifdef __cpp_lib_char8_t
+# error "__cpp_lib_char8_t should not be defined before c++2a"
+# endif
+
+#elif TEST_STD_VER > 17
-#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
-# if !defined(__cpp_lib_char8_t)
- LIBCPP_STATIC_ASSERT(false, "__cpp_lib_char8_t is not defined");
+# if defined(__cpp_char8_t)
+# ifndef __cpp_lib_char8_t
+# error "__cpp_lib_char8_t should be defined in c++2a"
+# endif
+# if __cpp_lib_char8_t != 201811L
+# error "__cpp_lib_char8_t should have the value 201811L in c++2a"
+# endif
# else
-# if __cpp_lib_char8_t < 201811L
-# error "__cpp_lib_char8_t has an invalid value"
-# endif
+# ifdef __cpp_lib_char8_t
+# error "__cpp_lib_char8_t should not be defined when defined(__cpp_char8_t) is not defined!"
+# endif
# endif
-#endif
-
-/*
-#if !defined(__cpp_lib_fooby)
-# error "__cpp_lib_fooby is not defined"
-#elif __cpp_lib_fooby < 201606L
-# error "__cpp_lib_fooby has an invalid value"
-#endif
-*/
-}
+
+#endif // TEST_STD_VER > 17
+
+int main() {}
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/map.version.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/map.version.pass.cpp
index e7dbf7d20f0..31ef16061d1 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/map.version.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/map.version.pass.cpp
@@ -1,4 +1,3 @@
-
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
@@ -8,41 +7,165 @@
//
//===----------------------------------------------------------------------===//
//
-// <map> feature macros
+// WARNING: This test was generated by generate_feature_test_macros_tests.py and
+// should not be edited manually.
+
+// <map>
-/* Constant Value
- __cpp_lib_allocator_traits_is_always_equal 201411L
- __cpp_lib_erase_if 201811L
- __cpp_lib_generic_associative_lookup 201304L
- __cpp_lib_map_try_emplace 201411L
- __cpp_lib_node_extract 201606L
- __cpp_lib_nonmember_container_access 201411L
+// Test the feature test macros defined by <map>
+/* Constant Value
+ __cpp_lib_allocator_traits_is_always_equal 201411L [C++17]
+ __cpp_lib_erase_if 201811L [C++2a]
+ __cpp_lib_generic_associative_lookup 201304L [C++14]
+ __cpp_lib_map_try_emplace 201411L [C++17]
+ __cpp_lib_node_extract 201606L [C++17]
+ __cpp_lib_nonmember_container_access 201411L [C++17]
*/
#include <map>
-#include <cassert>
#include "test_macros.h"
-int main()
-{
-// ensure that the macros that are supposed to be defined in <map> are defined.
-
-#if TEST_STD_VER > 17
-# if !defined(__cpp_lib_erase_if)
- LIBCPP_STATIC_ASSERT(false, "__cpp_lib_erase_if is not defined");
-# else
-# if __cpp_lib_erase_if < 201811L
-# error "__cpp_lib_erase_if has an invalid value"
-# endif
-# endif
-#endif
-
-/*
-#if !defined(__cpp_lib_fooby)
-# error "__cpp_lib_fooby is not defined"
-#elif __cpp_lib_fooby < 201606L
-# error "__cpp_lib_fooby has an invalid value"
-#endif
-*/
-}
+#if TEST_STD_VER < 14
+
+# ifdef __cpp_lib_allocator_traits_is_always_equal
+# error "__cpp_lib_allocator_traits_is_always_equal should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_erase_if
+# error "__cpp_lib_erase_if should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_generic_associative_lookup
+# error "__cpp_lib_generic_associative_lookup should not be defined before c++14"
+# endif
+
+# ifdef __cpp_lib_map_try_emplace
+# error "__cpp_lib_map_try_emplace should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_node_extract
+# error "__cpp_lib_node_extract should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_nonmember_container_access
+# error "__cpp_lib_nonmember_container_access should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 14
+
+# ifdef __cpp_lib_allocator_traits_is_always_equal
+# error "__cpp_lib_allocator_traits_is_always_equal should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_erase_if
+# error "__cpp_lib_erase_if should not be defined before c++2a"
+# endif
+
+# ifndef __cpp_lib_generic_associative_lookup
+# error "__cpp_lib_generic_associative_lookup should be defined in c++14"
+# endif
+# if __cpp_lib_generic_associative_lookup != 201304L
+# error "__cpp_lib_generic_associative_lookup should have the value 201304L in c++14"
+# endif
+
+# ifdef __cpp_lib_map_try_emplace
+# error "__cpp_lib_map_try_emplace should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_node_extract
+# error "__cpp_lib_node_extract should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_nonmember_container_access
+# error "__cpp_lib_nonmember_container_access should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 17
+
+# ifndef __cpp_lib_allocator_traits_is_always_equal
+# error "__cpp_lib_allocator_traits_is_always_equal should be defined in c++17"
+# endif
+# if __cpp_lib_allocator_traits_is_always_equal != 201411L
+# error "__cpp_lib_allocator_traits_is_always_equal should have the value 201411L in c++17"
+# endif
+
+# ifdef __cpp_lib_erase_if
+# error "__cpp_lib_erase_if should not be defined before c++2a"
+# endif
+
+# ifndef __cpp_lib_generic_associative_lookup
+# error "__cpp_lib_generic_associative_lookup should be defined in c++17"
+# endif
+# if __cpp_lib_generic_associative_lookup != 201304L
+# error "__cpp_lib_generic_associative_lookup should have the value 201304L in c++17"
+# endif
+
+# ifndef __cpp_lib_map_try_emplace
+# error "__cpp_lib_map_try_emplace should be defined in c++17"
+# endif
+# if __cpp_lib_map_try_emplace != 201411L
+# error "__cpp_lib_map_try_emplace should have the value 201411L in c++17"
+# endif
+
+# ifndef __cpp_lib_node_extract
+# error "__cpp_lib_node_extract should be defined in c++17"
+# endif
+# if __cpp_lib_node_extract != 201606L
+# error "__cpp_lib_node_extract should have the value 201606L in c++17"
+# endif
+
+# ifndef __cpp_lib_nonmember_container_access
+# error "__cpp_lib_nonmember_container_access should be defined in c++17"
+# endif
+# if __cpp_lib_nonmember_container_access != 201411L
+# error "__cpp_lib_nonmember_container_access should have the value 201411L in c++17"
+# endif
+
+#elif TEST_STD_VER > 17
+
+# ifndef __cpp_lib_allocator_traits_is_always_equal
+# error "__cpp_lib_allocator_traits_is_always_equal should be defined in c++2a"
+# endif
+# if __cpp_lib_allocator_traits_is_always_equal != 201411L
+# error "__cpp_lib_allocator_traits_is_always_equal should have the value 201411L in c++2a"
+# endif
+
+# ifndef __cpp_lib_erase_if
+# error "__cpp_lib_erase_if should be defined in c++2a"
+# endif
+# if __cpp_lib_erase_if != 201811L
+# error "__cpp_lib_erase_if should have the value 201811L in c++2a"
+# endif
+
+# ifndef __cpp_lib_generic_associative_lookup
+# error "__cpp_lib_generic_associative_lookup should be defined in c++2a"
+# endif
+# if __cpp_lib_generic_associative_lookup != 201304L
+# error "__cpp_lib_generic_associative_lookup should have the value 201304L in c++2a"
+# endif
+
+# ifndef __cpp_lib_map_try_emplace
+# error "__cpp_lib_map_try_emplace should be defined in c++2a"
+# endif
+# if __cpp_lib_map_try_emplace != 201411L
+# error "__cpp_lib_map_try_emplace should have the value 201411L in c++2a"
+# endif
+
+# ifndef __cpp_lib_node_extract
+# error "__cpp_lib_node_extract should be defined in c++2a"
+# endif
+# if __cpp_lib_node_extract != 201606L
+# error "__cpp_lib_node_extract should have the value 201606L in c++2a"
+# endif
+
+# ifndef __cpp_lib_nonmember_container_access
+# error "__cpp_lib_nonmember_container_access should be defined in c++2a"
+# endif
+# if __cpp_lib_nonmember_container_access != 201411L
+# error "__cpp_lib_nonmember_container_access should have the value 201411L in c++2a"
+# endif
+
+#endif // TEST_STD_VER > 17
+
+int main() {}
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/memory.version.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/memory.version.pass.cpp
index 4ffb7bd80dc..4780a1f7070 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/memory.version.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/memory.version.pass.cpp
@@ -1,4 +1,3 @@
-
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
@@ -8,33 +7,241 @@
//
//===----------------------------------------------------------------------===//
//
-// <memory> feature macros
-
-/* Constant Value
- __cpp_lib_addressof_constexpr 201603L
- __cpp_lib_allocator_traits_is_always_equal 201411L
- __cpp_lib_enable_shared_from_this 201603L
- __cpp_lib_make_unique 201304L
- __cpp_lib_raw_memory_algorithms 201606L
- __cpp_lib_shared_ptr_arrays 201611L
- __cpp_lib_shared_ptr_weak_type 201606L
- __cpp_lib_transparent_operators 201510L
+// WARNING: This test was generated by generate_feature_test_macros_tests.py and
+// should not be edited manually.
+
+// <memory>
+
+// Test the feature test macros defined by <memory>
+/* Constant Value
+ __cpp_lib_addressof_constexpr 201603L [C++17]
+ __cpp_lib_allocator_traits_is_always_equal 201411L [C++17]
+ __cpp_lib_enable_shared_from_this 201603L [C++17]
+ __cpp_lib_make_unique 201304L [C++14]
+ __cpp_lib_ranges 201811L [C++2a]
+ __cpp_lib_raw_memory_algorithms 201606L [C++17]
+ __cpp_lib_shared_ptr_arrays 201611L [C++17]
+ __cpp_lib_shared_ptr_weak_type 201606L [C++17]
*/
#include <memory>
-#include <cassert>
#include "test_macros.h"
-int main()
-{
-// ensure that the macros that are supposed to be defined in <memory> are defined.
+#if TEST_STD_VER < 14
-/*
-#if !defined(__cpp_lib_fooby)
-# error "__cpp_lib_fooby is not defined"
-#elif __cpp_lib_fooby < 201606L
-# error "__cpp_lib_fooby has an invalid value"
-#endif
-*/
-}
+# ifdef __cpp_lib_addressof_constexpr
+# error "__cpp_lib_addressof_constexpr should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_allocator_traits_is_always_equal
+# error "__cpp_lib_allocator_traits_is_always_equal should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_enable_shared_from_this
+# error "__cpp_lib_enable_shared_from_this should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_make_unique
+# error "__cpp_lib_make_unique should not be defined before c++14"
+# endif
+
+# ifdef __cpp_lib_ranges
+# error "__cpp_lib_ranges should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_raw_memory_algorithms
+# error "__cpp_lib_raw_memory_algorithms should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_shared_ptr_arrays
+# error "__cpp_lib_shared_ptr_arrays should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_shared_ptr_weak_type
+# error "__cpp_lib_shared_ptr_weak_type should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 14
+
+# ifdef __cpp_lib_addressof_constexpr
+# error "__cpp_lib_addressof_constexpr should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_allocator_traits_is_always_equal
+# error "__cpp_lib_allocator_traits_is_always_equal should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_enable_shared_from_this
+# error "__cpp_lib_enable_shared_from_this should not be defined before c++17"
+# endif
+
+# ifndef __cpp_lib_make_unique
+# error "__cpp_lib_make_unique should be defined in c++14"
+# endif
+# if __cpp_lib_make_unique != 201304L
+# error "__cpp_lib_make_unique should have the value 201304L in c++14"
+# endif
+
+# ifdef __cpp_lib_ranges
+# error "__cpp_lib_ranges should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_raw_memory_algorithms
+# error "__cpp_lib_raw_memory_algorithms should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_shared_ptr_arrays
+# error "__cpp_lib_shared_ptr_arrays should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_shared_ptr_weak_type
+# error "__cpp_lib_shared_ptr_weak_type should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 17
+
+# if TEST_HAS_BUILTIN(__builtin_addressof) || TEST_GCC_VER >= 700
+# ifndef __cpp_lib_addressof_constexpr
+# error "__cpp_lib_addressof_constexpr should be defined in c++17"
+# endif
+# if __cpp_lib_addressof_constexpr != 201603L
+# error "__cpp_lib_addressof_constexpr should have the value 201603L in c++17"
+# endif
+# else
+# ifdef __cpp_lib_addressof_constexpr
+# error "__cpp_lib_addressof_constexpr should not be defined when TEST_HAS_BUILTIN(__builtin_addressof) || TEST_GCC_VER >= 700 is not defined!"
+# endif
+# endif
+
+# ifndef __cpp_lib_allocator_traits_is_always_equal
+# error "__cpp_lib_allocator_traits_is_always_equal should be defined in c++17"
+# endif
+# if __cpp_lib_allocator_traits_is_always_equal != 201411L
+# error "__cpp_lib_allocator_traits_is_always_equal should have the value 201411L in c++17"
+# endif
+
+# ifndef __cpp_lib_enable_shared_from_this
+# error "__cpp_lib_enable_shared_from_this should be defined in c++17"
+# endif
+# if __cpp_lib_enable_shared_from_this != 201603L
+# error "__cpp_lib_enable_shared_from_this should have the value 201603L in c++17"
+# endif
+
+# ifndef __cpp_lib_make_unique
+# error "__cpp_lib_make_unique should be defined in c++17"
+# endif
+# if __cpp_lib_make_unique != 201304L
+# error "__cpp_lib_make_unique should have the value 201304L in c++17"
+# endif
+
+# ifdef __cpp_lib_ranges
+# error "__cpp_lib_ranges should not be defined before c++2a"
+# endif
+
+# ifndef __cpp_lib_raw_memory_algorithms
+# error "__cpp_lib_raw_memory_algorithms should be defined in c++17"
+# endif
+# if __cpp_lib_raw_memory_algorithms != 201606L
+# error "__cpp_lib_raw_memory_algorithms should have the value 201606L in c++17"
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_shared_ptr_arrays
+# error "__cpp_lib_shared_ptr_arrays should be defined in c++17"
+# endif
+# if __cpp_lib_shared_ptr_arrays != 201611L
+# error "__cpp_lib_shared_ptr_arrays should have the value 201611L in c++17"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_shared_ptr_arrays
+# error "__cpp_lib_shared_ptr_arrays should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+# ifndef __cpp_lib_shared_ptr_weak_type
+# error "__cpp_lib_shared_ptr_weak_type should be defined in c++17"
+# endif
+# if __cpp_lib_shared_ptr_weak_type != 201606L
+# error "__cpp_lib_shared_ptr_weak_type should have the value 201606L in c++17"
+# endif
+
+#elif TEST_STD_VER > 17
+
+# if TEST_HAS_BUILTIN(__builtin_addressof) || TEST_GCC_VER >= 700
+# ifndef __cpp_lib_addressof_constexpr
+# error "__cpp_lib_addressof_constexpr should be defined in c++2a"
+# endif
+# if __cpp_lib_addressof_constexpr != 201603L
+# error "__cpp_lib_addressof_constexpr should have the value 201603L in c++2a"
+# endif
+# else
+# ifdef __cpp_lib_addressof_constexpr
+# error "__cpp_lib_addressof_constexpr should not be defined when TEST_HAS_BUILTIN(__builtin_addressof) || TEST_GCC_VER >= 700 is not defined!"
+# endif
+# endif
+
+# ifndef __cpp_lib_allocator_traits_is_always_equal
+# error "__cpp_lib_allocator_traits_is_always_equal should be defined in c++2a"
+# endif
+# if __cpp_lib_allocator_traits_is_always_equal != 201411L
+# error "__cpp_lib_allocator_traits_is_always_equal should have the value 201411L in c++2a"
+# endif
+
+# ifndef __cpp_lib_enable_shared_from_this
+# error "__cpp_lib_enable_shared_from_this should be defined in c++2a"
+# endif
+# if __cpp_lib_enable_shared_from_this != 201603L
+# error "__cpp_lib_enable_shared_from_this should have the value 201603L in c++2a"
+# endif
+
+# ifndef __cpp_lib_make_unique
+# error "__cpp_lib_make_unique should be defined in c++2a"
+# endif
+# if __cpp_lib_make_unique != 201304L
+# error "__cpp_lib_make_unique should have the value 201304L in c++2a"
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_ranges
+# error "__cpp_lib_ranges should be defined in c++2a"
+# endif
+# if __cpp_lib_ranges != 201811L
+# error "__cpp_lib_ranges should have the value 201811L in c++2a"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_ranges
+# error "__cpp_lib_ranges should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+# ifndef __cpp_lib_raw_memory_algorithms
+# error "__cpp_lib_raw_memory_algorithms should be defined in c++2a"
+# endif
+# if __cpp_lib_raw_memory_algorithms != 201606L
+# error "__cpp_lib_raw_memory_algorithms should have the value 201606L in c++2a"
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_shared_ptr_arrays
+# error "__cpp_lib_shared_ptr_arrays should be defined in c++2a"
+# endif
+# if __cpp_lib_shared_ptr_arrays != 201611L
+# error "__cpp_lib_shared_ptr_arrays should have the value 201611L in c++2a"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_shared_ptr_arrays
+# error "__cpp_lib_shared_ptr_arrays should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+# ifndef __cpp_lib_shared_ptr_weak_type
+# error "__cpp_lib_shared_ptr_weak_type should be defined in c++2a"
+# endif
+# if __cpp_lib_shared_ptr_weak_type != 201606L
+# error "__cpp_lib_shared_ptr_weak_type should have the value 201606L in c++2a"
+# endif
+
+#endif // TEST_STD_VER > 17
+
+int main() {}
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/mutex.version.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/mutex.version.pass.cpp
index 72209d9f46f..e572d5796d7 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/mutex.version.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/mutex.version.pass.cpp
@@ -1,4 +1,3 @@
-
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
@@ -8,26 +7,50 @@
//
//===----------------------------------------------------------------------===//
//
-// <mutex> feature macros
+// WARNING: This test was generated by generate_feature_test_macros_tests.py and
+// should not be edited manually.
+
+// <mutex>
-/* Constant Value
- __cpp_lib_scoped_lock 201703L
+// Test the feature test macros defined by <mutex>
+/* Constant Value
+ __cpp_lib_scoped_lock 201703L [C++17]
*/
#include <mutex>
-#include <cassert>
#include "test_macros.h"
-int main()
-{
-// ensure that the macros that are supposed to be defined in <mutex> are defined.
+#if TEST_STD_VER < 14
-/*
-#if !defined(__cpp_lib_fooby)
-# error "__cpp_lib_fooby is not defined"
-#elif __cpp_lib_fooby < 201606L
-# error "__cpp_lib_fooby has an invalid value"
-#endif
-*/
-}
+# ifdef __cpp_lib_scoped_lock
+# error "__cpp_lib_scoped_lock should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 14
+
+# ifdef __cpp_lib_scoped_lock
+# error "__cpp_lib_scoped_lock should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 17
+
+# ifndef __cpp_lib_scoped_lock
+# error "__cpp_lib_scoped_lock should be defined in c++17"
+# endif
+# if __cpp_lib_scoped_lock != 201703L
+# error "__cpp_lib_scoped_lock should have the value 201703L in c++17"
+# endif
+
+#elif TEST_STD_VER > 17
+
+# ifndef __cpp_lib_scoped_lock
+# error "__cpp_lib_scoped_lock should be defined in c++2a"
+# endif
+# if __cpp_lib_scoped_lock != 201703L
+# error "__cpp_lib_scoped_lock should have the value 201703L in c++2a"
+# endif
+
+#endif // TEST_STD_VER > 17
+
+int main() {}
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/new.version.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/new.version.pass.cpp
index 6bcd242d177..beddc601011 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/new.version.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/new.version.pass.cpp
@@ -7,28 +7,99 @@
//
//===----------------------------------------------------------------------===//
//
-// <new> feature macros
+// WARNING: This test was generated by generate_feature_test_macros_tests.py and
+// should not be edited manually.
-/* Constant Value
- __cpp_lib_destroying_delete 201806L
- __cpp_lib_hardware_interference_size 201703L
- __cpp_lib_launder 201606L
+// <new>
+// Test the feature test macros defined by <new>
+
+/* Constant Value
+ __cpp_lib_destroying_delete 201806L [C++2a]
+ __cpp_lib_hardware_interference_size 201703L [C++17]
+ __cpp_lib_launder 201606L [C++17]
*/
#include <new>
-#include <cassert>
#include "test_macros.h"
-int main()
-{
-// ensure that the macros that are supposed to be defined in <new> are defined.
+#if TEST_STD_VER < 14
-/*
-#if !defined(__cpp_lib_fooby)
-# error "__cpp_lib_fooby is not defined"
-#elif __cpp_lib_fooby < 201606L
-# error "__cpp_lib_fooby has an invalid value"
-#endif
-*/
-}
+# ifdef __cpp_lib_destroying_delete
+# error "__cpp_lib_destroying_delete should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_hardware_interference_size
+# error "__cpp_lib_hardware_interference_size should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_launder
+# error "__cpp_lib_launder should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 14
+
+# ifdef __cpp_lib_destroying_delete
+# error "__cpp_lib_destroying_delete should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_hardware_interference_size
+# error "__cpp_lib_hardware_interference_size should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_launder
+# error "__cpp_lib_launder should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 17
+
+# ifdef __cpp_lib_destroying_delete
+# error "__cpp_lib_destroying_delete should not be defined before c++2a"
+# endif
+
+# ifndef __cpp_lib_hardware_interference_size
+# error "__cpp_lib_hardware_interference_size should be defined in c++17"
+# endif
+# if __cpp_lib_hardware_interference_size != 201703L
+# error "__cpp_lib_hardware_interference_size should have the value 201703L in c++17"
+# endif
+
+# ifndef __cpp_lib_launder
+# error "__cpp_lib_launder should be defined in c++17"
+# endif
+# if __cpp_lib_launder != 201606L
+# error "__cpp_lib_launder should have the value 201606L in c++17"
+# endif
+
+#elif TEST_STD_VER > 17
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_destroying_delete
+# error "__cpp_lib_destroying_delete should be defined in c++2a"
+# endif
+# if __cpp_lib_destroying_delete != 201806L
+# error "__cpp_lib_destroying_delete should have the value 201806L in c++2a"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_destroying_delete
+# error "__cpp_lib_destroying_delete should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+# ifndef __cpp_lib_hardware_interference_size
+# error "__cpp_lib_hardware_interference_size should be defined in c++2a"
+# endif
+# if __cpp_lib_hardware_interference_size != 201703L
+# error "__cpp_lib_hardware_interference_size should have the value 201703L in c++2a"
+# endif
+
+# ifndef __cpp_lib_launder
+# error "__cpp_lib_launder should be defined in c++2a"
+# endif
+# if __cpp_lib_launder != 201606L
+# error "__cpp_lib_launder should have the value 201606L in c++2a"
+# endif
+
+#endif // TEST_STD_VER > 17
+
+int main() {}
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/numeric.version.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/numeric.version.pass.cpp
index 61547621ee1..39bab221cf7 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/numeric.version.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/numeric.version.pass.cpp
@@ -1,4 +1,3 @@
-
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
@@ -8,27 +7,85 @@
//
//===----------------------------------------------------------------------===//
//
-// <numeric> feature macros
+// WARNING: This test was generated by generate_feature_test_macros_tests.py and
+// should not be edited manually.
+
+// <numeric>
-/* Constant Value
- __cpp_lib_gcd_lcm 201606L
- __cpp_lib_parallel_algorithm 201603L
+// Test the feature test macros defined by <numeric>
+/* Constant Value
+ __cpp_lib_gcd_lcm 201606L [C++17]
+ __cpp_lib_parallel_algorithm 201603L [C++17]
*/
#include <numeric>
-#include <cassert>
#include "test_macros.h"
-int main()
-{
-// ensure that the macros that are supposed to be defined in <numeric> are defined.
+#if TEST_STD_VER < 14
-/*
-#if !defined(__cpp_lib_fooby)
-# error "__cpp_lib_fooby is not defined"
-#elif __cpp_lib_fooby < 201606L
-# error "__cpp_lib_fooby has an invalid value"
-#endif
-*/
-}
+# ifdef __cpp_lib_gcd_lcm
+# error "__cpp_lib_gcd_lcm should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_parallel_algorithm
+# error "__cpp_lib_parallel_algorithm should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 14
+
+# ifdef __cpp_lib_gcd_lcm
+# error "__cpp_lib_gcd_lcm should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_parallel_algorithm
+# error "__cpp_lib_parallel_algorithm should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 17
+
+# ifndef __cpp_lib_gcd_lcm
+# error "__cpp_lib_gcd_lcm should be defined in c++17"
+# endif
+# if __cpp_lib_gcd_lcm != 201606L
+# error "__cpp_lib_gcd_lcm should have the value 201606L in c++17"
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_parallel_algorithm
+# error "__cpp_lib_parallel_algorithm should be defined in c++17"
+# endif
+# if __cpp_lib_parallel_algorithm != 201603L
+# error "__cpp_lib_parallel_algorithm should have the value 201603L in c++17"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_parallel_algorithm
+# error "__cpp_lib_parallel_algorithm should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+#elif TEST_STD_VER > 17
+
+# ifndef __cpp_lib_gcd_lcm
+# error "__cpp_lib_gcd_lcm should be defined in c++2a"
+# endif
+# if __cpp_lib_gcd_lcm != 201606L
+# error "__cpp_lib_gcd_lcm should have the value 201606L in c++2a"
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_parallel_algorithm
+# error "__cpp_lib_parallel_algorithm should be defined in c++2a"
+# endif
+# if __cpp_lib_parallel_algorithm != 201603L
+# error "__cpp_lib_parallel_algorithm should have the value 201603L in c++2a"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_parallel_algorithm
+# error "__cpp_lib_parallel_algorithm should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+#endif // TEST_STD_VER > 17
+
+int main() {}
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/optional.version.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/optional.version.pass.cpp
index b9795181aaa..c7db36f685c 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/optional.version.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/optional.version.pass.cpp
@@ -1,4 +1,3 @@
-
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
@@ -8,26 +7,50 @@
//
//===----------------------------------------------------------------------===//
//
-// <optional> feature macros
+// WARNING: This test was generated by generate_feature_test_macros_tests.py and
+// should not be edited manually.
+
+// <optional>
-/* Constant Value
- __cpp_lib_optional 201606L
+// Test the feature test macros defined by <optional>
+/* Constant Value
+ __cpp_lib_optional 201606L [C++17]
*/
#include <optional>
-#include <cassert>
#include "test_macros.h"
-int main()
-{
-// ensure that the macros that are supposed to be defined in <optional> are defined.
+#if TEST_STD_VER < 14
-/*
-#if !defined(__cpp_lib_fooby)
-# error "__cpp_lib_fooby is not defined"
-#elif __cpp_lib_fooby < 201606L
-# error "__cpp_lib_fooby has an invalid value"
-#endif
-*/
-}
+# ifdef __cpp_lib_optional
+# error "__cpp_lib_optional should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 14
+
+# ifdef __cpp_lib_optional
+# error "__cpp_lib_optional should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 17
+
+# ifndef __cpp_lib_optional
+# error "__cpp_lib_optional should be defined in c++17"
+# endif
+# if __cpp_lib_optional != 201606L
+# error "__cpp_lib_optional should have the value 201606L in c++17"
+# endif
+
+#elif TEST_STD_VER > 17
+
+# ifndef __cpp_lib_optional
+# error "__cpp_lib_optional should be defined in c++2a"
+# endif
+# if __cpp_lib_optional != 201606L
+# error "__cpp_lib_optional should have the value 201606L in c++2a"
+# endif
+
+#endif // TEST_STD_VER > 17
+
+int main() {}
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/ostream.version.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/ostream.version.pass.cpp
index 668b39e3235..72417122020 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/ostream.version.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/ostream.version.pass.cpp
@@ -1,4 +1,3 @@
-
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
@@ -8,36 +7,53 @@
//
//===----------------------------------------------------------------------===//
//
-// <ostream> feature macros
+// WARNING: This test was generated by generate_feature_test_macros_tests.py and
+// should not be edited manually.
+
+// <ostream>
-/* Constant Value
- __cpp_lib_char8_t 201811L
+// Test the feature test macros defined by <ostream>
+/* Constant Value
+ __cpp_lib_char8_t 201811L [C++2a]
*/
#include <ostream>
-#include <cassert>
#include "test_macros.h"
-int main()
-{
-// ensure that the macros that are supposed to be defined in <ostream> are defined.
+#if TEST_STD_VER < 14
+
+# ifdef __cpp_lib_char8_t
+# error "__cpp_lib_char8_t should not be defined before c++2a"
+# endif
+
+#elif TEST_STD_VER == 14
+
+# ifdef __cpp_lib_char8_t
+# error "__cpp_lib_char8_t should not be defined before c++2a"
+# endif
+
+#elif TEST_STD_VER == 17
+
+# ifdef __cpp_lib_char8_t
+# error "__cpp_lib_char8_t should not be defined before c++2a"
+# endif
+
+#elif TEST_STD_VER > 17
-#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
-# if !defined(__cpp_lib_char8_t)
- LIBCPP_STATIC_ASSERT(false, "__cpp_lib_char8_t is not defined");
+# if defined(__cpp_char8_t)
+# ifndef __cpp_lib_char8_t
+# error "__cpp_lib_char8_t should be defined in c++2a"
+# endif
+# if __cpp_lib_char8_t != 201811L
+# error "__cpp_lib_char8_t should have the value 201811L in c++2a"
+# endif
# else
-# if __cpp_lib_char8_t < 201811L
-# error "__cpp_lib_char8_t has an invalid value"
-# endif
+# ifdef __cpp_lib_char8_t
+# error "__cpp_lib_char8_t should not be defined when defined(__cpp_char8_t) is not defined!"
+# endif
# endif
-#endif
-
-/*
-#if !defined(__cpp_lib_fooby)
-# error "__cpp_lib_fooby is not defined"
-#elif __cpp_lib_fooby < 201606L
-# error "__cpp_lib_fooby has an invalid value"
-#endif
-*/
-}
+
+#endif // TEST_STD_VER > 17
+
+int main() {}
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/regex.version.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/regex.version.pass.cpp
index fdc499328d9..9869e209b7c 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/regex.version.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/regex.version.pass.cpp
@@ -1,4 +1,3 @@
-
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
@@ -8,26 +7,50 @@
//
//===----------------------------------------------------------------------===//
//
-// <regex> feature macros
+// WARNING: This test was generated by generate_feature_test_macros_tests.py and
+// should not be edited manually.
+
+// <regex>
-/* Constant Value
- __cpp_lib_nonmember_container_access 201411L
+// Test the feature test macros defined by <regex>
+/* Constant Value
+ __cpp_lib_nonmember_container_access 201411L [C++17]
*/
#include <regex>
-#include <cassert>
#include "test_macros.h"
-int main()
-{
-// ensure that the macros that are supposed to be defined in <regex> are defined.
+#if TEST_STD_VER < 14
-/*
-#if !defined(__cpp_lib_fooby)
-# error "__cpp_lib_fooby is not defined"
-#elif __cpp_lib_fooby < 201606L
-# error "__cpp_lib_fooby has an invalid value"
-#endif
-*/
-}
+# ifdef __cpp_lib_nonmember_container_access
+# error "__cpp_lib_nonmember_container_access should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 14
+
+# ifdef __cpp_lib_nonmember_container_access
+# error "__cpp_lib_nonmember_container_access should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 17
+
+# ifndef __cpp_lib_nonmember_container_access
+# error "__cpp_lib_nonmember_container_access should be defined in c++17"
+# endif
+# if __cpp_lib_nonmember_container_access != 201411L
+# error "__cpp_lib_nonmember_container_access should have the value 201411L in c++17"
+# endif
+
+#elif TEST_STD_VER > 17
+
+# ifndef __cpp_lib_nonmember_container_access
+# error "__cpp_lib_nonmember_container_access should be defined in c++2a"
+# endif
+# if __cpp_lib_nonmember_container_access != 201411L
+# error "__cpp_lib_nonmember_container_access should have the value 201411L in c++2a"
+# endif
+
+#endif // TEST_STD_VER > 17
+
+int main() {}
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/scoped_allocator.version.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/scoped_allocator.version.pass.cpp
index 84b2dbdb2c9..171fe5e3256 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/scoped_allocator.version.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/scoped_allocator.version.pass.cpp
@@ -1,4 +1,3 @@
-
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
@@ -8,26 +7,50 @@
//
//===----------------------------------------------------------------------===//
//
-// <scoped_allocator> feature macros
+// WARNING: This test was generated by generate_feature_test_macros_tests.py and
+// should not be edited manually.
+
+// <scoped_allocator>
-/* Constant Value
- __cpp_lib_allocator_traits_is_always_equal 201411L
+// Test the feature test macros defined by <scoped_allocator>
+/* Constant Value
+ __cpp_lib_allocator_traits_is_always_equal 201411L [C++17]
*/
#include <scoped_allocator>
-#include <cassert>
#include "test_macros.h"
-int main()
-{
-// ensure that the macros that are supposed to be defined in <scoped_allocator> are defined.
+#if TEST_STD_VER < 14
-/*
-#if !defined(__cpp_lib_fooby)
-# error "__cpp_lib_fooby is not defined"
-#elif __cpp_lib_fooby < 201606L
-# error "__cpp_lib_fooby has an invalid value"
-#endif
-*/
-}
+# ifdef __cpp_lib_allocator_traits_is_always_equal
+# error "__cpp_lib_allocator_traits_is_always_equal should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 14
+
+# ifdef __cpp_lib_allocator_traits_is_always_equal
+# error "__cpp_lib_allocator_traits_is_always_equal should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 17
+
+# ifndef __cpp_lib_allocator_traits_is_always_equal
+# error "__cpp_lib_allocator_traits_is_always_equal should be defined in c++17"
+# endif
+# if __cpp_lib_allocator_traits_is_always_equal != 201411L
+# error "__cpp_lib_allocator_traits_is_always_equal should have the value 201411L in c++17"
+# endif
+
+#elif TEST_STD_VER > 17
+
+# ifndef __cpp_lib_allocator_traits_is_always_equal
+# error "__cpp_lib_allocator_traits_is_always_equal should be defined in c++2a"
+# endif
+# if __cpp_lib_allocator_traits_is_always_equal != 201411L
+# error "__cpp_lib_allocator_traits_is_always_equal should have the value 201411L in c++2a"
+# endif
+
+#endif // TEST_STD_VER > 17
+
+int main() {}
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/set.version.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/set.version.pass.cpp
index 716eae6d9f0..95af65c1fc0 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/set.version.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/set.version.pass.cpp
@@ -1,4 +1,3 @@
-
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
@@ -8,40 +7,142 @@
//
//===----------------------------------------------------------------------===//
//
-// <set> feature macros
+// WARNING: This test was generated by generate_feature_test_macros_tests.py and
+// should not be edited manually.
+
+// <set>
-/* Constant Value
- __cpp_lib_allocator_traits_is_always_equal 201411L
- __cpp_lib_erase_if 201811L
- __cpp_lib_generic_associative_lookup 201304L
- __cpp_lib_node_extract 201606L
- __cpp_lib_nonmember_container_access 201411L
+// Test the feature test macros defined by <set>
+/* Constant Value
+ __cpp_lib_allocator_traits_is_always_equal 201411L [C++17]
+ __cpp_lib_erase_if 201811L [C++2a]
+ __cpp_lib_generic_associative_lookup 201304L [C++14]
+ __cpp_lib_node_extract 201606L [C++17]
+ __cpp_lib_nonmember_container_access 201411L [C++17]
*/
#include <set>
-#include <cassert>
#include "test_macros.h"
-int main()
-{
-// ensure that the macros that are supposed to be defined in <set> are defined.
-
-#if TEST_STD_VER > 17
-# if !defined(__cpp_lib_erase_if)
- LIBCPP_STATIC_ASSERT(false, "__cpp_lib_erase_if is not defined");
-# else
-# if __cpp_lib_erase_if < 201811L
-# error "__cpp_lib_erase_if has an invalid value"
-# endif
-# endif
-#endif
-
-/*
-#if !defined(__cpp_lib_fooby)
-# error "__cpp_lib_fooby is not defined"
-#elif __cpp_lib_fooby < 201606L
-# error "__cpp_lib_fooby has an invalid value"
-#endif
-*/
-}
+#if TEST_STD_VER < 14
+
+# ifdef __cpp_lib_allocator_traits_is_always_equal
+# error "__cpp_lib_allocator_traits_is_always_equal should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_erase_if
+# error "__cpp_lib_erase_if should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_generic_associative_lookup
+# error "__cpp_lib_generic_associative_lookup should not be defined before c++14"
+# endif
+
+# ifdef __cpp_lib_node_extract
+# error "__cpp_lib_node_extract should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_nonmember_container_access
+# error "__cpp_lib_nonmember_container_access should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 14
+
+# ifdef __cpp_lib_allocator_traits_is_always_equal
+# error "__cpp_lib_allocator_traits_is_always_equal should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_erase_if
+# error "__cpp_lib_erase_if should not be defined before c++2a"
+# endif
+
+# ifndef __cpp_lib_generic_associative_lookup
+# error "__cpp_lib_generic_associative_lookup should be defined in c++14"
+# endif
+# if __cpp_lib_generic_associative_lookup != 201304L
+# error "__cpp_lib_generic_associative_lookup should have the value 201304L in c++14"
+# endif
+
+# ifdef __cpp_lib_node_extract
+# error "__cpp_lib_node_extract should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_nonmember_container_access
+# error "__cpp_lib_nonmember_container_access should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 17
+
+# ifndef __cpp_lib_allocator_traits_is_always_equal
+# error "__cpp_lib_allocator_traits_is_always_equal should be defined in c++17"
+# endif
+# if __cpp_lib_allocator_traits_is_always_equal != 201411L
+# error "__cpp_lib_allocator_traits_is_always_equal should have the value 201411L in c++17"
+# endif
+
+# ifdef __cpp_lib_erase_if
+# error "__cpp_lib_erase_if should not be defined before c++2a"
+# endif
+
+# ifndef __cpp_lib_generic_associative_lookup
+# error "__cpp_lib_generic_associative_lookup should be defined in c++17"
+# endif
+# if __cpp_lib_generic_associative_lookup != 201304L
+# error "__cpp_lib_generic_associative_lookup should have the value 201304L in c++17"
+# endif
+
+# ifndef __cpp_lib_node_extract
+# error "__cpp_lib_node_extract should be defined in c++17"
+# endif
+# if __cpp_lib_node_extract != 201606L
+# error "__cpp_lib_node_extract should have the value 201606L in c++17"
+# endif
+
+# ifndef __cpp_lib_nonmember_container_access
+# error "__cpp_lib_nonmember_container_access should be defined in c++17"
+# endif
+# if __cpp_lib_nonmember_container_access != 201411L
+# error "__cpp_lib_nonmember_container_access should have the value 201411L in c++17"
+# endif
+
+#elif TEST_STD_VER > 17
+
+# ifndef __cpp_lib_allocator_traits_is_always_equal
+# error "__cpp_lib_allocator_traits_is_always_equal should be defined in c++2a"
+# endif
+# if __cpp_lib_allocator_traits_is_always_equal != 201411L
+# error "__cpp_lib_allocator_traits_is_always_equal should have the value 201411L in c++2a"
+# endif
+
+# ifndef __cpp_lib_erase_if
+# error "__cpp_lib_erase_if should be defined in c++2a"
+# endif
+# if __cpp_lib_erase_if != 201811L
+# error "__cpp_lib_erase_if should have the value 201811L in c++2a"
+# endif
+
+# ifndef __cpp_lib_generic_associative_lookup
+# error "__cpp_lib_generic_associative_lookup should be defined in c++2a"
+# endif
+# if __cpp_lib_generic_associative_lookup != 201304L
+# error "__cpp_lib_generic_associative_lookup should have the value 201304L in c++2a"
+# endif
+
+# ifndef __cpp_lib_node_extract
+# error "__cpp_lib_node_extract should be defined in c++2a"
+# endif
+# if __cpp_lib_node_extract != 201606L
+# error "__cpp_lib_node_extract should have the value 201606L in c++2a"
+# endif
+
+# ifndef __cpp_lib_nonmember_container_access
+# error "__cpp_lib_nonmember_container_access should be defined in c++2a"
+# endif
+# if __cpp_lib_nonmember_container_access != 201411L
+# error "__cpp_lib_nonmember_container_access should have the value 201411L in c++2a"
+# endif
+
+#endif // TEST_STD_VER > 17
+
+int main() {}
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/shared_mutex.version.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/shared_mutex.version.pass.cpp
index 33387e89067..a86aebe7027 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/shared_mutex.version.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/shared_mutex.version.pass.cpp
@@ -1,4 +1,3 @@
-
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
@@ -8,29 +7,76 @@
//
//===----------------------------------------------------------------------===//
//
-// <shared_mutex> feature macros
+// WARNING: This test was generated by generate_feature_test_macros_tests.py and
+// should not be edited manually.
-/* Constant Value
- __cpp_lib_shared_mutex 201505L
- __cpp_lib_shared_timed_mutex 201402L
+// <shared_mutex>
-*/
+// Test the feature test macros defined by <shared_mutex>
-// UNSUPPORTED: libcpp-has-no-threads
+/* Constant Value
+ __cpp_lib_shared_mutex 201505L [C++17]
+ __cpp_lib_shared_timed_mutex 201402L [C++14]
+*/
#include <shared_mutex>
-#include <cassert>
#include "test_macros.h"
-int main()
-{
-// ensure that the macros that are supposed to be defined in <shared_mutex> are defined.
+#if TEST_STD_VER < 14
-/*
-#if !defined(__cpp_lib_fooby)
-# error "__cpp_lib_fooby is not defined"
-#elif __cpp_lib_fooby < 201606L
-# error "__cpp_lib_fooby has an invalid value"
-#endif
-*/
-}
+# ifdef __cpp_lib_shared_mutex
+# error "__cpp_lib_shared_mutex should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_shared_timed_mutex
+# error "__cpp_lib_shared_timed_mutex should not be defined before c++14"
+# endif
+
+#elif TEST_STD_VER == 14
+
+# ifdef __cpp_lib_shared_mutex
+# error "__cpp_lib_shared_mutex should not be defined before c++17"
+# endif
+
+# ifndef __cpp_lib_shared_timed_mutex
+# error "__cpp_lib_shared_timed_mutex should be defined in c++14"
+# endif
+# if __cpp_lib_shared_timed_mutex != 201402L
+# error "__cpp_lib_shared_timed_mutex should have the value 201402L in c++14"
+# endif
+
+#elif TEST_STD_VER == 17
+
+# ifndef __cpp_lib_shared_mutex
+# error "__cpp_lib_shared_mutex should be defined in c++17"
+# endif
+# if __cpp_lib_shared_mutex != 201505L
+# error "__cpp_lib_shared_mutex should have the value 201505L in c++17"
+# endif
+
+# ifndef __cpp_lib_shared_timed_mutex
+# error "__cpp_lib_shared_timed_mutex should be defined in c++17"
+# endif
+# if __cpp_lib_shared_timed_mutex != 201402L
+# error "__cpp_lib_shared_timed_mutex should have the value 201402L in c++17"
+# endif
+
+#elif TEST_STD_VER > 17
+
+# ifndef __cpp_lib_shared_mutex
+# error "__cpp_lib_shared_mutex should be defined in c++2a"
+# endif
+# if __cpp_lib_shared_mutex != 201505L
+# error "__cpp_lib_shared_mutex should have the value 201505L in c++2a"
+# endif
+
+# ifndef __cpp_lib_shared_timed_mutex
+# error "__cpp_lib_shared_timed_mutex should be defined in c++2a"
+# endif
+# if __cpp_lib_shared_timed_mutex != 201402L
+# error "__cpp_lib_shared_timed_mutex should have the value 201402L in c++2a"
+# endif
+
+#endif // TEST_STD_VER > 17
+
+int main() {}
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/string.version.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/string.version.pass.cpp
index 87e8c8f96c3..dd6d09e24a6 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/string.version.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/string.version.pass.cpp
@@ -1,4 +1,3 @@
-
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
@@ -8,51 +7,168 @@
//
//===----------------------------------------------------------------------===//
//
-// <string> feature macros
+// WARNING: This test was generated by generate_feature_test_macros_tests.py and
+// should not be edited manually.
+
+// <string>
-/* Constant Value
- __cpp_lib_allocator_traits_is_always_equal 201411L
- __cpp_lib_erase_if 201811L
- __cpp_lib_char8_t 201811L
- __cpp_lib_nonmember_container_access 201411L
- __cpp_lib_string_udls 201304L
- __cpp_lib_string_view 201606L
+// Test the feature test macros defined by <string>
+/* Constant Value
+ __cpp_lib_allocator_traits_is_always_equal 201411L [C++17]
+ __cpp_lib_char8_t 201811L [C++2a]
+ __cpp_lib_erase_if 201811L [C++2a]
+ __cpp_lib_nonmember_container_access 201411L [C++17]
+ __cpp_lib_string_udls 201304L [C++14]
+ __cpp_lib_string_view 201606L [C++17]
*/
#include <string>
-#include <cassert>
#include "test_macros.h"
-int main()
-{
-// ensure that the macros that are supposed to be defined in <string> are defined.
+#if TEST_STD_VER < 14
-#if TEST_STD_VER > 17
-# if !defined(__cpp_lib_erase_if)
- LIBCPP_STATIC_ASSERT(false, "__cpp_lib_erase_if is not defined");
-# else
-# if __cpp_lib_erase_if < 201811L
-# error "__cpp_lib_erase_if has an invalid value"
-# endif
+# ifdef __cpp_lib_allocator_traits_is_always_equal
+# error "__cpp_lib_allocator_traits_is_always_equal should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_char8_t
+# error "__cpp_lib_char8_t should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_erase_if
+# error "__cpp_lib_erase_if should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_nonmember_container_access
+# error "__cpp_lib_nonmember_container_access should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_string_udls
+# error "__cpp_lib_string_udls should not be defined before c++14"
+# endif
+
+# ifdef __cpp_lib_string_view
+# error "__cpp_lib_string_view should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 14
+
+# ifdef __cpp_lib_allocator_traits_is_always_equal
+# error "__cpp_lib_allocator_traits_is_always_equal should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_char8_t
+# error "__cpp_lib_char8_t should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_erase_if
+# error "__cpp_lib_erase_if should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_nonmember_container_access
+# error "__cpp_lib_nonmember_container_access should not be defined before c++17"
+# endif
+
+# ifndef __cpp_lib_string_udls
+# error "__cpp_lib_string_udls should be defined in c++14"
+# endif
+# if __cpp_lib_string_udls != 201304L
+# error "__cpp_lib_string_udls should have the value 201304L in c++14"
+# endif
+
+# ifdef __cpp_lib_string_view
+# error "__cpp_lib_string_view should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 17
+
+# ifndef __cpp_lib_allocator_traits_is_always_equal
+# error "__cpp_lib_allocator_traits_is_always_equal should be defined in c++17"
+# endif
+# if __cpp_lib_allocator_traits_is_always_equal != 201411L
+# error "__cpp_lib_allocator_traits_is_always_equal should have the value 201411L in c++17"
+# endif
+
+# ifdef __cpp_lib_char8_t
+# error "__cpp_lib_char8_t should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_erase_if
+# error "__cpp_lib_erase_if should not be defined before c++2a"
+# endif
+
+# ifndef __cpp_lib_nonmember_container_access
+# error "__cpp_lib_nonmember_container_access should be defined in c++17"
+# endif
+# if __cpp_lib_nonmember_container_access != 201411L
+# error "__cpp_lib_nonmember_container_access should have the value 201411L in c++17"
+# endif
+
+# ifndef __cpp_lib_string_udls
+# error "__cpp_lib_string_udls should be defined in c++17"
+# endif
+# if __cpp_lib_string_udls != 201304L
+# error "__cpp_lib_string_udls should have the value 201304L in c++17"
+# endif
+
+# ifndef __cpp_lib_string_view
+# error "__cpp_lib_string_view should be defined in c++17"
+# endif
+# if __cpp_lib_string_view != 201606L
+# error "__cpp_lib_string_view should have the value 201606L in c++17"
+# endif
+
+#elif TEST_STD_VER > 17
+
+# ifndef __cpp_lib_allocator_traits_is_always_equal
+# error "__cpp_lib_allocator_traits_is_always_equal should be defined in c++2a"
+# endif
+# if __cpp_lib_allocator_traits_is_always_equal != 201411L
+# error "__cpp_lib_allocator_traits_is_always_equal should have the value 201411L in c++2a"
# endif
-#endif
-#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
-# if !defined(__cpp_lib_char8_t)
- LIBCPP_STATIC_ASSERT(false, "__cpp_lib_char8_t is not defined");
+# if defined(__cpp_char8_t)
+# ifndef __cpp_lib_char8_t
+# error "__cpp_lib_char8_t should be defined in c++2a"
+# endif
+# if __cpp_lib_char8_t != 201811L
+# error "__cpp_lib_char8_t should have the value 201811L in c++2a"
+# endif
# else
-# if __cpp_lib_char8_t < 201811L
-# error "__cpp_lib_char8_t has an invalid value"
-# endif
-# endif
-#endif
-
-/*
-#if !defined(__cpp_lib_fooby)
-# error "__cpp_lib_fooby is not defined"
-#elif __cpp_lib_fooby < 201606L
-# error "__cpp_lib_fooby has an invalid value"
-#endif
-*/
-}
+# ifdef __cpp_lib_char8_t
+# error "__cpp_lib_char8_t should not be defined when defined(__cpp_char8_t) is not defined!"
+# endif
+# endif
+
+# ifndef __cpp_lib_erase_if
+# error "__cpp_lib_erase_if should be defined in c++2a"
+# endif
+# if __cpp_lib_erase_if != 201811L
+# error "__cpp_lib_erase_if should have the value 201811L in c++2a"
+# endif
+
+# ifndef __cpp_lib_nonmember_container_access
+# error "__cpp_lib_nonmember_container_access should be defined in c++2a"
+# endif
+# if __cpp_lib_nonmember_container_access != 201411L
+# error "__cpp_lib_nonmember_container_access should have the value 201411L in c++2a"
+# endif
+
+# ifndef __cpp_lib_string_udls
+# error "__cpp_lib_string_udls should be defined in c++2a"
+# endif
+# if __cpp_lib_string_udls != 201304L
+# error "__cpp_lib_string_udls should have the value 201304L in c++2a"
+# endif
+
+# ifndef __cpp_lib_string_view
+# error "__cpp_lib_string_view should be defined in c++2a"
+# endif
+# if __cpp_lib_string_view != 201606L
+# error "__cpp_lib_string_view should have the value 201606L in c++2a"
+# endif
+
+#endif // TEST_STD_VER > 17
+
+int main() {}
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/string_view.version.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/string_view.version.pass.cpp
index bbdeb0b5ac3..c8ceb7c7e7b 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/string_view.version.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/string_view.version.pass.cpp
@@ -1,4 +1,3 @@
-
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
@@ -8,37 +7,102 @@
//
//===----------------------------------------------------------------------===//
//
-// <string_view> feature macros
+// WARNING: This test was generated by generate_feature_test_macros_tests.py and
+// should not be edited manually.
+
+// <string_view>
-/* Constant Value
- __cpp_lib_char8_t 201811L
- __cpp_lib_string_view 201606L
+// Test the feature test macros defined by <string_view>
+/* Constant Value
+ __cpp_lib_char8_t 201811L [C++2a]
+ __cpp_lib_constexpr_misc 201811L [C++2a]
+ __cpp_lib_string_view 201606L [C++17]
*/
#include <string_view>
-#include <cassert>
#include "test_macros.h"
-int main()
-{
-// ensure that the macros that are supposed to be defined in <string_view> are defined.
+#if TEST_STD_VER < 14
+
+# ifdef __cpp_lib_char8_t
+# error "__cpp_lib_char8_t should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_constexpr_misc
+# error "__cpp_lib_constexpr_misc should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_string_view
+# error "__cpp_lib_string_view should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 14
-#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
-# if !defined(__cpp_lib_char8_t)
- LIBCPP_STATIC_ASSERT(false, "__cpp_lib_char8_t is not defined");
+# ifdef __cpp_lib_char8_t
+# error "__cpp_lib_char8_t should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_constexpr_misc
+# error "__cpp_lib_constexpr_misc should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_string_view
+# error "__cpp_lib_string_view should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 17
+
+# ifdef __cpp_lib_char8_t
+# error "__cpp_lib_char8_t should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_constexpr_misc
+# error "__cpp_lib_constexpr_misc should not be defined before c++2a"
+# endif
+
+# ifndef __cpp_lib_string_view
+# error "__cpp_lib_string_view should be defined in c++17"
+# endif
+# if __cpp_lib_string_view != 201606L
+# error "__cpp_lib_string_view should have the value 201606L in c++17"
+# endif
+
+#elif TEST_STD_VER > 17
+
+# if defined(__cpp_char8_t)
+# ifndef __cpp_lib_char8_t
+# error "__cpp_lib_char8_t should be defined in c++2a"
+# endif
+# if __cpp_lib_char8_t != 201811L
+# error "__cpp_lib_char8_t should have the value 201811L in c++2a"
+# endif
# else
-# if __cpp_lib_char8_t < 201811L
-# error "__cpp_lib_char8_t has an invalid value"
-# endif
-# endif
-#endif
-
-/*
-#if !defined(__cpp_lib_fooby)
-# error "__cpp_lib_fooby is not defined"
-#elif __cpp_lib_fooby < 201606L
-# error "__cpp_lib_fooby has an invalid value"
-#endif
-*/
-}
+# ifdef __cpp_lib_char8_t
+# error "__cpp_lib_char8_t should not be defined when defined(__cpp_char8_t) is not defined!"
+# endif
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_constexpr_misc
+# error "__cpp_lib_constexpr_misc should be defined in c++2a"
+# endif
+# if __cpp_lib_constexpr_misc != 201811L
+# error "__cpp_lib_constexpr_misc should have the value 201811L in c++2a"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_constexpr_misc
+# error "__cpp_lib_constexpr_misc should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+# ifndef __cpp_lib_string_view
+# error "__cpp_lib_string_view should be defined in c++2a"
+# endif
+# if __cpp_lib_string_view != 201606L
+# error "__cpp_lib_string_view should have the value 201606L in c++2a"
+# endif
+
+#endif // TEST_STD_VER > 17
+
+int main() {}
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/tuple.version.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/tuple.version.pass.cpp
index ddff29d7859..6e680a774e8 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/tuple.version.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/tuple.version.pass.cpp
@@ -1,4 +1,3 @@
-
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
@@ -8,29 +7,151 @@
//
//===----------------------------------------------------------------------===//
//
-// <tuple> feature macros
+// WARNING: This test was generated by generate_feature_test_macros_tests.py and
+// should not be edited manually.
+
+// <tuple>
-/* Constant Value
- __cpp_lib_apply 201603L
- __cpp_lib_make_from_tuple 201606L
- __cpp_lib_tuple_element_t 201402L
- __cpp_lib_tuples_by_type 201304L
+// Test the feature test macros defined by <tuple>
+/* Constant Value
+ __cpp_lib_apply 201603L [C++17]
+ __cpp_lib_constexpr_misc 201811L [C++2a]
+ __cpp_lib_make_from_tuple 201606L [C++17]
+ __cpp_lib_tuple_element_t 201402L [C++14]
+ __cpp_lib_tuples_by_type 201304L [C++14]
*/
#include <tuple>
-#include <cassert>
#include "test_macros.h"
-int main()
-{
-// ensure that the macros that are supposed to be defined in <tuple> are defined.
+#if TEST_STD_VER < 14
-/*
-#if !defined(__cpp_lib_fooby)
-# error "__cpp_lib_fooby is not defined"
-#elif __cpp_lib_fooby < 201606L
-# error "__cpp_lib_fooby has an invalid value"
-#endif
-*/
-}
+# ifdef __cpp_lib_apply
+# error "__cpp_lib_apply should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_constexpr_misc
+# error "__cpp_lib_constexpr_misc should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_make_from_tuple
+# error "__cpp_lib_make_from_tuple should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_tuple_element_t
+# error "__cpp_lib_tuple_element_t should not be defined before c++14"
+# endif
+
+# ifdef __cpp_lib_tuples_by_type
+# error "__cpp_lib_tuples_by_type should not be defined before c++14"
+# endif
+
+#elif TEST_STD_VER == 14
+
+# ifdef __cpp_lib_apply
+# error "__cpp_lib_apply should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_constexpr_misc
+# error "__cpp_lib_constexpr_misc should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_make_from_tuple
+# error "__cpp_lib_make_from_tuple should not be defined before c++17"
+# endif
+
+# ifndef __cpp_lib_tuple_element_t
+# error "__cpp_lib_tuple_element_t should be defined in c++14"
+# endif
+# if __cpp_lib_tuple_element_t != 201402L
+# error "__cpp_lib_tuple_element_t should have the value 201402L in c++14"
+# endif
+
+# ifndef __cpp_lib_tuples_by_type
+# error "__cpp_lib_tuples_by_type should be defined in c++14"
+# endif
+# if __cpp_lib_tuples_by_type != 201304L
+# error "__cpp_lib_tuples_by_type should have the value 201304L in c++14"
+# endif
+
+#elif TEST_STD_VER == 17
+
+# ifndef __cpp_lib_apply
+# error "__cpp_lib_apply should be defined in c++17"
+# endif
+# if __cpp_lib_apply != 201603L
+# error "__cpp_lib_apply should have the value 201603L in c++17"
+# endif
+
+# ifdef __cpp_lib_constexpr_misc
+# error "__cpp_lib_constexpr_misc should not be defined before c++2a"
+# endif
+
+# ifndef __cpp_lib_make_from_tuple
+# error "__cpp_lib_make_from_tuple should be defined in c++17"
+# endif
+# if __cpp_lib_make_from_tuple != 201606L
+# error "__cpp_lib_make_from_tuple should have the value 201606L in c++17"
+# endif
+
+# ifndef __cpp_lib_tuple_element_t
+# error "__cpp_lib_tuple_element_t should be defined in c++17"
+# endif
+# if __cpp_lib_tuple_element_t != 201402L
+# error "__cpp_lib_tuple_element_t should have the value 201402L in c++17"
+# endif
+
+# ifndef __cpp_lib_tuples_by_type
+# error "__cpp_lib_tuples_by_type should be defined in c++17"
+# endif
+# if __cpp_lib_tuples_by_type != 201304L
+# error "__cpp_lib_tuples_by_type should have the value 201304L in c++17"
+# endif
+
+#elif TEST_STD_VER > 17
+
+# ifndef __cpp_lib_apply
+# error "__cpp_lib_apply should be defined in c++2a"
+# endif
+# if __cpp_lib_apply != 201603L
+# error "__cpp_lib_apply should have the value 201603L in c++2a"
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_constexpr_misc
+# error "__cpp_lib_constexpr_misc should be defined in c++2a"
+# endif
+# if __cpp_lib_constexpr_misc != 201811L
+# error "__cpp_lib_constexpr_misc should have the value 201811L in c++2a"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_constexpr_misc
+# error "__cpp_lib_constexpr_misc should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+# ifndef __cpp_lib_make_from_tuple
+# error "__cpp_lib_make_from_tuple should be defined in c++2a"
+# endif
+# if __cpp_lib_make_from_tuple != 201606L
+# error "__cpp_lib_make_from_tuple should have the value 201606L in c++2a"
+# endif
+
+# ifndef __cpp_lib_tuple_element_t
+# error "__cpp_lib_tuple_element_t should be defined in c++2a"
+# endif
+# if __cpp_lib_tuple_element_t != 201402L
+# error "__cpp_lib_tuple_element_t should have the value 201402L in c++2a"
+# endif
+
+# ifndef __cpp_lib_tuples_by_type
+# error "__cpp_lib_tuples_by_type should be defined in c++2a"
+# endif
+# if __cpp_lib_tuples_by_type != 201304L
+# error "__cpp_lib_tuples_by_type should have the value 201304L in c++2a"
+# endif
+
+#endif // TEST_STD_VER > 17
+
+int main() {}
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/type_traits.version.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/type_traits.version.pass.cpp
index e53da7ef7a5..1a82290274a 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/type_traits.version.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/type_traits.version.pass.cpp
@@ -1,4 +1,3 @@
-
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
@@ -8,47 +7,391 @@
//
//===----------------------------------------------------------------------===//
//
-// <type_traits> feature macros
-
-/* Constant Value
- __cpp_lib_bool_constant 201505L
- __cpp_lib_has_unique_object_representations 201606L
- __cpp_lib_integral_constant_callable 201304L
- __cpp_lib_is_aggregate 201703L
- __cpp_lib_is_final 201402L
- __cpp_lib_is_invocable 201703L
- __cpp_lib_is_null_pointer 201309L
- __cpp_lib_is_swappable 201603L
- __cpp_lib_logical_traits 201510L
- __cpp_lib_result_of_sfinae 201210L
- __cpp_lib_transformation_trait_aliases 201304L
- __cpp_lib_type_trait_variable_templates 201510L
- __cpp_lib_void_t 201411L
+// WARNING: This test was generated by generate_feature_test_macros_tests.py and
+// should not be edited manually.
+
+// <type_traits>
+
+// Test the feature test macros defined by <type_traits>
+/* Constant Value
+ __cpp_lib_bool_constant 201505L [C++17]
+ __cpp_lib_has_unique_object_representations 201606L [C++17]
+ __cpp_lib_integral_constant_callable 201304L [C++14]
+ __cpp_lib_is_aggregate 201703L [C++17]
+ __cpp_lib_is_constant_evaluated 201811L [C++2a]
+ __cpp_lib_is_final 201402L [C++14]
+ __cpp_lib_is_invocable 201703L [C++17]
+ __cpp_lib_is_null_pointer 201309L [C++14]
+ __cpp_lib_is_swappable 201603L [C++17]
+ __cpp_lib_logical_traits 201510L [C++17]
+ __cpp_lib_result_of_sfinae 201210L [C++14]
+ __cpp_lib_transformation_trait_aliases 201304L [C++14]
+ __cpp_lib_type_trait_variable_templates 201510L [C++17]
+ __cpp_lib_void_t 201411L [C++17]
*/
#include <type_traits>
-#include <cassert>
#include "test_macros.h"
-int main()
-{
-// ensure that the macros that are supposed to be defined in <type_traits> are defined.
+#if TEST_STD_VER < 14
-#if TEST_STD_VER > 14
-# if !defined(__cpp_lib_void_t)
-# error "__cpp_lib_void_t is not defined"
-# elif __cpp_lib_void_t < 201411L
-# error "__cpp_lib_void_t has an invalid value"
+# ifdef __cpp_lib_bool_constant
+# error "__cpp_lib_bool_constant should not be defined before c++17"
# endif
-#endif
+# ifdef __cpp_lib_has_unique_object_representations
+# error "__cpp_lib_has_unique_object_representations should not be defined before c++17"
+# endif
-/*
-#if !defined(__cpp_lib_fooby)
-# error "__cpp_lib_fooby is not defined"
-#elif __cpp_lib_fooby < 201606L
-# error "__cpp_lib_fooby has an invalid value"
-#endif
-*/
-}
+# ifdef __cpp_lib_integral_constant_callable
+# error "__cpp_lib_integral_constant_callable should not be defined before c++14"
+# endif
+
+# ifdef __cpp_lib_is_aggregate
+# error "__cpp_lib_is_aggregate should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_is_constant_evaluated
+# error "__cpp_lib_is_constant_evaluated should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_is_final
+# error "__cpp_lib_is_final should not be defined before c++14"
+# endif
+
+# ifdef __cpp_lib_is_invocable
+# error "__cpp_lib_is_invocable should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_is_null_pointer
+# error "__cpp_lib_is_null_pointer should not be defined before c++14"
+# endif
+
+# ifdef __cpp_lib_is_swappable
+# error "__cpp_lib_is_swappable should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_logical_traits
+# error "__cpp_lib_logical_traits should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_result_of_sfinae
+# error "__cpp_lib_result_of_sfinae should not be defined before c++14"
+# endif
+
+# ifdef __cpp_lib_transformation_trait_aliases
+# error "__cpp_lib_transformation_trait_aliases should not be defined before c++14"
+# endif
+
+# ifdef __cpp_lib_type_trait_variable_templates
+# error "__cpp_lib_type_trait_variable_templates should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_void_t
+# error "__cpp_lib_void_t should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 14
+
+# ifdef __cpp_lib_bool_constant
+# error "__cpp_lib_bool_constant should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_has_unique_object_representations
+# error "__cpp_lib_has_unique_object_representations should not be defined before c++17"
+# endif
+
+# ifndef __cpp_lib_integral_constant_callable
+# error "__cpp_lib_integral_constant_callable should be defined in c++14"
+# endif
+# if __cpp_lib_integral_constant_callable != 201304L
+# error "__cpp_lib_integral_constant_callable should have the value 201304L in c++14"
+# endif
+
+# ifdef __cpp_lib_is_aggregate
+# error "__cpp_lib_is_aggregate should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_is_constant_evaluated
+# error "__cpp_lib_is_constant_evaluated should not be defined before c++2a"
+# endif
+
+# ifndef __cpp_lib_is_final
+# error "__cpp_lib_is_final should be defined in c++14"
+# endif
+# if __cpp_lib_is_final != 201402L
+# error "__cpp_lib_is_final should have the value 201402L in c++14"
+# endif
+
+# ifdef __cpp_lib_is_invocable
+# error "__cpp_lib_is_invocable should not be defined before c++17"
+# endif
+
+# ifndef __cpp_lib_is_null_pointer
+# error "__cpp_lib_is_null_pointer should be defined in c++14"
+# endif
+# if __cpp_lib_is_null_pointer != 201309L
+# error "__cpp_lib_is_null_pointer should have the value 201309L in c++14"
+# endif
+
+# ifdef __cpp_lib_is_swappable
+# error "__cpp_lib_is_swappable should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_logical_traits
+# error "__cpp_lib_logical_traits should not be defined before c++17"
+# endif
+
+# ifndef __cpp_lib_result_of_sfinae
+# error "__cpp_lib_result_of_sfinae should be defined in c++14"
+# endif
+# if __cpp_lib_result_of_sfinae != 201210L
+# error "__cpp_lib_result_of_sfinae should have the value 201210L in c++14"
+# endif
+
+# ifndef __cpp_lib_transformation_trait_aliases
+# error "__cpp_lib_transformation_trait_aliases should be defined in c++14"
+# endif
+# if __cpp_lib_transformation_trait_aliases != 201304L
+# error "__cpp_lib_transformation_trait_aliases should have the value 201304L in c++14"
+# endif
+
+# ifdef __cpp_lib_type_trait_variable_templates
+# error "__cpp_lib_type_trait_variable_templates should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_void_t
+# error "__cpp_lib_void_t should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 17
+
+# ifndef __cpp_lib_bool_constant
+# error "__cpp_lib_bool_constant should be defined in c++17"
+# endif
+# if __cpp_lib_bool_constant != 201505L
+# error "__cpp_lib_bool_constant should have the value 201505L in c++17"
+# endif
+
+# if TEST_HAS_BUILTIN_IDENTIFIER(__has_unique_object_representations) || TEST_GCC_VER >= 700
+# ifndef __cpp_lib_has_unique_object_representations
+# error "__cpp_lib_has_unique_object_representations should be defined in c++17"
+# endif
+# if __cpp_lib_has_unique_object_representations != 201606L
+# error "__cpp_lib_has_unique_object_representations should have the value 201606L in c++17"
+# endif
+# else
+# ifdef __cpp_lib_has_unique_object_representations
+# error "__cpp_lib_has_unique_object_representations should not be defined when TEST_HAS_BUILTIN_IDENTIFIER(__has_unique_object_representations) || TEST_GCC_VER >= 700 is not defined!"
+# endif
+# endif
+
+# ifndef __cpp_lib_integral_constant_callable
+# error "__cpp_lib_integral_constant_callable should be defined in c++17"
+# endif
+# if __cpp_lib_integral_constant_callable != 201304L
+# error "__cpp_lib_integral_constant_callable should have the value 201304L in c++17"
+# endif
+
+# if TEST_HAS_BUILTIN_IDENTIFIER(__is_aggregate) || TEST_GCC_VER_NEW >= 7001
+# ifndef __cpp_lib_is_aggregate
+# error "__cpp_lib_is_aggregate should be defined in c++17"
+# endif
+# if __cpp_lib_is_aggregate != 201703L
+# error "__cpp_lib_is_aggregate should have the value 201703L in c++17"
+# endif
+# else
+# ifdef __cpp_lib_is_aggregate
+# error "__cpp_lib_is_aggregate should not be defined when TEST_HAS_BUILTIN_IDENTIFIER(__is_aggregate) || TEST_GCC_VER_NEW >= 7001 is not defined!"
+# endif
+# endif
+
+# ifdef __cpp_lib_is_constant_evaluated
+# error "__cpp_lib_is_constant_evaluated should not be defined before c++2a"
+# endif
+
+# ifndef __cpp_lib_is_final
+# error "__cpp_lib_is_final should be defined in c++17"
+# endif
+# if __cpp_lib_is_final != 201402L
+# error "__cpp_lib_is_final should have the value 201402L in c++17"
+# endif
+
+# ifndef __cpp_lib_is_invocable
+# error "__cpp_lib_is_invocable should be defined in c++17"
+# endif
+# if __cpp_lib_is_invocable != 201703L
+# error "__cpp_lib_is_invocable should have the value 201703L in c++17"
+# endif
+
+# ifndef __cpp_lib_is_null_pointer
+# error "__cpp_lib_is_null_pointer should be defined in c++17"
+# endif
+# if __cpp_lib_is_null_pointer != 201309L
+# error "__cpp_lib_is_null_pointer should have the value 201309L in c++17"
+# endif
+
+# ifndef __cpp_lib_is_swappable
+# error "__cpp_lib_is_swappable should be defined in c++17"
+# endif
+# if __cpp_lib_is_swappable != 201603L
+# error "__cpp_lib_is_swappable should have the value 201603L in c++17"
+# endif
+
+# ifndef __cpp_lib_logical_traits
+# error "__cpp_lib_logical_traits should be defined in c++17"
+# endif
+# if __cpp_lib_logical_traits != 201510L
+# error "__cpp_lib_logical_traits should have the value 201510L in c++17"
+# endif
+
+# ifndef __cpp_lib_result_of_sfinae
+# error "__cpp_lib_result_of_sfinae should be defined in c++17"
+# endif
+# if __cpp_lib_result_of_sfinae != 201210L
+# error "__cpp_lib_result_of_sfinae should have the value 201210L in c++17"
+# endif
+
+# ifndef __cpp_lib_transformation_trait_aliases
+# error "__cpp_lib_transformation_trait_aliases should be defined in c++17"
+# endif
+# if __cpp_lib_transformation_trait_aliases != 201304L
+# error "__cpp_lib_transformation_trait_aliases should have the value 201304L in c++17"
+# endif
+
+# ifndef __cpp_lib_type_trait_variable_templates
+# error "__cpp_lib_type_trait_variable_templates should be defined in c++17"
+# endif
+# if __cpp_lib_type_trait_variable_templates != 201510L
+# error "__cpp_lib_type_trait_variable_templates should have the value 201510L in c++17"
+# endif
+
+# ifndef __cpp_lib_void_t
+# error "__cpp_lib_void_t should be defined in c++17"
+# endif
+# if __cpp_lib_void_t != 201411L
+# error "__cpp_lib_void_t should have the value 201411L in c++17"
+# endif
+
+#elif TEST_STD_VER > 17
+
+# ifndef __cpp_lib_bool_constant
+# error "__cpp_lib_bool_constant should be defined in c++2a"
+# endif
+# if __cpp_lib_bool_constant != 201505L
+# error "__cpp_lib_bool_constant should have the value 201505L in c++2a"
+# endif
+
+# if TEST_HAS_BUILTIN_IDENTIFIER(__has_unique_object_representations) || TEST_GCC_VER >= 700
+# ifndef __cpp_lib_has_unique_object_representations
+# error "__cpp_lib_has_unique_object_representations should be defined in c++2a"
+# endif
+# if __cpp_lib_has_unique_object_representations != 201606L
+# error "__cpp_lib_has_unique_object_representations should have the value 201606L in c++2a"
+# endif
+# else
+# ifdef __cpp_lib_has_unique_object_representations
+# error "__cpp_lib_has_unique_object_representations should not be defined when TEST_HAS_BUILTIN_IDENTIFIER(__has_unique_object_representations) || TEST_GCC_VER >= 700 is not defined!"
+# endif
+# endif
+
+# ifndef __cpp_lib_integral_constant_callable
+# error "__cpp_lib_integral_constant_callable should be defined in c++2a"
+# endif
+# if __cpp_lib_integral_constant_callable != 201304L
+# error "__cpp_lib_integral_constant_callable should have the value 201304L in c++2a"
+# endif
+
+# if TEST_HAS_BUILTIN_IDENTIFIER(__is_aggregate) || TEST_GCC_VER_NEW >= 7001
+# ifndef __cpp_lib_is_aggregate
+# error "__cpp_lib_is_aggregate should be defined in c++2a"
+# endif
+# if __cpp_lib_is_aggregate != 201703L
+# error "__cpp_lib_is_aggregate should have the value 201703L in c++2a"
+# endif
+# else
+# ifdef __cpp_lib_is_aggregate
+# error "__cpp_lib_is_aggregate should not be defined when TEST_HAS_BUILTIN_IDENTIFIER(__is_aggregate) || TEST_GCC_VER_NEW >= 7001 is not defined!"
+# endif
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_is_constant_evaluated
+# error "__cpp_lib_is_constant_evaluated should be defined in c++2a"
+# endif
+# if __cpp_lib_is_constant_evaluated != 201811L
+# error "__cpp_lib_is_constant_evaluated should have the value 201811L in c++2a"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_is_constant_evaluated
+# error "__cpp_lib_is_constant_evaluated should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+# ifndef __cpp_lib_is_final
+# error "__cpp_lib_is_final should be defined in c++2a"
+# endif
+# if __cpp_lib_is_final != 201402L
+# error "__cpp_lib_is_final should have the value 201402L in c++2a"
+# endif
+
+# ifndef __cpp_lib_is_invocable
+# error "__cpp_lib_is_invocable should be defined in c++2a"
+# endif
+# if __cpp_lib_is_invocable != 201703L
+# error "__cpp_lib_is_invocable should have the value 201703L in c++2a"
+# endif
+
+# ifndef __cpp_lib_is_null_pointer
+# error "__cpp_lib_is_null_pointer should be defined in c++2a"
+# endif
+# if __cpp_lib_is_null_pointer != 201309L
+# error "__cpp_lib_is_null_pointer should have the value 201309L in c++2a"
+# endif
+
+# ifndef __cpp_lib_is_swappable
+# error "__cpp_lib_is_swappable should be defined in c++2a"
+# endif
+# if __cpp_lib_is_swappable != 201603L
+# error "__cpp_lib_is_swappable should have the value 201603L in c++2a"
+# endif
+
+# ifndef __cpp_lib_logical_traits
+# error "__cpp_lib_logical_traits should be defined in c++2a"
+# endif
+# if __cpp_lib_logical_traits != 201510L
+# error "__cpp_lib_logical_traits should have the value 201510L in c++2a"
+# endif
+
+# ifndef __cpp_lib_result_of_sfinae
+# error "__cpp_lib_result_of_sfinae should be defined in c++2a"
+# endif
+# if __cpp_lib_result_of_sfinae != 201210L
+# error "__cpp_lib_result_of_sfinae should have the value 201210L in c++2a"
+# endif
+
+# ifndef __cpp_lib_transformation_trait_aliases
+# error "__cpp_lib_transformation_trait_aliases should be defined in c++2a"
+# endif
+# if __cpp_lib_transformation_trait_aliases != 201304L
+# error "__cpp_lib_transformation_trait_aliases should have the value 201304L in c++2a"
+# endif
+
+# ifndef __cpp_lib_type_trait_variable_templates
+# error "__cpp_lib_type_trait_variable_templates should be defined in c++2a"
+# endif
+# if __cpp_lib_type_trait_variable_templates != 201510L
+# error "__cpp_lib_type_trait_variable_templates should have the value 201510L in c++2a"
+# endif
+
+# ifndef __cpp_lib_void_t
+# error "__cpp_lib_void_t should be defined in c++2a"
+# endif
+# if __cpp_lib_void_t != 201411L
+# error "__cpp_lib_void_t should have the value 201411L in c++2a"
+# endif
+
+#endif // TEST_STD_VER > 17
+
+int main() {}
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/unordered_map.version.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/unordered_map.version.pass.cpp
index d23a91a3091..75ce435dd88 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/unordered_map.version.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/unordered_map.version.pass.cpp
@@ -1,4 +1,3 @@
-
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
@@ -8,41 +7,165 @@
//
//===----------------------------------------------------------------------===//
//
-// <unordered_map> feature macros
+// WARNING: This test was generated by generate_feature_test_macros_tests.py and
+// should not be edited manually.
+
+// <unordered_map>
-/* Constant Value
- __cpp_lib_allocator_traits_is_always_equal 201411L
- __cpp_lib_erase_if 201811L
- __cpp_lib_node_extract 201606L
- __cpp_lib_nonmember_container_access 201411L
- __cpp_lib_unordered_map_try_emplace 201411L
+// Test the feature test macros defined by <unordered_map>
+/* Constant Value
+ __cpp_lib_allocator_traits_is_always_equal 201411L [C++17]
+ __cpp_lib_erase_if 201811L [C++2a]
+ __cpp_lib_generic_unordered_lookup 201811L [C++2a]
+ __cpp_lib_node_extract 201606L [C++17]
+ __cpp_lib_nonmember_container_access 201411L [C++17]
+ __cpp_lib_unordered_map_try_emplace 201411L [C++17]
*/
#include <unordered_map>
-#include <cassert>
#include "test_macros.h"
-int main()
-{
-// ensure that the macros that are supposed to be defined in <unordered_map> are defined.
+#if TEST_STD_VER < 14
-#if TEST_STD_VER > 17
-# if !defined(__cpp_lib_erase_if)
- LIBCPP_STATIC_ASSERT(false, "__cpp_lib_erase_if is not defined");
-# else
-# if __cpp_lib_erase_if < 201811L
-# error "__cpp_lib_erase_if has an invalid value"
-# endif
+# ifdef __cpp_lib_allocator_traits_is_always_equal
+# error "__cpp_lib_allocator_traits_is_always_equal should not be defined before c++17"
# endif
-#endif
+# ifdef __cpp_lib_erase_if
+# error "__cpp_lib_erase_if should not be defined before c++2a"
+# endif
-/*
-#if !defined(__cpp_lib_fooby)
-# error "__cpp_lib_fooby is not defined"
-#elif __cpp_lib_fooby < 201606L
-# error "__cpp_lib_fooby has an invalid value"
-#endif
-*/
-}
+# ifdef __cpp_lib_generic_unordered_lookup
+# error "__cpp_lib_generic_unordered_lookup should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_node_extract
+# error "__cpp_lib_node_extract should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_nonmember_container_access
+# error "__cpp_lib_nonmember_container_access should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_unordered_map_try_emplace
+# error "__cpp_lib_unordered_map_try_emplace should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 14
+
+# ifdef __cpp_lib_allocator_traits_is_always_equal
+# error "__cpp_lib_allocator_traits_is_always_equal should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_erase_if
+# error "__cpp_lib_erase_if should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_generic_unordered_lookup
+# error "__cpp_lib_generic_unordered_lookup should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_node_extract
+# error "__cpp_lib_node_extract should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_nonmember_container_access
+# error "__cpp_lib_nonmember_container_access should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_unordered_map_try_emplace
+# error "__cpp_lib_unordered_map_try_emplace should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 17
+
+# ifndef __cpp_lib_allocator_traits_is_always_equal
+# error "__cpp_lib_allocator_traits_is_always_equal should be defined in c++17"
+# endif
+# if __cpp_lib_allocator_traits_is_always_equal != 201411L
+# error "__cpp_lib_allocator_traits_is_always_equal should have the value 201411L in c++17"
+# endif
+
+# ifdef __cpp_lib_erase_if
+# error "__cpp_lib_erase_if should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_generic_unordered_lookup
+# error "__cpp_lib_generic_unordered_lookup should not be defined before c++2a"
+# endif
+
+# ifndef __cpp_lib_node_extract
+# error "__cpp_lib_node_extract should be defined in c++17"
+# endif
+# if __cpp_lib_node_extract != 201606L
+# error "__cpp_lib_node_extract should have the value 201606L in c++17"
+# endif
+
+# ifndef __cpp_lib_nonmember_container_access
+# error "__cpp_lib_nonmember_container_access should be defined in c++17"
+# endif
+# if __cpp_lib_nonmember_container_access != 201411L
+# error "__cpp_lib_nonmember_container_access should have the value 201411L in c++17"
+# endif
+
+# ifndef __cpp_lib_unordered_map_try_emplace
+# error "__cpp_lib_unordered_map_try_emplace should be defined in c++17"
+# endif
+# if __cpp_lib_unordered_map_try_emplace != 201411L
+# error "__cpp_lib_unordered_map_try_emplace should have the value 201411L in c++17"
+# endif
+
+#elif TEST_STD_VER > 17
+
+# ifndef __cpp_lib_allocator_traits_is_always_equal
+# error "__cpp_lib_allocator_traits_is_always_equal should be defined in c++2a"
+# endif
+# if __cpp_lib_allocator_traits_is_always_equal != 201411L
+# error "__cpp_lib_allocator_traits_is_always_equal should have the value 201411L in c++2a"
+# endif
+
+# ifndef __cpp_lib_erase_if
+# error "__cpp_lib_erase_if should be defined in c++2a"
+# endif
+# if __cpp_lib_erase_if != 201811L
+# error "__cpp_lib_erase_if should have the value 201811L in c++2a"
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_generic_unordered_lookup
+# error "__cpp_lib_generic_unordered_lookup should be defined in c++2a"
+# endif
+# if __cpp_lib_generic_unordered_lookup != 201811L
+# error "__cpp_lib_generic_unordered_lookup should have the value 201811L in c++2a"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_generic_unordered_lookup
+# error "__cpp_lib_generic_unordered_lookup should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+# ifndef __cpp_lib_node_extract
+# error "__cpp_lib_node_extract should be defined in c++2a"
+# endif
+# if __cpp_lib_node_extract != 201606L
+# error "__cpp_lib_node_extract should have the value 201606L in c++2a"
+# endif
+
+# ifndef __cpp_lib_nonmember_container_access
+# error "__cpp_lib_nonmember_container_access should be defined in c++2a"
+# endif
+# if __cpp_lib_nonmember_container_access != 201411L
+# error "__cpp_lib_nonmember_container_access should have the value 201411L in c++2a"
+# endif
+
+# ifndef __cpp_lib_unordered_map_try_emplace
+# error "__cpp_lib_unordered_map_try_emplace should be defined in c++2a"
+# endif
+# if __cpp_lib_unordered_map_try_emplace != 201411L
+# error "__cpp_lib_unordered_map_try_emplace should have the value 201411L in c++2a"
+# endif
+
+#endif // TEST_STD_VER > 17
+
+int main() {}
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/unordered_set.version.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/unordered_set.version.pass.cpp
index c4dbed14b9c..c08a8fbd749 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/unordered_set.version.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/unordered_set.version.pass.cpp
@@ -1,4 +1,3 @@
-
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
@@ -8,39 +7,142 @@
//
//===----------------------------------------------------------------------===//
//
-// <unordered_set> feature macros
+// WARNING: This test was generated by generate_feature_test_macros_tests.py and
+// should not be edited manually.
+
+// <unordered_set>
-/* Constant Value
- __cpp_lib_allocator_traits_is_always_equal 201411L
- __cpp_lib_erase_if 201811L
- __cpp_lib_node_extract 201606L
- __cpp_lib_nonmember_container_access 201411L
+// Test the feature test macros defined by <unordered_set>
+/* Constant Value
+ __cpp_lib_allocator_traits_is_always_equal 201411L [C++17]
+ __cpp_lib_erase_if 201811L [C++2a]
+ __cpp_lib_generic_unordered_lookup 201811L [C++2a]
+ __cpp_lib_node_extract 201606L [C++17]
+ __cpp_lib_nonmember_container_access 201411L [C++17]
*/
#include <unordered_set>
-#include <cassert>
#include "test_macros.h"
-int main()
-{
-// ensure that the macros that are supposed to be defined in <unordered_set> are defined.
-
-#if TEST_STD_VER > 17
-# if !defined(__cpp_lib_erase_if)
- LIBCPP_STATIC_ASSERT(false, "__cpp_lib_erase_if is not defined");
-# else
-# if __cpp_lib_erase_if < 201811L
-# error "__cpp_lib_erase_if has an invalid value"
-# endif
-# endif
-#endif
-
-/*
-#if !defined(__cpp_lib_fooby)
-# error "__cpp_lib_fooby is not defined"
-#elif __cpp_lib_fooby < 201606L
-# error "__cpp_lib_fooby has an invalid value"
-#endif
-*/
-}
+#if TEST_STD_VER < 14
+
+# ifdef __cpp_lib_allocator_traits_is_always_equal
+# error "__cpp_lib_allocator_traits_is_always_equal should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_erase_if
+# error "__cpp_lib_erase_if should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_generic_unordered_lookup
+# error "__cpp_lib_generic_unordered_lookup should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_node_extract
+# error "__cpp_lib_node_extract should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_nonmember_container_access
+# error "__cpp_lib_nonmember_container_access should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 14
+
+# ifdef __cpp_lib_allocator_traits_is_always_equal
+# error "__cpp_lib_allocator_traits_is_always_equal should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_erase_if
+# error "__cpp_lib_erase_if should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_generic_unordered_lookup
+# error "__cpp_lib_generic_unordered_lookup should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_node_extract
+# error "__cpp_lib_node_extract should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_nonmember_container_access
+# error "__cpp_lib_nonmember_container_access should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 17
+
+# ifndef __cpp_lib_allocator_traits_is_always_equal
+# error "__cpp_lib_allocator_traits_is_always_equal should be defined in c++17"
+# endif
+# if __cpp_lib_allocator_traits_is_always_equal != 201411L
+# error "__cpp_lib_allocator_traits_is_always_equal should have the value 201411L in c++17"
+# endif
+
+# ifdef __cpp_lib_erase_if
+# error "__cpp_lib_erase_if should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_generic_unordered_lookup
+# error "__cpp_lib_generic_unordered_lookup should not be defined before c++2a"
+# endif
+
+# ifndef __cpp_lib_node_extract
+# error "__cpp_lib_node_extract should be defined in c++17"
+# endif
+# if __cpp_lib_node_extract != 201606L
+# error "__cpp_lib_node_extract should have the value 201606L in c++17"
+# endif
+
+# ifndef __cpp_lib_nonmember_container_access
+# error "__cpp_lib_nonmember_container_access should be defined in c++17"
+# endif
+# if __cpp_lib_nonmember_container_access != 201411L
+# error "__cpp_lib_nonmember_container_access should have the value 201411L in c++17"
+# endif
+
+#elif TEST_STD_VER > 17
+
+# ifndef __cpp_lib_allocator_traits_is_always_equal
+# error "__cpp_lib_allocator_traits_is_always_equal should be defined in c++2a"
+# endif
+# if __cpp_lib_allocator_traits_is_always_equal != 201411L
+# error "__cpp_lib_allocator_traits_is_always_equal should have the value 201411L in c++2a"
+# endif
+
+# ifndef __cpp_lib_erase_if
+# error "__cpp_lib_erase_if should be defined in c++2a"
+# endif
+# if __cpp_lib_erase_if != 201811L
+# error "__cpp_lib_erase_if should have the value 201811L in c++2a"
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_generic_unordered_lookup
+# error "__cpp_lib_generic_unordered_lookup should be defined in c++2a"
+# endif
+# if __cpp_lib_generic_unordered_lookup != 201811L
+# error "__cpp_lib_generic_unordered_lookup should have the value 201811L in c++2a"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_generic_unordered_lookup
+# error "__cpp_lib_generic_unordered_lookup should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+# ifndef __cpp_lib_node_extract
+# error "__cpp_lib_node_extract should be defined in c++2a"
+# endif
+# if __cpp_lib_node_extract != 201606L
+# error "__cpp_lib_node_extract should have the value 201606L in c++2a"
+# endif
+
+# ifndef __cpp_lib_nonmember_container_access
+# error "__cpp_lib_nonmember_container_access should be defined in c++2a"
+# endif
+# if __cpp_lib_nonmember_container_access != 201411L
+# error "__cpp_lib_nonmember_container_access should have the value 201411L in c++2a"
+# endif
+
+#endif // TEST_STD_VER > 17
+
+int main() {}
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/utility.version.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/utility.version.pass.cpp
index dff687f4b1d..e24e0a38b78 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/utility.version.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/utility.version.pass.cpp
@@ -1,4 +1,3 @@
-
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
@@ -8,29 +7,189 @@
//
//===----------------------------------------------------------------------===//
//
-// <utility> feature macros
+// WARNING: This test was generated by generate_feature_test_macros_tests.py and
+// should not be edited manually.
+
+// <utility>
-/* Constant Value
- __cpp_lib_as_const 201510L
- __cpp_lib_exchange_function 201304L
- __cpp_lib_integer_sequence 201304L
- __cpp_lib_tuples_by_type 201304L
+// Test the feature test macros defined by <utility>
+/* Constant Value
+ __cpp_lib_as_const 201510L [C++17]
+ __cpp_lib_constexpr_misc 201811L [C++2a]
+ __cpp_lib_exchange_function 201304L [C++14]
+ __cpp_lib_integer_sequence 201304L [C++14]
+ __cpp_lib_to_chars 201611L [C++17]
+ __cpp_lib_tuples_by_type 201304L [C++14]
*/
#include <utility>
-#include <cassert>
#include "test_macros.h"
-int main()
-{
-// ensure that the macros that are supposed to be defined in <utility> are defined.
+#if TEST_STD_VER < 14
-/*
-#if !defined(__cpp_lib_fooby)
-# error "__cpp_lib_fooby is not defined"
-#elif __cpp_lib_fooby < 201606L
-# error "__cpp_lib_fooby has an invalid value"
-#endif
-*/
-}
+# ifdef __cpp_lib_as_const
+# error "__cpp_lib_as_const should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_constexpr_misc
+# error "__cpp_lib_constexpr_misc should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_exchange_function
+# error "__cpp_lib_exchange_function should not be defined before c++14"
+# endif
+
+# ifdef __cpp_lib_integer_sequence
+# error "__cpp_lib_integer_sequence should not be defined before c++14"
+# endif
+
+# ifdef __cpp_lib_to_chars
+# error "__cpp_lib_to_chars should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_tuples_by_type
+# error "__cpp_lib_tuples_by_type should not be defined before c++14"
+# endif
+
+#elif TEST_STD_VER == 14
+
+# ifdef __cpp_lib_as_const
+# error "__cpp_lib_as_const should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_constexpr_misc
+# error "__cpp_lib_constexpr_misc should not be defined before c++2a"
+# endif
+
+# ifndef __cpp_lib_exchange_function
+# error "__cpp_lib_exchange_function should be defined in c++14"
+# endif
+# if __cpp_lib_exchange_function != 201304L
+# error "__cpp_lib_exchange_function should have the value 201304L in c++14"
+# endif
+
+# ifndef __cpp_lib_integer_sequence
+# error "__cpp_lib_integer_sequence should be defined in c++14"
+# endif
+# if __cpp_lib_integer_sequence != 201304L
+# error "__cpp_lib_integer_sequence should have the value 201304L in c++14"
+# endif
+
+# ifdef __cpp_lib_to_chars
+# error "__cpp_lib_to_chars should not be defined before c++17"
+# endif
+
+# ifndef __cpp_lib_tuples_by_type
+# error "__cpp_lib_tuples_by_type should be defined in c++14"
+# endif
+# if __cpp_lib_tuples_by_type != 201304L
+# error "__cpp_lib_tuples_by_type should have the value 201304L in c++14"
+# endif
+
+#elif TEST_STD_VER == 17
+
+# ifndef __cpp_lib_as_const
+# error "__cpp_lib_as_const should be defined in c++17"
+# endif
+# if __cpp_lib_as_const != 201510L
+# error "__cpp_lib_as_const should have the value 201510L in c++17"
+# endif
+
+# ifdef __cpp_lib_constexpr_misc
+# error "__cpp_lib_constexpr_misc should not be defined before c++2a"
+# endif
+
+# ifndef __cpp_lib_exchange_function
+# error "__cpp_lib_exchange_function should be defined in c++17"
+# endif
+# if __cpp_lib_exchange_function != 201304L
+# error "__cpp_lib_exchange_function should have the value 201304L in c++17"
+# endif
+
+# ifndef __cpp_lib_integer_sequence
+# error "__cpp_lib_integer_sequence should be defined in c++17"
+# endif
+# if __cpp_lib_integer_sequence != 201304L
+# error "__cpp_lib_integer_sequence should have the value 201304L in c++17"
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_to_chars
+# error "__cpp_lib_to_chars should be defined in c++17"
+# endif
+# if __cpp_lib_to_chars != 201611L
+# error "__cpp_lib_to_chars should have the value 201611L in c++17"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_to_chars
+# error "__cpp_lib_to_chars should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+# ifndef __cpp_lib_tuples_by_type
+# error "__cpp_lib_tuples_by_type should be defined in c++17"
+# endif
+# if __cpp_lib_tuples_by_type != 201304L
+# error "__cpp_lib_tuples_by_type should have the value 201304L in c++17"
+# endif
+
+#elif TEST_STD_VER > 17
+
+# ifndef __cpp_lib_as_const
+# error "__cpp_lib_as_const should be defined in c++2a"
+# endif
+# if __cpp_lib_as_const != 201510L
+# error "__cpp_lib_as_const should have the value 201510L in c++2a"
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_constexpr_misc
+# error "__cpp_lib_constexpr_misc should be defined in c++2a"
+# endif
+# if __cpp_lib_constexpr_misc != 201811L
+# error "__cpp_lib_constexpr_misc should have the value 201811L in c++2a"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_constexpr_misc
+# error "__cpp_lib_constexpr_misc should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+# ifndef __cpp_lib_exchange_function
+# error "__cpp_lib_exchange_function should be defined in c++2a"
+# endif
+# if __cpp_lib_exchange_function != 201304L
+# error "__cpp_lib_exchange_function should have the value 201304L in c++2a"
+# endif
+
+# ifndef __cpp_lib_integer_sequence
+# error "__cpp_lib_integer_sequence should be defined in c++2a"
+# endif
+# if __cpp_lib_integer_sequence != 201304L
+# error "__cpp_lib_integer_sequence should have the value 201304L in c++2a"
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_to_chars
+# error "__cpp_lib_to_chars should be defined in c++2a"
+# endif
+# if __cpp_lib_to_chars != 201611L
+# error "__cpp_lib_to_chars should have the value 201611L in c++2a"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_to_chars
+# error "__cpp_lib_to_chars should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+# ifndef __cpp_lib_tuples_by_type
+# error "__cpp_lib_tuples_by_type should be defined in c++2a"
+# endif
+# if __cpp_lib_tuples_by_type != 201304L
+# error "__cpp_lib_tuples_by_type should have the value 201304L in c++2a"
+# endif
+
+#endif // TEST_STD_VER > 17
+
+int main() {}
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/variant.version.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/variant.version.pass.cpp
index 5532e04464a..b822eb74fe2 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/variant.version.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/variant.version.pass.cpp
@@ -1,4 +1,3 @@
-
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
@@ -8,26 +7,50 @@
//
//===----------------------------------------------------------------------===//
//
-// <variant> feature macros
+// WARNING: This test was generated by generate_feature_test_macros_tests.py and
+// should not be edited manually.
+
+// <variant>
-/* Constant Value
- __cpp_lib_variant 201606L
+// Test the feature test macros defined by <variant>
+/* Constant Value
+ __cpp_lib_variant 201606L [C++17]
*/
#include <variant>
-#include <cassert>
#include "test_macros.h"
-int main()
-{
-// ensure that the macros that are supposed to be defined in <variant> are defined.
+#if TEST_STD_VER < 14
-/*
-#if !defined(__cpp_lib_fooby)
-# error "__cpp_lib_fooby is not defined"
-#elif __cpp_lib_fooby < 201606L
-# error "__cpp_lib_fooby has an invalid value"
-#endif
-*/
-}
+# ifdef __cpp_lib_variant
+# error "__cpp_lib_variant should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 14
+
+# ifdef __cpp_lib_variant
+# error "__cpp_lib_variant should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 17
+
+# ifndef __cpp_lib_variant
+# error "__cpp_lib_variant should be defined in c++17"
+# endif
+# if __cpp_lib_variant != 201606L
+# error "__cpp_lib_variant should have the value 201606L in c++17"
+# endif
+
+#elif TEST_STD_VER > 17
+
+# ifndef __cpp_lib_variant
+# error "__cpp_lib_variant should be defined in c++2a"
+# endif
+# if __cpp_lib_variant != 201606L
+# error "__cpp_lib_variant should have the value 201606L in c++2a"
+# endif
+
+#endif // TEST_STD_VER > 17
+
+int main() {}
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/vector.version.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/vector.version.pass.cpp
index e7cb1942c0b..6ba328d5c69 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/vector.version.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/vector.version.pass.cpp
@@ -1,4 +1,3 @@
-
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
@@ -8,39 +7,116 @@
//
//===----------------------------------------------------------------------===//
//
-// <vector> feature macros
+// WARNING: This test was generated by generate_feature_test_macros_tests.py and
+// should not be edited manually.
+
+// <vector>
-/* Constant Value
- __cpp_lib_allocator_traits_is_always_equal 201411L
- __cpp_lib_erase_if 201811L
- __cpp_lib_incomplete_container_elements 201505L
- __cpp_lib_nonmember_container_access 201411L
+// Test the feature test macros defined by <vector>
+/* Constant Value
+ __cpp_lib_allocator_traits_is_always_equal 201411L [C++17]
+ __cpp_lib_erase_if 201811L [C++2a]
+ __cpp_lib_incomplete_container_elements 201505L [C++17]
+ __cpp_lib_nonmember_container_access 201411L [C++17]
*/
#include <vector>
-#include <cassert>
#include "test_macros.h"
-int main()
-{
-// ensure that the macros that are supposed to be defined in <vector> are defined.
-
-#if TEST_STD_VER > 17
-# if !defined(__cpp_lib_erase_if)
- LIBCPP_STATIC_ASSERT(false, "__cpp_lib_erase_if is not defined");
-# else
-# if __cpp_lib_erase_if < 201811L
-# error "__cpp_lib_erase_if has an invalid value"
-# endif
-# endif
-#endif
-
-/*
-#if !defined(__cpp_lib_fooby)
-# error "__cpp_lib_fooby is not defined"
-#elif __cpp_lib_fooby < 201606L
-# error "__cpp_lib_fooby has an invalid value"
-#endif
-*/
-}
+#if TEST_STD_VER < 14
+
+# ifdef __cpp_lib_allocator_traits_is_always_equal
+# error "__cpp_lib_allocator_traits_is_always_equal should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_erase_if
+# error "__cpp_lib_erase_if should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_incomplete_container_elements
+# error "__cpp_lib_incomplete_container_elements should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_nonmember_container_access
+# error "__cpp_lib_nonmember_container_access should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 14
+
+# ifdef __cpp_lib_allocator_traits_is_always_equal
+# error "__cpp_lib_allocator_traits_is_always_equal should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_erase_if
+# error "__cpp_lib_erase_if should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_incomplete_container_elements
+# error "__cpp_lib_incomplete_container_elements should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_nonmember_container_access
+# error "__cpp_lib_nonmember_container_access should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 17
+
+# ifndef __cpp_lib_allocator_traits_is_always_equal
+# error "__cpp_lib_allocator_traits_is_always_equal should be defined in c++17"
+# endif
+# if __cpp_lib_allocator_traits_is_always_equal != 201411L
+# error "__cpp_lib_allocator_traits_is_always_equal should have the value 201411L in c++17"
+# endif
+
+# ifdef __cpp_lib_erase_if
+# error "__cpp_lib_erase_if should not be defined before c++2a"
+# endif
+
+# ifndef __cpp_lib_incomplete_container_elements
+# error "__cpp_lib_incomplete_container_elements should be defined in c++17"
+# endif
+# if __cpp_lib_incomplete_container_elements != 201505L
+# error "__cpp_lib_incomplete_container_elements should have the value 201505L in c++17"
+# endif
+
+# ifndef __cpp_lib_nonmember_container_access
+# error "__cpp_lib_nonmember_container_access should be defined in c++17"
+# endif
+# if __cpp_lib_nonmember_container_access != 201411L
+# error "__cpp_lib_nonmember_container_access should have the value 201411L in c++17"
+# endif
+
+#elif TEST_STD_VER > 17
+
+# ifndef __cpp_lib_allocator_traits_is_always_equal
+# error "__cpp_lib_allocator_traits_is_always_equal should be defined in c++2a"
+# endif
+# if __cpp_lib_allocator_traits_is_always_equal != 201411L
+# error "__cpp_lib_allocator_traits_is_always_equal should have the value 201411L in c++2a"
+# endif
+
+# ifndef __cpp_lib_erase_if
+# error "__cpp_lib_erase_if should be defined in c++2a"
+# endif
+# if __cpp_lib_erase_if != 201811L
+# error "__cpp_lib_erase_if should have the value 201811L in c++2a"
+# endif
+
+# ifndef __cpp_lib_incomplete_container_elements
+# error "__cpp_lib_incomplete_container_elements should be defined in c++2a"
+# endif
+# if __cpp_lib_incomplete_container_elements != 201505L
+# error "__cpp_lib_incomplete_container_elements should have the value 201505L in c++2a"
+# endif
+
+# ifndef __cpp_lib_nonmember_container_access
+# error "__cpp_lib_nonmember_container_access should be defined in c++2a"
+# endif
+# if __cpp_lib_nonmember_container_access != 201411L
+# error "__cpp_lib_nonmember_container_access should have the value 201411L in c++2a"
+# endif
+
+#endif // TEST_STD_VER > 17
+
+int main() {}
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.pass.cpp
index 29fe4b29890..6f7d649f5de 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.pass.cpp
@@ -1,4 +1,3 @@
-
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
@@ -8,142 +7,2130 @@
//
//===----------------------------------------------------------------------===//
//
-// <version> feature macros
-
-/* Constant Value
- __cpp_lib_addressof_constexpr 201603L
- __cpp_lib_allocator_traits_is_always_equal 201411L
- __cpp_lib_any 201606L
- __cpp_lib_apply 201603L
- __cpp_lib_array_constexpr 201603L
- __cpp_lib_as_const 201510L
- __cpp_lib_atomic_is_always_lock_free 201603L
- __cpp_lib_atomic_ref 201806L
- __cpp_lib_bit_cast 201806L
- __cpp_lib_bool_constant 201505L
- __cpp_lib_boyer_moore_searcher 201603L
- __cpp_lib_byte 201603L
- __cpp_lib_chrono 201611L
- __cpp_lib_chrono_udls 201304L
- __cpp_lib_clamp 201603L
- __cpp_lib_complex_udls 201309L
- __cpp_lib_concepts 201806L
- __cpp_lib_constexpr_swap_algorithms 201806L
- __cpp_lib_destroying_delete 201806L
- __cpp_lib_enable_shared_from_this 201603L
- __cpp_lib_exchange_function 201304L
- __cpp_lib_execution 201603L
- __cpp_lib_filesystem 201703L
- __cpp_lib_gcd_lcm 201606L
- __cpp_lib_generic_associative_lookup 201304L
- __cpp_lib_hardware_interference_size 201703L
- __cpp_lib_has_unique_object_representations 201606L
- __cpp_lib_hypot 201603L
- __cpp_lib_incomplete_container_elements 201505L
- __cpp_lib_integer_sequence 201304L
- __cpp_lib_integral_constant_callable 201304L
- __cpp_lib_invoke 201411L
- __cpp_lib_is_aggregate 201703L
- __cpp_lib_is_final 201402L
- __cpp_lib_is_invocable 201703L
- __cpp_lib_is_null_pointer 201309L
- __cpp_lib_is_swappable 201603L
- __cpp_lib_launder 201606L
- __cpp_lib_list_remove_return_type 201806L
- __cpp_lib_logical_traits 201510L
- __cpp_lib_make_from_tuple 201606L
- __cpp_lib_make_reverse_iterator 201402L
- __cpp_lib_make_unique 201304L
- __cpp_lib_map_try_emplace 201411L
- __cpp_lib_math_special_functions 201603L
- __cpp_lib_memory_resource 201603L
- __cpp_lib_node_extract 201606L
- __cpp_lib_nonmember_container_access 201411L
- __cpp_lib_not_fn 201603L
- __cpp_lib_null_iterators 201304L
- __cpp_lib_optional 201606L
- __cpp_lib_parallel_algorithm 201603L
- __cpp_lib_quoted_string_io 201304L
- __cpp_lib_raw_memory_algorithms 201606L
- __cpp_lib_result_of_sfinae 201210L
- __cpp_lib_robust_nonmodifying_seq_ops 201304L
- __cpp_lib_sample 201603L
- __cpp_lib_scoped_lock 201703L
- __cpp_lib_shared_mutex 201505L
- __cpp_lib_shared_ptr_arrays 201611L
- __cpp_lib_shared_ptr_weak_type 201606L
- __cpp_lib_shared_timed_mutex 201402L
- __cpp_lib_string_udls 201304L
- __cpp_lib_string_view 201606L
- __cpp_lib_to_chars 201611L
- __cpp_lib_three_way_comparison 201711L
- __cpp_lib_transformation_trait_aliases 201304L
- __cpp_lib_transparent_operators 201510L
- __cpp_lib_tuple_element_t 201402L
- __cpp_lib_tuples_by_type 201304L
- __cpp_lib_type_trait_variable_templates 201510L
- __cpp_lib_uncaught_exceptions 201411L
- __cpp_lib_unordered_map_try_emplace 201411L
- __cpp_lib_variant 201606L
- __cpp_lib_void_t 201411L
+// WARNING: This test was generated by generate_feature_test_macros_tests.py and
+// should not be edited manually.
+
+// <version>
+// Test the feature test macros defined by <version>
+
+/* Constant Value
+ __cpp_lib_addressof_constexpr 201603L [C++17]
+ __cpp_lib_allocator_traits_is_always_equal 201411L [C++17]
+ __cpp_lib_any 201606L [C++17]
+ __cpp_lib_apply 201603L [C++17]
+ __cpp_lib_array_constexpr 201603L [C++17]
+ __cpp_lib_as_const 201510L [C++17]
+ __cpp_lib_atomic_is_always_lock_free 201603L [C++17]
+ __cpp_lib_atomic_ref 201806L [C++2a]
+ __cpp_lib_bind_front 201811L [C++2a]
+ __cpp_lib_bit_cast 201806L [C++2a]
+ __cpp_lib_bool_constant 201505L [C++17]
+ __cpp_lib_boyer_moore_searcher 201603L [C++17]
+ __cpp_lib_byte 201603L [C++17]
+ __cpp_lib_char8_t 201811L [C++2a]
+ __cpp_lib_chrono 201611L [C++17]
+ __cpp_lib_chrono_udls 201304L [C++14]
+ __cpp_lib_clamp 201603L [C++17]
+ __cpp_lib_complex_udls 201309L [C++14]
+ __cpp_lib_concepts 201806L [C++2a]
+ __cpp_lib_constexpr_misc 201811L [C++2a]
+ __cpp_lib_constexpr_swap_algorithms 201806L [C++2a]
+ __cpp_lib_destroying_delete 201806L [C++2a]
+ __cpp_lib_enable_shared_from_this 201603L [C++17]
+ __cpp_lib_erase_if 201811L [C++2a]
+ __cpp_lib_exchange_function 201304L [C++14]
+ __cpp_lib_execution 201603L [C++17]
+ __cpp_lib_filesystem 201703L [C++17]
+ __cpp_lib_gcd_lcm 201606L [C++17]
+ __cpp_lib_generic_associative_lookup 201304L [C++14]
+ __cpp_lib_generic_unordered_lookup 201811L [C++2a]
+ __cpp_lib_hardware_interference_size 201703L [C++17]
+ __cpp_lib_has_unique_object_representations 201606L [C++17]
+ __cpp_lib_hypot 201603L [C++17]
+ __cpp_lib_incomplete_container_elements 201505L [C++17]
+ __cpp_lib_integer_sequence 201304L [C++14]
+ __cpp_lib_integral_constant_callable 201304L [C++14]
+ __cpp_lib_invoke 201411L [C++17]
+ __cpp_lib_is_aggregate 201703L [C++17]
+ __cpp_lib_is_constant_evaluated 201811L [C++2a]
+ __cpp_lib_is_final 201402L [C++14]
+ __cpp_lib_is_invocable 201703L [C++17]
+ __cpp_lib_is_null_pointer 201309L [C++14]
+ __cpp_lib_is_swappable 201603L [C++17]
+ __cpp_lib_launder 201606L [C++17]
+ __cpp_lib_list_remove_return_type 201806L [C++2a]
+ __cpp_lib_logical_traits 201510L [C++17]
+ __cpp_lib_make_from_tuple 201606L [C++17]
+ __cpp_lib_make_reverse_iterator 201402L [C++14]
+ __cpp_lib_make_unique 201304L [C++14]
+ __cpp_lib_map_try_emplace 201411L [C++17]
+ __cpp_lib_math_special_functions 201603L [C++17]
+ __cpp_lib_memory_resource 201603L [C++17]
+ __cpp_lib_node_extract 201606L [C++17]
+ __cpp_lib_nonmember_container_access 201411L [C++17]
+ __cpp_lib_not_fn 201603L [C++17]
+ __cpp_lib_null_iterators 201304L [C++14]
+ __cpp_lib_optional 201606L [C++17]
+ __cpp_lib_parallel_algorithm 201603L [C++17]
+ __cpp_lib_quoted_string_io 201304L [C++14]
+ __cpp_lib_ranges 201811L [C++2a]
+ __cpp_lib_raw_memory_algorithms 201606L [C++17]
+ __cpp_lib_result_of_sfinae 201210L [C++14]
+ __cpp_lib_robust_nonmodifying_seq_ops 201304L [C++14]
+ __cpp_lib_sample 201603L [C++17]
+ __cpp_lib_scoped_lock 201703L [C++17]
+ __cpp_lib_shared_mutex 201505L [C++17]
+ __cpp_lib_shared_ptr_arrays 201611L [C++17]
+ __cpp_lib_shared_ptr_weak_type 201606L [C++17]
+ __cpp_lib_shared_timed_mutex 201402L [C++14]
+ __cpp_lib_string_udls 201304L [C++14]
+ __cpp_lib_string_view 201606L [C++17]
+ __cpp_lib_three_way_comparison 201711L [C++2a]
+ __cpp_lib_to_chars 201611L [C++17]
+ __cpp_lib_transformation_trait_aliases 201304L [C++14]
+ __cpp_lib_transparent_operators 201210L [C++14]
+ 201510L [C++17]
+ __cpp_lib_tuple_element_t 201402L [C++14]
+ __cpp_lib_tuples_by_type 201304L [C++14]
+ __cpp_lib_type_trait_variable_templates 201510L [C++17]
+ __cpp_lib_uncaught_exceptions 201411L [C++17]
+ __cpp_lib_unordered_map_try_emplace 201411L [C++17]
+ __cpp_lib_variant 201606L [C++17]
+ __cpp_lib_void_t 201411L [C++17]
*/
#include <version>
-#include <cassert>
#include "test_macros.h"
-int main()
-{
-// ensure that the macros that are supposed to be defined in <version> are defined.
+#if TEST_STD_VER < 14
+
+# ifdef __cpp_lib_addressof_constexpr
+# error "__cpp_lib_addressof_constexpr should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_allocator_traits_is_always_equal
+# error "__cpp_lib_allocator_traits_is_always_equal should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_any
+# error "__cpp_lib_any should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_apply
+# error "__cpp_lib_apply should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_array_constexpr
+# error "__cpp_lib_array_constexpr should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_as_const
+# error "__cpp_lib_as_const should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_atomic_is_always_lock_free
+# error "__cpp_lib_atomic_is_always_lock_free should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_atomic_ref
+# error "__cpp_lib_atomic_ref should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_bind_front
+# error "__cpp_lib_bind_front should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_bit_cast
+# error "__cpp_lib_bit_cast should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_bool_constant
+# error "__cpp_lib_bool_constant should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_boyer_moore_searcher
+# error "__cpp_lib_boyer_moore_searcher should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_byte
+# error "__cpp_lib_byte should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_char8_t
+# error "__cpp_lib_char8_t should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_chrono
+# error "__cpp_lib_chrono should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_chrono_udls
+# error "__cpp_lib_chrono_udls should not be defined before c++14"
+# endif
+
+# ifdef __cpp_lib_clamp
+# error "__cpp_lib_clamp should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_complex_udls
+# error "__cpp_lib_complex_udls should not be defined before c++14"
+# endif
+
+# ifdef __cpp_lib_concepts
+# error "__cpp_lib_concepts should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_constexpr_misc
+# error "__cpp_lib_constexpr_misc should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_constexpr_swap_algorithms
+# error "__cpp_lib_constexpr_swap_algorithms should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_destroying_delete
+# error "__cpp_lib_destroying_delete should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_enable_shared_from_this
+# error "__cpp_lib_enable_shared_from_this should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_erase_if
+# error "__cpp_lib_erase_if should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_exchange_function
+# error "__cpp_lib_exchange_function should not be defined before c++14"
+# endif
+
+# ifdef __cpp_lib_execution
+# error "__cpp_lib_execution should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_filesystem
+# error "__cpp_lib_filesystem should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_gcd_lcm
+# error "__cpp_lib_gcd_lcm should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_generic_associative_lookup
+# error "__cpp_lib_generic_associative_lookup should not be defined before c++14"
+# endif
+
+# ifdef __cpp_lib_generic_unordered_lookup
+# error "__cpp_lib_generic_unordered_lookup should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_hardware_interference_size
+# error "__cpp_lib_hardware_interference_size should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_has_unique_object_representations
+# error "__cpp_lib_has_unique_object_representations should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_hypot
+# error "__cpp_lib_hypot should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_incomplete_container_elements
+# error "__cpp_lib_incomplete_container_elements should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_integer_sequence
+# error "__cpp_lib_integer_sequence should not be defined before c++14"
+# endif
+
+# ifdef __cpp_lib_integral_constant_callable
+# error "__cpp_lib_integral_constant_callable should not be defined before c++14"
+# endif
+
+# ifdef __cpp_lib_invoke
+# error "__cpp_lib_invoke should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_is_aggregate
+# error "__cpp_lib_is_aggregate should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_is_constant_evaluated
+# error "__cpp_lib_is_constant_evaluated should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_is_final
+# error "__cpp_lib_is_final should not be defined before c++14"
+# endif
+
+# ifdef __cpp_lib_is_invocable
+# error "__cpp_lib_is_invocable should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_is_null_pointer
+# error "__cpp_lib_is_null_pointer should not be defined before c++14"
+# endif
+
+# ifdef __cpp_lib_is_swappable
+# error "__cpp_lib_is_swappable should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_launder
+# error "__cpp_lib_launder should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_list_remove_return_type
+# error "__cpp_lib_list_remove_return_type should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_logical_traits
+# error "__cpp_lib_logical_traits should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_make_from_tuple
+# error "__cpp_lib_make_from_tuple should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_make_reverse_iterator
+# error "__cpp_lib_make_reverse_iterator should not be defined before c++14"
+# endif
+
+# ifdef __cpp_lib_make_unique
+# error "__cpp_lib_make_unique should not be defined before c++14"
+# endif
+
+# ifdef __cpp_lib_map_try_emplace
+# error "__cpp_lib_map_try_emplace should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_math_special_functions
+# error "__cpp_lib_math_special_functions should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_memory_resource
+# error "__cpp_lib_memory_resource should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_node_extract
+# error "__cpp_lib_node_extract should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_nonmember_container_access
+# error "__cpp_lib_nonmember_container_access should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_not_fn
+# error "__cpp_lib_not_fn should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_null_iterators
+# error "__cpp_lib_null_iterators should not be defined before c++14"
+# endif
+
+# ifdef __cpp_lib_optional
+# error "__cpp_lib_optional should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_parallel_algorithm
+# error "__cpp_lib_parallel_algorithm should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_quoted_string_io
+# error "__cpp_lib_quoted_string_io should not be defined before c++14"
+# endif
+
+# ifdef __cpp_lib_ranges
+# error "__cpp_lib_ranges should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_raw_memory_algorithms
+# error "__cpp_lib_raw_memory_algorithms should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_result_of_sfinae
+# error "__cpp_lib_result_of_sfinae should not be defined before c++14"
+# endif
+
+# ifdef __cpp_lib_robust_nonmodifying_seq_ops
+# error "__cpp_lib_robust_nonmodifying_seq_ops should not be defined before c++14"
+# endif
+
+# ifdef __cpp_lib_sample
+# error "__cpp_lib_sample should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_scoped_lock
+# error "__cpp_lib_scoped_lock should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_shared_mutex
+# error "__cpp_lib_shared_mutex should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_shared_ptr_arrays
+# error "__cpp_lib_shared_ptr_arrays should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_shared_ptr_weak_type
+# error "__cpp_lib_shared_ptr_weak_type should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_shared_timed_mutex
+# error "__cpp_lib_shared_timed_mutex should not be defined before c++14"
+# endif
+
+# ifdef __cpp_lib_string_udls
+# error "__cpp_lib_string_udls should not be defined before c++14"
+# endif
+
+# ifdef __cpp_lib_string_view
+# error "__cpp_lib_string_view should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_three_way_comparison
+# error "__cpp_lib_three_way_comparison should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_to_chars
+# error "__cpp_lib_to_chars should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_transformation_trait_aliases
+# error "__cpp_lib_transformation_trait_aliases should not be defined before c++14"
+# endif
+
+# ifdef __cpp_lib_transparent_operators
+# error "__cpp_lib_transparent_operators should not be defined before c++14"
+# endif
+
+# ifdef __cpp_lib_tuple_element_t
+# error "__cpp_lib_tuple_element_t should not be defined before c++14"
+# endif
+
+# ifdef __cpp_lib_tuples_by_type
+# error "__cpp_lib_tuples_by_type should not be defined before c++14"
+# endif
+
+# ifdef __cpp_lib_type_trait_variable_templates
+# error "__cpp_lib_type_trait_variable_templates should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_uncaught_exceptions
+# error "__cpp_lib_uncaught_exceptions should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_unordered_map_try_emplace
+# error "__cpp_lib_unordered_map_try_emplace should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_variant
+# error "__cpp_lib_variant should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_void_t
+# error "__cpp_lib_void_t should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 14
+
+# ifdef __cpp_lib_addressof_constexpr
+# error "__cpp_lib_addressof_constexpr should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_allocator_traits_is_always_equal
+# error "__cpp_lib_allocator_traits_is_always_equal should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_any
+# error "__cpp_lib_any should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_apply
+# error "__cpp_lib_apply should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_array_constexpr
+# error "__cpp_lib_array_constexpr should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_as_const
+# error "__cpp_lib_as_const should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_atomic_is_always_lock_free
+# error "__cpp_lib_atomic_is_always_lock_free should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_atomic_ref
+# error "__cpp_lib_atomic_ref should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_bind_front
+# error "__cpp_lib_bind_front should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_bit_cast
+# error "__cpp_lib_bit_cast should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_bool_constant
+# error "__cpp_lib_bool_constant should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_boyer_moore_searcher
+# error "__cpp_lib_boyer_moore_searcher should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_byte
+# error "__cpp_lib_byte should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_char8_t
+# error "__cpp_lib_char8_t should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_chrono
+# error "__cpp_lib_chrono should not be defined before c++17"
+# endif
+
+# ifndef __cpp_lib_chrono_udls
+# error "__cpp_lib_chrono_udls should be defined in c++14"
+# endif
+# if __cpp_lib_chrono_udls != 201304L
+# error "__cpp_lib_chrono_udls should have the value 201304L in c++14"
+# endif
+
+# ifdef __cpp_lib_clamp
+# error "__cpp_lib_clamp should not be defined before c++17"
+# endif
+
+# ifndef __cpp_lib_complex_udls
+# error "__cpp_lib_complex_udls should be defined in c++14"
+# endif
+# if __cpp_lib_complex_udls != 201309L
+# error "__cpp_lib_complex_udls should have the value 201309L in c++14"
+# endif
+
+# ifdef __cpp_lib_concepts
+# error "__cpp_lib_concepts should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_constexpr_misc
+# error "__cpp_lib_constexpr_misc should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_constexpr_swap_algorithms
+# error "__cpp_lib_constexpr_swap_algorithms should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_destroying_delete
+# error "__cpp_lib_destroying_delete should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_enable_shared_from_this
+# error "__cpp_lib_enable_shared_from_this should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_erase_if
+# error "__cpp_lib_erase_if should not be defined before c++2a"
+# endif
+
+# ifndef __cpp_lib_exchange_function
+# error "__cpp_lib_exchange_function should be defined in c++14"
+# endif
+# if __cpp_lib_exchange_function != 201304L
+# error "__cpp_lib_exchange_function should have the value 201304L in c++14"
+# endif
+
+# ifdef __cpp_lib_execution
+# error "__cpp_lib_execution should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_filesystem
+# error "__cpp_lib_filesystem should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_gcd_lcm
+# error "__cpp_lib_gcd_lcm should not be defined before c++17"
+# endif
+
+# ifndef __cpp_lib_generic_associative_lookup
+# error "__cpp_lib_generic_associative_lookup should be defined in c++14"
+# endif
+# if __cpp_lib_generic_associative_lookup != 201304L
+# error "__cpp_lib_generic_associative_lookup should have the value 201304L in c++14"
+# endif
+
+# ifdef __cpp_lib_generic_unordered_lookup
+# error "__cpp_lib_generic_unordered_lookup should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_hardware_interference_size
+# error "__cpp_lib_hardware_interference_size should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_has_unique_object_representations
+# error "__cpp_lib_has_unique_object_representations should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_hypot
+# error "__cpp_lib_hypot should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_incomplete_container_elements
+# error "__cpp_lib_incomplete_container_elements should not be defined before c++17"
+# endif
+
+# ifndef __cpp_lib_integer_sequence
+# error "__cpp_lib_integer_sequence should be defined in c++14"
+# endif
+# if __cpp_lib_integer_sequence != 201304L
+# error "__cpp_lib_integer_sequence should have the value 201304L in c++14"
+# endif
+
+# ifndef __cpp_lib_integral_constant_callable
+# error "__cpp_lib_integral_constant_callable should be defined in c++14"
+# endif
+# if __cpp_lib_integral_constant_callable != 201304L
+# error "__cpp_lib_integral_constant_callable should have the value 201304L in c++14"
+# endif
+
+# ifdef __cpp_lib_invoke
+# error "__cpp_lib_invoke should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_is_aggregate
+# error "__cpp_lib_is_aggregate should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_is_constant_evaluated
+# error "__cpp_lib_is_constant_evaluated should not be defined before c++2a"
+# endif
+
+# ifndef __cpp_lib_is_final
+# error "__cpp_lib_is_final should be defined in c++14"
+# endif
+# if __cpp_lib_is_final != 201402L
+# error "__cpp_lib_is_final should have the value 201402L in c++14"
+# endif
+
+# ifdef __cpp_lib_is_invocable
+# error "__cpp_lib_is_invocable should not be defined before c++17"
+# endif
+
+# ifndef __cpp_lib_is_null_pointer
+# error "__cpp_lib_is_null_pointer should be defined in c++14"
+# endif
+# if __cpp_lib_is_null_pointer != 201309L
+# error "__cpp_lib_is_null_pointer should have the value 201309L in c++14"
+# endif
+
+# ifdef __cpp_lib_is_swappable
+# error "__cpp_lib_is_swappable should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_launder
+# error "__cpp_lib_launder should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_list_remove_return_type
+# error "__cpp_lib_list_remove_return_type should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_logical_traits
+# error "__cpp_lib_logical_traits should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_make_from_tuple
+# error "__cpp_lib_make_from_tuple should not be defined before c++17"
+# endif
+
+# ifndef __cpp_lib_make_reverse_iterator
+# error "__cpp_lib_make_reverse_iterator should be defined in c++14"
+# endif
+# if __cpp_lib_make_reverse_iterator != 201402L
+# error "__cpp_lib_make_reverse_iterator should have the value 201402L in c++14"
+# endif
+
+# ifndef __cpp_lib_make_unique
+# error "__cpp_lib_make_unique should be defined in c++14"
+# endif
+# if __cpp_lib_make_unique != 201304L
+# error "__cpp_lib_make_unique should have the value 201304L in c++14"
+# endif
+
+# ifdef __cpp_lib_map_try_emplace
+# error "__cpp_lib_map_try_emplace should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_math_special_functions
+# error "__cpp_lib_math_special_functions should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_memory_resource
+# error "__cpp_lib_memory_resource should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_node_extract
+# error "__cpp_lib_node_extract should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_nonmember_container_access
+# error "__cpp_lib_nonmember_container_access should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_not_fn
+# error "__cpp_lib_not_fn should not be defined before c++17"
+# endif
+
+# ifndef __cpp_lib_null_iterators
+# error "__cpp_lib_null_iterators should be defined in c++14"
+# endif
+# if __cpp_lib_null_iterators != 201304L
+# error "__cpp_lib_null_iterators should have the value 201304L in c++14"
+# endif
+
+# ifdef __cpp_lib_optional
+# error "__cpp_lib_optional should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_parallel_algorithm
+# error "__cpp_lib_parallel_algorithm should not be defined before c++17"
+# endif
+
+# ifndef __cpp_lib_quoted_string_io
+# error "__cpp_lib_quoted_string_io should be defined in c++14"
+# endif
+# if __cpp_lib_quoted_string_io != 201304L
+# error "__cpp_lib_quoted_string_io should have the value 201304L in c++14"
+# endif
+
+# ifdef __cpp_lib_ranges
+# error "__cpp_lib_ranges should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_raw_memory_algorithms
+# error "__cpp_lib_raw_memory_algorithms should not be defined before c++17"
+# endif
+
+# ifndef __cpp_lib_result_of_sfinae
+# error "__cpp_lib_result_of_sfinae should be defined in c++14"
+# endif
+# if __cpp_lib_result_of_sfinae != 201210L
+# error "__cpp_lib_result_of_sfinae should have the value 201210L in c++14"
+# endif
+
+# ifndef __cpp_lib_robust_nonmodifying_seq_ops
+# error "__cpp_lib_robust_nonmodifying_seq_ops should be defined in c++14"
+# endif
+# if __cpp_lib_robust_nonmodifying_seq_ops != 201304L
+# error "__cpp_lib_robust_nonmodifying_seq_ops should have the value 201304L in c++14"
+# endif
+
+# ifdef __cpp_lib_sample
+# error "__cpp_lib_sample should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_scoped_lock
+# error "__cpp_lib_scoped_lock should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_shared_mutex
+# error "__cpp_lib_shared_mutex should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_shared_ptr_arrays
+# error "__cpp_lib_shared_ptr_arrays should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_shared_ptr_weak_type
+# error "__cpp_lib_shared_ptr_weak_type should not be defined before c++17"
+# endif
+
+# ifndef __cpp_lib_shared_timed_mutex
+# error "__cpp_lib_shared_timed_mutex should be defined in c++14"
+# endif
+# if __cpp_lib_shared_timed_mutex != 201402L
+# error "__cpp_lib_shared_timed_mutex should have the value 201402L in c++14"
+# endif
+
+# ifndef __cpp_lib_string_udls
+# error "__cpp_lib_string_udls should be defined in c++14"
+# endif
+# if __cpp_lib_string_udls != 201304L
+# error "__cpp_lib_string_udls should have the value 201304L in c++14"
+# endif
+
+# ifdef __cpp_lib_string_view
+# error "__cpp_lib_string_view should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_three_way_comparison
+# error "__cpp_lib_three_way_comparison should not be defined before c++2a"
+# endif
-#if TEST_STD_VER > 14
-# if !defined(__cpp_lib_atomic_is_always_lock_free)
-# error "__cpp_lib_atomic_is_always_lock_free is not defined"
-# elif __cpp_lib_atomic_is_always_lock_free < 201603L
-# error "__cpp_lib_atomic_is_always_lock_free has an invalid value"
+# ifdef __cpp_lib_to_chars
+# error "__cpp_lib_to_chars should not be defined before c++17"
# endif
-#endif
-#if TEST_STD_VER > 14
-# if !defined(__cpp_lib_filesystem)
-# error "__cpp_lib_filesystem is not defined"
-# elif __cpp_lib_filesystem < 201703L
-# error "__cpp_lib_filesystem has an invalid value"
+# ifndef __cpp_lib_transformation_trait_aliases
+# error "__cpp_lib_transformation_trait_aliases should be defined in c++14"
+# endif
+# if __cpp_lib_transformation_trait_aliases != 201304L
+# error "__cpp_lib_transformation_trait_aliases should have the value 201304L in c++14"
+# endif
+
+# ifndef __cpp_lib_transparent_operators
+# error "__cpp_lib_transparent_operators should be defined in c++14"
+# endif
+# if __cpp_lib_transparent_operators != 201210L
+# error "__cpp_lib_transparent_operators should have the value 201210L in c++14"
+# endif
+
+# ifndef __cpp_lib_tuple_element_t
+# error "__cpp_lib_tuple_element_t should be defined in c++14"
+# endif
+# if __cpp_lib_tuple_element_t != 201402L
+# error "__cpp_lib_tuple_element_t should have the value 201402L in c++14"
+# endif
+
+# ifndef __cpp_lib_tuples_by_type
+# error "__cpp_lib_tuples_by_type should be defined in c++14"
+# endif
+# if __cpp_lib_tuples_by_type != 201304L
+# error "__cpp_lib_tuples_by_type should have the value 201304L in c++14"
# endif
-#endif
-#if TEST_STD_VER > 14
-# if !defined(__cpp_lib_invoke)
-# error "__cpp_lib_invoke is not defined"
-# elif __cpp_lib_invoke < 201411L
-# error "__cpp_lib_invoke has an invalid value"
+# ifdef __cpp_lib_type_trait_variable_templates
+# error "__cpp_lib_type_trait_variable_templates should not be defined before c++17"
# endif
-#endif
-#if TEST_STD_VER > 14
-# if !defined(__cpp_lib_void_t)
-# error "__cpp_lib_void_t is not defined"
-# elif __cpp_lib_void_t < 201411L
-# error "__cpp_lib_void_t has an invalid value"
+# ifdef __cpp_lib_uncaught_exceptions
+# error "__cpp_lib_uncaught_exceptions should not be defined before c++17"
# endif
-#endif
-#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
-# if !defined(__cpp_lib_char8_t)
- LIBCPP_STATIC_ASSERT(false, "__cpp_lib_char8_t is not defined");
+# ifdef __cpp_lib_unordered_map_try_emplace
+# error "__cpp_lib_unordered_map_try_emplace should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_variant
+# error "__cpp_lib_variant should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_void_t
+# error "__cpp_lib_void_t should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 17
+
+# if TEST_HAS_BUILTIN(__builtin_addressof) || TEST_GCC_VER >= 700
+# ifndef __cpp_lib_addressof_constexpr
+# error "__cpp_lib_addressof_constexpr should be defined in c++17"
+# endif
+# if __cpp_lib_addressof_constexpr != 201603L
+# error "__cpp_lib_addressof_constexpr should have the value 201603L in c++17"
+# endif
# else
-# if __cpp_lib_char8_t < 201811L
-# error "__cpp_lib_char8_t has an invalid value"
-# endif
-# endif
-#endif
-
-/*
-#if !defined(__cpp_lib_fooby)
-# error "__cpp_lib_fooby is not defined"
-#elif __cpp_lib_fooby < 201606L
-# error "__cpp_lib_fooby has an invalid value"
-#endif
-*/
-}
+# ifdef __cpp_lib_addressof_constexpr
+# error "__cpp_lib_addressof_constexpr should not be defined when TEST_HAS_BUILTIN(__builtin_addressof) || TEST_GCC_VER >= 700 is not defined!"
+# endif
+# endif
+
+# ifndef __cpp_lib_allocator_traits_is_always_equal
+# error "__cpp_lib_allocator_traits_is_always_equal should be defined in c++17"
+# endif
+# if __cpp_lib_allocator_traits_is_always_equal != 201411L
+# error "__cpp_lib_allocator_traits_is_always_equal should have the value 201411L in c++17"
+# endif
+
+# ifndef __cpp_lib_any
+# error "__cpp_lib_any should be defined in c++17"
+# endif
+# if __cpp_lib_any != 201606L
+# error "__cpp_lib_any should have the value 201606L in c++17"
+# endif
+
+# ifndef __cpp_lib_apply
+# error "__cpp_lib_apply should be defined in c++17"
+# endif
+# if __cpp_lib_apply != 201603L
+# error "__cpp_lib_apply should have the value 201603L in c++17"
+# endif
+
+# ifndef __cpp_lib_array_constexpr
+# error "__cpp_lib_array_constexpr should be defined in c++17"
+# endif
+# if __cpp_lib_array_constexpr != 201603L
+# error "__cpp_lib_array_constexpr should have the value 201603L in c++17"
+# endif
+
+# ifndef __cpp_lib_as_const
+# error "__cpp_lib_as_const should be defined in c++17"
+# endif
+# if __cpp_lib_as_const != 201510L
+# error "__cpp_lib_as_const should have the value 201510L in c++17"
+# endif
+
+# ifndef __cpp_lib_atomic_is_always_lock_free
+# error "__cpp_lib_atomic_is_always_lock_free should be defined in c++17"
+# endif
+# if __cpp_lib_atomic_is_always_lock_free != 201603L
+# error "__cpp_lib_atomic_is_always_lock_free should have the value 201603L in c++17"
+# endif
+
+# ifdef __cpp_lib_atomic_ref
+# error "__cpp_lib_atomic_ref should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_bind_front
+# error "__cpp_lib_bind_front should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_bit_cast
+# error "__cpp_lib_bit_cast should not be defined before c++2a"
+# endif
+
+# ifndef __cpp_lib_bool_constant
+# error "__cpp_lib_bool_constant should be defined in c++17"
+# endif
+# if __cpp_lib_bool_constant != 201505L
+# error "__cpp_lib_bool_constant should have the value 201505L in c++17"
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_boyer_moore_searcher
+# error "__cpp_lib_boyer_moore_searcher should be defined in c++17"
+# endif
+# if __cpp_lib_boyer_moore_searcher != 201603L
+# error "__cpp_lib_boyer_moore_searcher should have the value 201603L in c++17"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_boyer_moore_searcher
+# error "__cpp_lib_boyer_moore_searcher should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+# ifndef __cpp_lib_byte
+# error "__cpp_lib_byte should be defined in c++17"
+# endif
+# if __cpp_lib_byte != 201603L
+# error "__cpp_lib_byte should have the value 201603L in c++17"
+# endif
+
+# ifdef __cpp_lib_char8_t
+# error "__cpp_lib_char8_t should not be defined before c++2a"
+# endif
+
+# ifndef __cpp_lib_chrono
+# error "__cpp_lib_chrono should be defined in c++17"
+# endif
+# if __cpp_lib_chrono != 201611L
+# error "__cpp_lib_chrono should have the value 201611L in c++17"
+# endif
+
+# ifndef __cpp_lib_chrono_udls
+# error "__cpp_lib_chrono_udls should be defined in c++17"
+# endif
+# if __cpp_lib_chrono_udls != 201304L
+# error "__cpp_lib_chrono_udls should have the value 201304L in c++17"
+# endif
+
+# ifndef __cpp_lib_clamp
+# error "__cpp_lib_clamp should be defined in c++17"
+# endif
+# if __cpp_lib_clamp != 201603L
+# error "__cpp_lib_clamp should have the value 201603L in c++17"
+# endif
+
+# ifndef __cpp_lib_complex_udls
+# error "__cpp_lib_complex_udls should be defined in c++17"
+# endif
+# if __cpp_lib_complex_udls != 201309L
+# error "__cpp_lib_complex_udls should have the value 201309L in c++17"
+# endif
+
+# ifdef __cpp_lib_concepts
+# error "__cpp_lib_concepts should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_constexpr_misc
+# error "__cpp_lib_constexpr_misc should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_constexpr_swap_algorithms
+# error "__cpp_lib_constexpr_swap_algorithms should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_destroying_delete
+# error "__cpp_lib_destroying_delete should not be defined before c++2a"
+# endif
+
+# ifndef __cpp_lib_enable_shared_from_this
+# error "__cpp_lib_enable_shared_from_this should be defined in c++17"
+# endif
+# if __cpp_lib_enable_shared_from_this != 201603L
+# error "__cpp_lib_enable_shared_from_this should have the value 201603L in c++17"
+# endif
+
+# ifdef __cpp_lib_erase_if
+# error "__cpp_lib_erase_if should not be defined before c++2a"
+# endif
+
+# ifndef __cpp_lib_exchange_function
+# error "__cpp_lib_exchange_function should be defined in c++17"
+# endif
+# if __cpp_lib_exchange_function != 201304L
+# error "__cpp_lib_exchange_function should have the value 201304L in c++17"
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_execution
+# error "__cpp_lib_execution should be defined in c++17"
+# endif
+# if __cpp_lib_execution != 201603L
+# error "__cpp_lib_execution should have the value 201603L in c++17"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_execution
+# error "__cpp_lib_execution should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+# ifndef __cpp_lib_filesystem
+# error "__cpp_lib_filesystem should be defined in c++17"
+# endif
+# if __cpp_lib_filesystem != 201703L
+# error "__cpp_lib_filesystem should have the value 201703L in c++17"
+# endif
+
+# ifndef __cpp_lib_gcd_lcm
+# error "__cpp_lib_gcd_lcm should be defined in c++17"
+# endif
+# if __cpp_lib_gcd_lcm != 201606L
+# error "__cpp_lib_gcd_lcm should have the value 201606L in c++17"
+# endif
+
+# ifndef __cpp_lib_generic_associative_lookup
+# error "__cpp_lib_generic_associative_lookup should be defined in c++17"
+# endif
+# if __cpp_lib_generic_associative_lookup != 201304L
+# error "__cpp_lib_generic_associative_lookup should have the value 201304L in c++17"
+# endif
+
+# ifdef __cpp_lib_generic_unordered_lookup
+# error "__cpp_lib_generic_unordered_lookup should not be defined before c++2a"
+# endif
+
+# ifndef __cpp_lib_hardware_interference_size
+# error "__cpp_lib_hardware_interference_size should be defined in c++17"
+# endif
+# if __cpp_lib_hardware_interference_size != 201703L
+# error "__cpp_lib_hardware_interference_size should have the value 201703L in c++17"
+# endif
+
+# if TEST_HAS_BUILTIN_IDENTIFIER(__has_unique_object_representations) || TEST_GCC_VER >= 700
+# ifndef __cpp_lib_has_unique_object_representations
+# error "__cpp_lib_has_unique_object_representations should be defined in c++17"
+# endif
+# if __cpp_lib_has_unique_object_representations != 201606L
+# error "__cpp_lib_has_unique_object_representations should have the value 201606L in c++17"
+# endif
+# else
+# ifdef __cpp_lib_has_unique_object_representations
+# error "__cpp_lib_has_unique_object_representations should not be defined when TEST_HAS_BUILTIN_IDENTIFIER(__has_unique_object_representations) || TEST_GCC_VER >= 700 is not defined!"
+# endif
+# endif
+
+# ifndef __cpp_lib_hypot
+# error "__cpp_lib_hypot should be defined in c++17"
+# endif
+# if __cpp_lib_hypot != 201603L
+# error "__cpp_lib_hypot should have the value 201603L in c++17"
+# endif
+
+# ifndef __cpp_lib_incomplete_container_elements
+# error "__cpp_lib_incomplete_container_elements should be defined in c++17"
+# endif
+# if __cpp_lib_incomplete_container_elements != 201505L
+# error "__cpp_lib_incomplete_container_elements should have the value 201505L in c++17"
+# endif
+
+# ifndef __cpp_lib_integer_sequence
+# error "__cpp_lib_integer_sequence should be defined in c++17"
+# endif
+# if __cpp_lib_integer_sequence != 201304L
+# error "__cpp_lib_integer_sequence should have the value 201304L in c++17"
+# endif
+
+# ifndef __cpp_lib_integral_constant_callable
+# error "__cpp_lib_integral_constant_callable should be defined in c++17"
+# endif
+# if __cpp_lib_integral_constant_callable != 201304L
+# error "__cpp_lib_integral_constant_callable should have the value 201304L in c++17"
+# endif
+
+# ifndef __cpp_lib_invoke
+# error "__cpp_lib_invoke should be defined in c++17"
+# endif
+# if __cpp_lib_invoke != 201411L
+# error "__cpp_lib_invoke should have the value 201411L in c++17"
+# endif
+
+# if TEST_HAS_BUILTIN_IDENTIFIER(__is_aggregate) || TEST_GCC_VER_NEW >= 7001
+# ifndef __cpp_lib_is_aggregate
+# error "__cpp_lib_is_aggregate should be defined in c++17"
+# endif
+# if __cpp_lib_is_aggregate != 201703L
+# error "__cpp_lib_is_aggregate should have the value 201703L in c++17"
+# endif
+# else
+# ifdef __cpp_lib_is_aggregate
+# error "__cpp_lib_is_aggregate should not be defined when TEST_HAS_BUILTIN_IDENTIFIER(__is_aggregate) || TEST_GCC_VER_NEW >= 7001 is not defined!"
+# endif
+# endif
+
+# ifdef __cpp_lib_is_constant_evaluated
+# error "__cpp_lib_is_constant_evaluated should not be defined before c++2a"
+# endif
+
+# ifndef __cpp_lib_is_final
+# error "__cpp_lib_is_final should be defined in c++17"
+# endif
+# if __cpp_lib_is_final != 201402L
+# error "__cpp_lib_is_final should have the value 201402L in c++17"
+# endif
+
+# ifndef __cpp_lib_is_invocable
+# error "__cpp_lib_is_invocable should be defined in c++17"
+# endif
+# if __cpp_lib_is_invocable != 201703L
+# error "__cpp_lib_is_invocable should have the value 201703L in c++17"
+# endif
+
+# ifndef __cpp_lib_is_null_pointer
+# error "__cpp_lib_is_null_pointer should be defined in c++17"
+# endif
+# if __cpp_lib_is_null_pointer != 201309L
+# error "__cpp_lib_is_null_pointer should have the value 201309L in c++17"
+# endif
+
+# ifndef __cpp_lib_is_swappable
+# error "__cpp_lib_is_swappable should be defined in c++17"
+# endif
+# if __cpp_lib_is_swappable != 201603L
+# error "__cpp_lib_is_swappable should have the value 201603L in c++17"
+# endif
+
+# ifndef __cpp_lib_launder
+# error "__cpp_lib_launder should be defined in c++17"
+# endif
+# if __cpp_lib_launder != 201606L
+# error "__cpp_lib_launder should have the value 201606L in c++17"
+# endif
+
+# ifdef __cpp_lib_list_remove_return_type
+# error "__cpp_lib_list_remove_return_type should not be defined before c++2a"
+# endif
+
+# ifndef __cpp_lib_logical_traits
+# error "__cpp_lib_logical_traits should be defined in c++17"
+# endif
+# if __cpp_lib_logical_traits != 201510L
+# error "__cpp_lib_logical_traits should have the value 201510L in c++17"
+# endif
+
+# ifndef __cpp_lib_make_from_tuple
+# error "__cpp_lib_make_from_tuple should be defined in c++17"
+# endif
+# if __cpp_lib_make_from_tuple != 201606L
+# error "__cpp_lib_make_from_tuple should have the value 201606L in c++17"
+# endif
+
+# ifndef __cpp_lib_make_reverse_iterator
+# error "__cpp_lib_make_reverse_iterator should be defined in c++17"
+# endif
+# if __cpp_lib_make_reverse_iterator != 201402L
+# error "__cpp_lib_make_reverse_iterator should have the value 201402L in c++17"
+# endif
+
+# ifndef __cpp_lib_make_unique
+# error "__cpp_lib_make_unique should be defined in c++17"
+# endif
+# if __cpp_lib_make_unique != 201304L
+# error "__cpp_lib_make_unique should have the value 201304L in c++17"
+# endif
+
+# ifndef __cpp_lib_map_try_emplace
+# error "__cpp_lib_map_try_emplace should be defined in c++17"
+# endif
+# if __cpp_lib_map_try_emplace != 201411L
+# error "__cpp_lib_map_try_emplace should have the value 201411L in c++17"
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_math_special_functions
+# error "__cpp_lib_math_special_functions should be defined in c++17"
+# endif
+# if __cpp_lib_math_special_functions != 201603L
+# error "__cpp_lib_math_special_functions should have the value 201603L in c++17"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_math_special_functions
+# error "__cpp_lib_math_special_functions should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_memory_resource
+# error "__cpp_lib_memory_resource should be defined in c++17"
+# endif
+# if __cpp_lib_memory_resource != 201603L
+# error "__cpp_lib_memory_resource should have the value 201603L in c++17"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_memory_resource
+# error "__cpp_lib_memory_resource should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+# ifndef __cpp_lib_node_extract
+# error "__cpp_lib_node_extract should be defined in c++17"
+# endif
+# if __cpp_lib_node_extract != 201606L
+# error "__cpp_lib_node_extract should have the value 201606L in c++17"
+# endif
+
+# ifndef __cpp_lib_nonmember_container_access
+# error "__cpp_lib_nonmember_container_access should be defined in c++17"
+# endif
+# if __cpp_lib_nonmember_container_access != 201411L
+# error "__cpp_lib_nonmember_container_access should have the value 201411L in c++17"
+# endif
+
+# ifndef __cpp_lib_not_fn
+# error "__cpp_lib_not_fn should be defined in c++17"
+# endif
+# if __cpp_lib_not_fn != 201603L
+# error "__cpp_lib_not_fn should have the value 201603L in c++17"
+# endif
+
+# ifndef __cpp_lib_null_iterators
+# error "__cpp_lib_null_iterators should be defined in c++17"
+# endif
+# if __cpp_lib_null_iterators != 201304L
+# error "__cpp_lib_null_iterators should have the value 201304L in c++17"
+# endif
+
+# ifndef __cpp_lib_optional
+# error "__cpp_lib_optional should be defined in c++17"
+# endif
+# if __cpp_lib_optional != 201606L
+# error "__cpp_lib_optional should have the value 201606L in c++17"
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_parallel_algorithm
+# error "__cpp_lib_parallel_algorithm should be defined in c++17"
+# endif
+# if __cpp_lib_parallel_algorithm != 201603L
+# error "__cpp_lib_parallel_algorithm should have the value 201603L in c++17"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_parallel_algorithm
+# error "__cpp_lib_parallel_algorithm should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+# ifndef __cpp_lib_quoted_string_io
+# error "__cpp_lib_quoted_string_io should be defined in c++17"
+# endif
+# if __cpp_lib_quoted_string_io != 201304L
+# error "__cpp_lib_quoted_string_io should have the value 201304L in c++17"
+# endif
+
+# ifdef __cpp_lib_ranges
+# error "__cpp_lib_ranges should not be defined before c++2a"
+# endif
+
+# ifndef __cpp_lib_raw_memory_algorithms
+# error "__cpp_lib_raw_memory_algorithms should be defined in c++17"
+# endif
+# if __cpp_lib_raw_memory_algorithms != 201606L
+# error "__cpp_lib_raw_memory_algorithms should have the value 201606L in c++17"
+# endif
+
+# ifndef __cpp_lib_result_of_sfinae
+# error "__cpp_lib_result_of_sfinae should be defined in c++17"
+# endif
+# if __cpp_lib_result_of_sfinae != 201210L
+# error "__cpp_lib_result_of_sfinae should have the value 201210L in c++17"
+# endif
+
+# ifndef __cpp_lib_robust_nonmodifying_seq_ops
+# error "__cpp_lib_robust_nonmodifying_seq_ops should be defined in c++17"
+# endif
+# if __cpp_lib_robust_nonmodifying_seq_ops != 201304L
+# error "__cpp_lib_robust_nonmodifying_seq_ops should have the value 201304L in c++17"
+# endif
+
+# ifndef __cpp_lib_sample
+# error "__cpp_lib_sample should be defined in c++17"
+# endif
+# if __cpp_lib_sample != 201603L
+# error "__cpp_lib_sample should have the value 201603L in c++17"
+# endif
+
+# ifndef __cpp_lib_scoped_lock
+# error "__cpp_lib_scoped_lock should be defined in c++17"
+# endif
+# if __cpp_lib_scoped_lock != 201703L
+# error "__cpp_lib_scoped_lock should have the value 201703L in c++17"
+# endif
+
+# ifndef __cpp_lib_shared_mutex
+# error "__cpp_lib_shared_mutex should be defined in c++17"
+# endif
+# if __cpp_lib_shared_mutex != 201505L
+# error "__cpp_lib_shared_mutex should have the value 201505L in c++17"
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_shared_ptr_arrays
+# error "__cpp_lib_shared_ptr_arrays should be defined in c++17"
+# endif
+# if __cpp_lib_shared_ptr_arrays != 201611L
+# error "__cpp_lib_shared_ptr_arrays should have the value 201611L in c++17"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_shared_ptr_arrays
+# error "__cpp_lib_shared_ptr_arrays should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+# ifndef __cpp_lib_shared_ptr_weak_type
+# error "__cpp_lib_shared_ptr_weak_type should be defined in c++17"
+# endif
+# if __cpp_lib_shared_ptr_weak_type != 201606L
+# error "__cpp_lib_shared_ptr_weak_type should have the value 201606L in c++17"
+# endif
+
+# ifndef __cpp_lib_shared_timed_mutex
+# error "__cpp_lib_shared_timed_mutex should be defined in c++17"
+# endif
+# if __cpp_lib_shared_timed_mutex != 201402L
+# error "__cpp_lib_shared_timed_mutex should have the value 201402L in c++17"
+# endif
+
+# ifndef __cpp_lib_string_udls
+# error "__cpp_lib_string_udls should be defined in c++17"
+# endif
+# if __cpp_lib_string_udls != 201304L
+# error "__cpp_lib_string_udls should have the value 201304L in c++17"
+# endif
+
+# ifndef __cpp_lib_string_view
+# error "__cpp_lib_string_view should be defined in c++17"
+# endif
+# if __cpp_lib_string_view != 201606L
+# error "__cpp_lib_string_view should have the value 201606L in c++17"
+# endif
+
+# ifdef __cpp_lib_three_way_comparison
+# error "__cpp_lib_three_way_comparison should not be defined before c++2a"
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_to_chars
+# error "__cpp_lib_to_chars should be defined in c++17"
+# endif
+# if __cpp_lib_to_chars != 201611L
+# error "__cpp_lib_to_chars should have the value 201611L in c++17"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_to_chars
+# error "__cpp_lib_to_chars should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+# ifndef __cpp_lib_transformation_trait_aliases
+# error "__cpp_lib_transformation_trait_aliases should be defined in c++17"
+# endif
+# if __cpp_lib_transformation_trait_aliases != 201304L
+# error "__cpp_lib_transformation_trait_aliases should have the value 201304L in c++17"
+# endif
+
+# ifndef __cpp_lib_transparent_operators
+# error "__cpp_lib_transparent_operators should be defined in c++17"
+# endif
+# if __cpp_lib_transparent_operators != 201510L
+# error "__cpp_lib_transparent_operators should have the value 201510L in c++17"
+# endif
+
+# ifndef __cpp_lib_tuple_element_t
+# error "__cpp_lib_tuple_element_t should be defined in c++17"
+# endif
+# if __cpp_lib_tuple_element_t != 201402L
+# error "__cpp_lib_tuple_element_t should have the value 201402L in c++17"
+# endif
+
+# ifndef __cpp_lib_tuples_by_type
+# error "__cpp_lib_tuples_by_type should be defined in c++17"
+# endif
+# if __cpp_lib_tuples_by_type != 201304L
+# error "__cpp_lib_tuples_by_type should have the value 201304L in c++17"
+# endif
+
+# ifndef __cpp_lib_type_trait_variable_templates
+# error "__cpp_lib_type_trait_variable_templates should be defined in c++17"
+# endif
+# if __cpp_lib_type_trait_variable_templates != 201510L
+# error "__cpp_lib_type_trait_variable_templates should have the value 201510L in c++17"
+# endif
+
+# ifndef __cpp_lib_uncaught_exceptions
+# error "__cpp_lib_uncaught_exceptions should be defined in c++17"
+# endif
+# if __cpp_lib_uncaught_exceptions != 201411L
+# error "__cpp_lib_uncaught_exceptions should have the value 201411L in c++17"
+# endif
+
+# ifndef __cpp_lib_unordered_map_try_emplace
+# error "__cpp_lib_unordered_map_try_emplace should be defined in c++17"
+# endif
+# if __cpp_lib_unordered_map_try_emplace != 201411L
+# error "__cpp_lib_unordered_map_try_emplace should have the value 201411L in c++17"
+# endif
+
+# ifndef __cpp_lib_variant
+# error "__cpp_lib_variant should be defined in c++17"
+# endif
+# if __cpp_lib_variant != 201606L
+# error "__cpp_lib_variant should have the value 201606L in c++17"
+# endif
+
+# ifndef __cpp_lib_void_t
+# error "__cpp_lib_void_t should be defined in c++17"
+# endif
+# if __cpp_lib_void_t != 201411L
+# error "__cpp_lib_void_t should have the value 201411L in c++17"
+# endif
+
+#elif TEST_STD_VER > 17
+
+# if TEST_HAS_BUILTIN(__builtin_addressof) || TEST_GCC_VER >= 700
+# ifndef __cpp_lib_addressof_constexpr
+# error "__cpp_lib_addressof_constexpr should be defined in c++2a"
+# endif
+# if __cpp_lib_addressof_constexpr != 201603L
+# error "__cpp_lib_addressof_constexpr should have the value 201603L in c++2a"
+# endif
+# else
+# ifdef __cpp_lib_addressof_constexpr
+# error "__cpp_lib_addressof_constexpr should not be defined when TEST_HAS_BUILTIN(__builtin_addressof) || TEST_GCC_VER >= 700 is not defined!"
+# endif
+# endif
+
+# ifndef __cpp_lib_allocator_traits_is_always_equal
+# error "__cpp_lib_allocator_traits_is_always_equal should be defined in c++2a"
+# endif
+# if __cpp_lib_allocator_traits_is_always_equal != 201411L
+# error "__cpp_lib_allocator_traits_is_always_equal should have the value 201411L in c++2a"
+# endif
+
+# ifndef __cpp_lib_any
+# error "__cpp_lib_any should be defined in c++2a"
+# endif
+# if __cpp_lib_any != 201606L
+# error "__cpp_lib_any should have the value 201606L in c++2a"
+# endif
+
+# ifndef __cpp_lib_apply
+# error "__cpp_lib_apply should be defined in c++2a"
+# endif
+# if __cpp_lib_apply != 201603L
+# error "__cpp_lib_apply should have the value 201603L in c++2a"
+# endif
+
+# ifndef __cpp_lib_array_constexpr
+# error "__cpp_lib_array_constexpr should be defined in c++2a"
+# endif
+# if __cpp_lib_array_constexpr != 201603L
+# error "__cpp_lib_array_constexpr should have the value 201603L in c++2a"
+# endif
+
+# ifndef __cpp_lib_as_const
+# error "__cpp_lib_as_const should be defined in c++2a"
+# endif
+# if __cpp_lib_as_const != 201510L
+# error "__cpp_lib_as_const should have the value 201510L in c++2a"
+# endif
+
+# ifndef __cpp_lib_atomic_is_always_lock_free
+# error "__cpp_lib_atomic_is_always_lock_free should be defined in c++2a"
+# endif
+# if __cpp_lib_atomic_is_always_lock_free != 201603L
+# error "__cpp_lib_atomic_is_always_lock_free should have the value 201603L in c++2a"
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_atomic_ref
+# error "__cpp_lib_atomic_ref should be defined in c++2a"
+# endif
+# if __cpp_lib_atomic_ref != 201806L
+# error "__cpp_lib_atomic_ref should have the value 201806L in c++2a"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_atomic_ref
+# error "__cpp_lib_atomic_ref should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_bind_front
+# error "__cpp_lib_bind_front should be defined in c++2a"
+# endif
+# if __cpp_lib_bind_front != 201811L
+# error "__cpp_lib_bind_front should have the value 201811L in c++2a"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_bind_front
+# error "__cpp_lib_bind_front should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_bit_cast
+# error "__cpp_lib_bit_cast should be defined in c++2a"
+# endif
+# if __cpp_lib_bit_cast != 201806L
+# error "__cpp_lib_bit_cast should have the value 201806L in c++2a"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_bit_cast
+# error "__cpp_lib_bit_cast should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+# ifndef __cpp_lib_bool_constant
+# error "__cpp_lib_bool_constant should be defined in c++2a"
+# endif
+# if __cpp_lib_bool_constant != 201505L
+# error "__cpp_lib_bool_constant should have the value 201505L in c++2a"
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_boyer_moore_searcher
+# error "__cpp_lib_boyer_moore_searcher should be defined in c++2a"
+# endif
+# if __cpp_lib_boyer_moore_searcher != 201603L
+# error "__cpp_lib_boyer_moore_searcher should have the value 201603L in c++2a"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_boyer_moore_searcher
+# error "__cpp_lib_boyer_moore_searcher should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+# ifndef __cpp_lib_byte
+# error "__cpp_lib_byte should be defined in c++2a"
+# endif
+# if __cpp_lib_byte != 201603L
+# error "__cpp_lib_byte should have the value 201603L in c++2a"
+# endif
+
+# if defined(__cpp_char8_t)
+# ifndef __cpp_lib_char8_t
+# error "__cpp_lib_char8_t should be defined in c++2a"
+# endif
+# if __cpp_lib_char8_t != 201811L
+# error "__cpp_lib_char8_t should have the value 201811L in c++2a"
+# endif
+# else
+# ifdef __cpp_lib_char8_t
+# error "__cpp_lib_char8_t should not be defined when defined(__cpp_char8_t) is not defined!"
+# endif
+# endif
+
+# ifndef __cpp_lib_chrono
+# error "__cpp_lib_chrono should be defined in c++2a"
+# endif
+# if __cpp_lib_chrono != 201611L
+# error "__cpp_lib_chrono should have the value 201611L in c++2a"
+# endif
+
+# ifndef __cpp_lib_chrono_udls
+# error "__cpp_lib_chrono_udls should be defined in c++2a"
+# endif
+# if __cpp_lib_chrono_udls != 201304L
+# error "__cpp_lib_chrono_udls should have the value 201304L in c++2a"
+# endif
+
+# ifndef __cpp_lib_clamp
+# error "__cpp_lib_clamp should be defined in c++2a"
+# endif
+# if __cpp_lib_clamp != 201603L
+# error "__cpp_lib_clamp should have the value 201603L in c++2a"
+# endif
+
+# ifndef __cpp_lib_complex_udls
+# error "__cpp_lib_complex_udls should be defined in c++2a"
+# endif
+# if __cpp_lib_complex_udls != 201309L
+# error "__cpp_lib_complex_udls should have the value 201309L in c++2a"
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_concepts
+# error "__cpp_lib_concepts should be defined in c++2a"
+# endif
+# if __cpp_lib_concepts != 201806L
+# error "__cpp_lib_concepts should have the value 201806L in c++2a"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_concepts
+# error "__cpp_lib_concepts should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_constexpr_misc
+# error "__cpp_lib_constexpr_misc should be defined in c++2a"
+# endif
+# if __cpp_lib_constexpr_misc != 201811L
+# error "__cpp_lib_constexpr_misc should have the value 201811L in c++2a"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_constexpr_misc
+# error "__cpp_lib_constexpr_misc should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_constexpr_swap_algorithms
+# error "__cpp_lib_constexpr_swap_algorithms should be defined in c++2a"
+# endif
+# if __cpp_lib_constexpr_swap_algorithms != 201806L
+# error "__cpp_lib_constexpr_swap_algorithms should have the value 201806L in c++2a"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_constexpr_swap_algorithms
+# error "__cpp_lib_constexpr_swap_algorithms should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_destroying_delete
+# error "__cpp_lib_destroying_delete should be defined in c++2a"
+# endif
+# if __cpp_lib_destroying_delete != 201806L
+# error "__cpp_lib_destroying_delete should have the value 201806L in c++2a"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_destroying_delete
+# error "__cpp_lib_destroying_delete should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+# ifndef __cpp_lib_enable_shared_from_this
+# error "__cpp_lib_enable_shared_from_this should be defined in c++2a"
+# endif
+# if __cpp_lib_enable_shared_from_this != 201603L
+# error "__cpp_lib_enable_shared_from_this should have the value 201603L in c++2a"
+# endif
+
+# ifndef __cpp_lib_erase_if
+# error "__cpp_lib_erase_if should be defined in c++2a"
+# endif
+# if __cpp_lib_erase_if != 201811L
+# error "__cpp_lib_erase_if should have the value 201811L in c++2a"
+# endif
+
+# ifndef __cpp_lib_exchange_function
+# error "__cpp_lib_exchange_function should be defined in c++2a"
+# endif
+# if __cpp_lib_exchange_function != 201304L
+# error "__cpp_lib_exchange_function should have the value 201304L in c++2a"
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_execution
+# error "__cpp_lib_execution should be defined in c++2a"
+# endif
+# if __cpp_lib_execution != 201603L
+# error "__cpp_lib_execution should have the value 201603L in c++2a"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_execution
+# error "__cpp_lib_execution should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+# ifndef __cpp_lib_filesystem
+# error "__cpp_lib_filesystem should be defined in c++2a"
+# endif
+# if __cpp_lib_filesystem != 201703L
+# error "__cpp_lib_filesystem should have the value 201703L in c++2a"
+# endif
+
+# ifndef __cpp_lib_gcd_lcm
+# error "__cpp_lib_gcd_lcm should be defined in c++2a"
+# endif
+# if __cpp_lib_gcd_lcm != 201606L
+# error "__cpp_lib_gcd_lcm should have the value 201606L in c++2a"
+# endif
+
+# ifndef __cpp_lib_generic_associative_lookup
+# error "__cpp_lib_generic_associative_lookup should be defined in c++2a"
+# endif
+# if __cpp_lib_generic_associative_lookup != 201304L
+# error "__cpp_lib_generic_associative_lookup should have the value 201304L in c++2a"
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_generic_unordered_lookup
+# error "__cpp_lib_generic_unordered_lookup should be defined in c++2a"
+# endif
+# if __cpp_lib_generic_unordered_lookup != 201811L
+# error "__cpp_lib_generic_unordered_lookup should have the value 201811L in c++2a"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_generic_unordered_lookup
+# error "__cpp_lib_generic_unordered_lookup should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+# ifndef __cpp_lib_hardware_interference_size
+# error "__cpp_lib_hardware_interference_size should be defined in c++2a"
+# endif
+# if __cpp_lib_hardware_interference_size != 201703L
+# error "__cpp_lib_hardware_interference_size should have the value 201703L in c++2a"
+# endif
+
+# if TEST_HAS_BUILTIN_IDENTIFIER(__has_unique_object_representations) || TEST_GCC_VER >= 700
+# ifndef __cpp_lib_has_unique_object_representations
+# error "__cpp_lib_has_unique_object_representations should be defined in c++2a"
+# endif
+# if __cpp_lib_has_unique_object_representations != 201606L
+# error "__cpp_lib_has_unique_object_representations should have the value 201606L in c++2a"
+# endif
+# else
+# ifdef __cpp_lib_has_unique_object_representations
+# error "__cpp_lib_has_unique_object_representations should not be defined when TEST_HAS_BUILTIN_IDENTIFIER(__has_unique_object_representations) || TEST_GCC_VER >= 700 is not defined!"
+# endif
+# endif
+
+# ifndef __cpp_lib_hypot
+# error "__cpp_lib_hypot should be defined in c++2a"
+# endif
+# if __cpp_lib_hypot != 201603L
+# error "__cpp_lib_hypot should have the value 201603L in c++2a"
+# endif
+
+# ifndef __cpp_lib_incomplete_container_elements
+# error "__cpp_lib_incomplete_container_elements should be defined in c++2a"
+# endif
+# if __cpp_lib_incomplete_container_elements != 201505L
+# error "__cpp_lib_incomplete_container_elements should have the value 201505L in c++2a"
+# endif
+
+# ifndef __cpp_lib_integer_sequence
+# error "__cpp_lib_integer_sequence should be defined in c++2a"
+# endif
+# if __cpp_lib_integer_sequence != 201304L
+# error "__cpp_lib_integer_sequence should have the value 201304L in c++2a"
+# endif
+
+# ifndef __cpp_lib_integral_constant_callable
+# error "__cpp_lib_integral_constant_callable should be defined in c++2a"
+# endif
+# if __cpp_lib_integral_constant_callable != 201304L
+# error "__cpp_lib_integral_constant_callable should have the value 201304L in c++2a"
+# endif
+
+# ifndef __cpp_lib_invoke
+# error "__cpp_lib_invoke should be defined in c++2a"
+# endif
+# if __cpp_lib_invoke != 201411L
+# error "__cpp_lib_invoke should have the value 201411L in c++2a"
+# endif
+
+# if TEST_HAS_BUILTIN_IDENTIFIER(__is_aggregate) || TEST_GCC_VER_NEW >= 7001
+# ifndef __cpp_lib_is_aggregate
+# error "__cpp_lib_is_aggregate should be defined in c++2a"
+# endif
+# if __cpp_lib_is_aggregate != 201703L
+# error "__cpp_lib_is_aggregate should have the value 201703L in c++2a"
+# endif
+# else
+# ifdef __cpp_lib_is_aggregate
+# error "__cpp_lib_is_aggregate should not be defined when TEST_HAS_BUILTIN_IDENTIFIER(__is_aggregate) || TEST_GCC_VER_NEW >= 7001 is not defined!"
+# endif
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_is_constant_evaluated
+# error "__cpp_lib_is_constant_evaluated should be defined in c++2a"
+# endif
+# if __cpp_lib_is_constant_evaluated != 201811L
+# error "__cpp_lib_is_constant_evaluated should have the value 201811L in c++2a"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_is_constant_evaluated
+# error "__cpp_lib_is_constant_evaluated should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+# ifndef __cpp_lib_is_final
+# error "__cpp_lib_is_final should be defined in c++2a"
+# endif
+# if __cpp_lib_is_final != 201402L
+# error "__cpp_lib_is_final should have the value 201402L in c++2a"
+# endif
+
+# ifndef __cpp_lib_is_invocable
+# error "__cpp_lib_is_invocable should be defined in c++2a"
+# endif
+# if __cpp_lib_is_invocable != 201703L
+# error "__cpp_lib_is_invocable should have the value 201703L in c++2a"
+# endif
+
+# ifndef __cpp_lib_is_null_pointer
+# error "__cpp_lib_is_null_pointer should be defined in c++2a"
+# endif
+# if __cpp_lib_is_null_pointer != 201309L
+# error "__cpp_lib_is_null_pointer should have the value 201309L in c++2a"
+# endif
+
+# ifndef __cpp_lib_is_swappable
+# error "__cpp_lib_is_swappable should be defined in c++2a"
+# endif
+# if __cpp_lib_is_swappable != 201603L
+# error "__cpp_lib_is_swappable should have the value 201603L in c++2a"
+# endif
+
+# ifndef __cpp_lib_launder
+# error "__cpp_lib_launder should be defined in c++2a"
+# endif
+# if __cpp_lib_launder != 201606L
+# error "__cpp_lib_launder should have the value 201606L in c++2a"
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_list_remove_return_type
+# error "__cpp_lib_list_remove_return_type should be defined in c++2a"
+# endif
+# if __cpp_lib_list_remove_return_type != 201806L
+# error "__cpp_lib_list_remove_return_type should have the value 201806L in c++2a"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_list_remove_return_type
+# error "__cpp_lib_list_remove_return_type should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+# ifndef __cpp_lib_logical_traits
+# error "__cpp_lib_logical_traits should be defined in c++2a"
+# endif
+# if __cpp_lib_logical_traits != 201510L
+# error "__cpp_lib_logical_traits should have the value 201510L in c++2a"
+# endif
+
+# ifndef __cpp_lib_make_from_tuple
+# error "__cpp_lib_make_from_tuple should be defined in c++2a"
+# endif
+# if __cpp_lib_make_from_tuple != 201606L
+# error "__cpp_lib_make_from_tuple should have the value 201606L in c++2a"
+# endif
+
+# ifndef __cpp_lib_make_reverse_iterator
+# error "__cpp_lib_make_reverse_iterator should be defined in c++2a"
+# endif
+# if __cpp_lib_make_reverse_iterator != 201402L
+# error "__cpp_lib_make_reverse_iterator should have the value 201402L in c++2a"
+# endif
+
+# ifndef __cpp_lib_make_unique
+# error "__cpp_lib_make_unique should be defined in c++2a"
+# endif
+# if __cpp_lib_make_unique != 201304L
+# error "__cpp_lib_make_unique should have the value 201304L in c++2a"
+# endif
+
+# ifndef __cpp_lib_map_try_emplace
+# error "__cpp_lib_map_try_emplace should be defined in c++2a"
+# endif
+# if __cpp_lib_map_try_emplace != 201411L
+# error "__cpp_lib_map_try_emplace should have the value 201411L in c++2a"
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_math_special_functions
+# error "__cpp_lib_math_special_functions should be defined in c++2a"
+# endif
+# if __cpp_lib_math_special_functions != 201603L
+# error "__cpp_lib_math_special_functions should have the value 201603L in c++2a"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_math_special_functions
+# error "__cpp_lib_math_special_functions should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_memory_resource
+# error "__cpp_lib_memory_resource should be defined in c++2a"
+# endif
+# if __cpp_lib_memory_resource != 201603L
+# error "__cpp_lib_memory_resource should have the value 201603L in c++2a"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_memory_resource
+# error "__cpp_lib_memory_resource should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+# ifndef __cpp_lib_node_extract
+# error "__cpp_lib_node_extract should be defined in c++2a"
+# endif
+# if __cpp_lib_node_extract != 201606L
+# error "__cpp_lib_node_extract should have the value 201606L in c++2a"
+# endif
+
+# ifndef __cpp_lib_nonmember_container_access
+# error "__cpp_lib_nonmember_container_access should be defined in c++2a"
+# endif
+# if __cpp_lib_nonmember_container_access != 201411L
+# error "__cpp_lib_nonmember_container_access should have the value 201411L in c++2a"
+# endif
+
+# ifndef __cpp_lib_not_fn
+# error "__cpp_lib_not_fn should be defined in c++2a"
+# endif
+# if __cpp_lib_not_fn != 201603L
+# error "__cpp_lib_not_fn should have the value 201603L in c++2a"
+# endif
+
+# ifndef __cpp_lib_null_iterators
+# error "__cpp_lib_null_iterators should be defined in c++2a"
+# endif
+# if __cpp_lib_null_iterators != 201304L
+# error "__cpp_lib_null_iterators should have the value 201304L in c++2a"
+# endif
+
+# ifndef __cpp_lib_optional
+# error "__cpp_lib_optional should be defined in c++2a"
+# endif
+# if __cpp_lib_optional != 201606L
+# error "__cpp_lib_optional should have the value 201606L in c++2a"
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_parallel_algorithm
+# error "__cpp_lib_parallel_algorithm should be defined in c++2a"
+# endif
+# if __cpp_lib_parallel_algorithm != 201603L
+# error "__cpp_lib_parallel_algorithm should have the value 201603L in c++2a"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_parallel_algorithm
+# error "__cpp_lib_parallel_algorithm should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+# ifndef __cpp_lib_quoted_string_io
+# error "__cpp_lib_quoted_string_io should be defined in c++2a"
+# endif
+# if __cpp_lib_quoted_string_io != 201304L
+# error "__cpp_lib_quoted_string_io should have the value 201304L in c++2a"
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_ranges
+# error "__cpp_lib_ranges should be defined in c++2a"
+# endif
+# if __cpp_lib_ranges != 201811L
+# error "__cpp_lib_ranges should have the value 201811L in c++2a"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_ranges
+# error "__cpp_lib_ranges should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+# ifndef __cpp_lib_raw_memory_algorithms
+# error "__cpp_lib_raw_memory_algorithms should be defined in c++2a"
+# endif
+# if __cpp_lib_raw_memory_algorithms != 201606L
+# error "__cpp_lib_raw_memory_algorithms should have the value 201606L in c++2a"
+# endif
+
+# ifndef __cpp_lib_result_of_sfinae
+# error "__cpp_lib_result_of_sfinae should be defined in c++2a"
+# endif
+# if __cpp_lib_result_of_sfinae != 201210L
+# error "__cpp_lib_result_of_sfinae should have the value 201210L in c++2a"
+# endif
+
+# ifndef __cpp_lib_robust_nonmodifying_seq_ops
+# error "__cpp_lib_robust_nonmodifying_seq_ops should be defined in c++2a"
+# endif
+# if __cpp_lib_robust_nonmodifying_seq_ops != 201304L
+# error "__cpp_lib_robust_nonmodifying_seq_ops should have the value 201304L in c++2a"
+# endif
+
+# ifndef __cpp_lib_sample
+# error "__cpp_lib_sample should be defined in c++2a"
+# endif
+# if __cpp_lib_sample != 201603L
+# error "__cpp_lib_sample should have the value 201603L in c++2a"
+# endif
+
+# ifndef __cpp_lib_scoped_lock
+# error "__cpp_lib_scoped_lock should be defined in c++2a"
+# endif
+# if __cpp_lib_scoped_lock != 201703L
+# error "__cpp_lib_scoped_lock should have the value 201703L in c++2a"
+# endif
+
+# ifndef __cpp_lib_shared_mutex
+# error "__cpp_lib_shared_mutex should be defined in c++2a"
+# endif
+# if __cpp_lib_shared_mutex != 201505L
+# error "__cpp_lib_shared_mutex should have the value 201505L in c++2a"
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_shared_ptr_arrays
+# error "__cpp_lib_shared_ptr_arrays should be defined in c++2a"
+# endif
+# if __cpp_lib_shared_ptr_arrays != 201611L
+# error "__cpp_lib_shared_ptr_arrays should have the value 201611L in c++2a"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_shared_ptr_arrays
+# error "__cpp_lib_shared_ptr_arrays should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+# ifndef __cpp_lib_shared_ptr_weak_type
+# error "__cpp_lib_shared_ptr_weak_type should be defined in c++2a"
+# endif
+# if __cpp_lib_shared_ptr_weak_type != 201606L
+# error "__cpp_lib_shared_ptr_weak_type should have the value 201606L in c++2a"
+# endif
+
+# ifndef __cpp_lib_shared_timed_mutex
+# error "__cpp_lib_shared_timed_mutex should be defined in c++2a"
+# endif
+# if __cpp_lib_shared_timed_mutex != 201402L
+# error "__cpp_lib_shared_timed_mutex should have the value 201402L in c++2a"
+# endif
+
+# ifndef __cpp_lib_string_udls
+# error "__cpp_lib_string_udls should be defined in c++2a"
+# endif
+# if __cpp_lib_string_udls != 201304L
+# error "__cpp_lib_string_udls should have the value 201304L in c++2a"
+# endif
+
+# ifndef __cpp_lib_string_view
+# error "__cpp_lib_string_view should be defined in c++2a"
+# endif
+# if __cpp_lib_string_view != 201606L
+# error "__cpp_lib_string_view should have the value 201606L in c++2a"
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_three_way_comparison
+# error "__cpp_lib_three_way_comparison should be defined in c++2a"
+# endif
+# if __cpp_lib_three_way_comparison != 201711L
+# error "__cpp_lib_three_way_comparison should have the value 201711L in c++2a"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_three_way_comparison
+# error "__cpp_lib_three_way_comparison should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_to_chars
+# error "__cpp_lib_to_chars should be defined in c++2a"
+# endif
+# if __cpp_lib_to_chars != 201611L
+# error "__cpp_lib_to_chars should have the value 201611L in c++2a"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_to_chars
+# error "__cpp_lib_to_chars should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+# ifndef __cpp_lib_transformation_trait_aliases
+# error "__cpp_lib_transformation_trait_aliases should be defined in c++2a"
+# endif
+# if __cpp_lib_transformation_trait_aliases != 201304L
+# error "__cpp_lib_transformation_trait_aliases should have the value 201304L in c++2a"
+# endif
+
+# ifndef __cpp_lib_transparent_operators
+# error "__cpp_lib_transparent_operators should be defined in c++2a"
+# endif
+# if __cpp_lib_transparent_operators != 201510L
+# error "__cpp_lib_transparent_operators should have the value 201510L in c++2a"
+# endif
+
+# ifndef __cpp_lib_tuple_element_t
+# error "__cpp_lib_tuple_element_t should be defined in c++2a"
+# endif
+# if __cpp_lib_tuple_element_t != 201402L
+# error "__cpp_lib_tuple_element_t should have the value 201402L in c++2a"
+# endif
+
+# ifndef __cpp_lib_tuples_by_type
+# error "__cpp_lib_tuples_by_type should be defined in c++2a"
+# endif
+# if __cpp_lib_tuples_by_type != 201304L
+# error "__cpp_lib_tuples_by_type should have the value 201304L in c++2a"
+# endif
+
+# ifndef __cpp_lib_type_trait_variable_templates
+# error "__cpp_lib_type_trait_variable_templates should be defined in c++2a"
+# endif
+# if __cpp_lib_type_trait_variable_templates != 201510L
+# error "__cpp_lib_type_trait_variable_templates should have the value 201510L in c++2a"
+# endif
+
+# ifndef __cpp_lib_uncaught_exceptions
+# error "__cpp_lib_uncaught_exceptions should be defined in c++2a"
+# endif
+# if __cpp_lib_uncaught_exceptions != 201411L
+# error "__cpp_lib_uncaught_exceptions should have the value 201411L in c++2a"
+# endif
+
+# ifndef __cpp_lib_unordered_map_try_emplace
+# error "__cpp_lib_unordered_map_try_emplace should be defined in c++2a"
+# endif
+# if __cpp_lib_unordered_map_try_emplace != 201411L
+# error "__cpp_lib_unordered_map_try_emplace should have the value 201411L in c++2a"
+# endif
+
+# ifndef __cpp_lib_variant
+# error "__cpp_lib_variant should be defined in c++2a"
+# endif
+# if __cpp_lib_variant != 201606L
+# error "__cpp_lib_variant should have the value 201606L in c++2a"
+# endif
+
+# ifndef __cpp_lib_void_t
+# error "__cpp_lib_void_t should be defined in c++2a"
+# endif
+# if __cpp_lib_void_t != 201411L
+# error "__cpp_lib_void_t should have the value 201411L in c++2a"
+# endif
+
+#endif // TEST_STD_VER > 17
+
+int main() {}
diff --git a/libcxx/test/support/test_macros.h b/libcxx/test/support/test_macros.h
index 99755529679..5af07247122 100644
--- a/libcxx/test/support/test_macros.h
+++ b/libcxx/test/support/test_macros.h
@@ -69,6 +69,7 @@
#define TEST_CLANG_VER (__clang_major__ * 100) + __clang_minor__
#elif defined(__GNUC__)
#define TEST_GCC_VER (__GNUC__ * 100 + __GNUC_MINOR__)
+#define TEST_GCC_VER_NEW (TEST_GCC_VER * 10 + __GNUC_PATCHLEVEL__)
#endif
/* Make a nice name for the standard version */