1 // Feature test macro definitions -*- C++ -*-
2 // Copyright (C) 2023-2025 Free Software Foundation, Inc.
4 // This file is part of the GNU ISO C++ Library. This library is free
5 // software; you can redistribute it and/or modify it under the
6 // terms of the GNU General Public License as published by the
7 // Free Software Foundation; either version 3, or (at your option)
10 // This library is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // Under Section 7 of GPL version 3, you are granted additional
16 // permissions described in the GCC Runtime Library Exception, version
17 // 3.1, as published by the Free Software Foundation.
19 // You should have received a copy of the GNU General Public License and
20 // a copy of the GCC Runtime Library Exception along with this program;
21 // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
22 // <http://www.gnu.org/licenses/>.
24 AutoGen Definitions version.tpl;
26 // The top level variable ftms is an array of feature test macros. Each entry
27 // consists of a structure like following:
32 // [stdname = FTM STANDARD MACRO NAME;]
33 // [no_stdname = true;]
35 // v = VALUE FOR FTM IF MATCHING;
36 // [extra_cond = STRING;]
38 // [gnuxxmin = NUMBER;]
39 // [gthread = yes|no;]
41 // [cxx11abi = yes|no;]
45 // The elements in square brackets are optional. These are formulated into a
46 // logical expression like:
47 // ((strict && c++ >= cxxmin) || (!strict && c++ >= gnuxxmin))
48 // && (gthr <=> gthread)
49 // && (host <=> hosted)
50 // && (cxx11 <=> cxx11abi)
52 // Where gthr, cxx11 and host are _GLIBCXX_HAS_GTHREADS, _GLIBCXX_USE_CXX11_ABI
53 // and _GLIBCXX_HOSTED respectively. If any of these are omitted, their
54 // sub-expressions are equivalent to the identity. Specially, if gnuxxmin is
55 // omitted, it is taken to be the value of cxxmin, and so, only if both are
56 // omitted, the clause is omitted.
58 // stdname configures the name of the *standard* macro emitted, i.e. it
59 // replaces only the __cpp_lib_ macro in the emitted definition. Defaults to
60 // __cpp_lib_${name}. If no_stdname exists (with any value), the stdname
61 // define is not emitted.
63 // N.B This list needs to be in topological sort order, as later entries in
64 // this list can and do use the earlier entries.
67 name = incomplete_container_elements;
75 name = uncaught_exceptions;
84 name = allocator_traits_is_always_equal;
92 name = is_null_pointer;
100 name = result_of_sfinae;
108 name = shared_ptr_arrays;
140 name = enable_shared_from_this;
150 name = math_spec_funcs;
151 stdname = "__STDCPP_MATH_SPEC_FUNCS__";
162 // It is very likely that earlier versions would work, but they are
165 extra_cond = "__cpp_impl_coroutine";
170 name = exchange_function;
178 name = integer_sequence;
186 name = integral_constant_callable;
202 name = make_reverse_iterator;
210 name = null_iterators;
218 name = transformation_trait_aliases;
226 name = transparent_operators;
234 name = tuple_element_t;
242 name = tuples_by_type;
250 name = robust_nonmodifying_seq_ops;
262 extra_cond = "_GLIBCXX_FLOAT_IS_IEEE_BINARY32 "
263 "&& _GLIBCXX_DOUBLE_IS_IEEE_BINARY64 "
264 "&& __SIZE_WIDTH__ >= 32";
269 extra_cond = "_GLIBCXX_FLOAT_IS_IEEE_BINARY32 "
270 "&& _GLIBCXX_DOUBLE_IS_IEEE_BINARY64 "
271 "&& __SIZE_WIDTH__ >= 32";
293 name = generic_associative_lookup;
311 name = quoted_string_io;
320 name = shared_timed_mutex;
339 name = addressof_constexpr;
341 // _GLIBCXX_RESOLVE_LIB_DEFECTS
342 // 2296. std::addressof should be constexpr
373 name = atomic_is_always_lock_free;
381 name = bool_constant;
397 name = has_unique_object_representations;
401 extra_cond = "defined(_GLIBCXX_HAVE_BUILTIN_HAS_UNIQ_OBJ_REP)";
406 name = hardware_interference_size;
410 extra_cond = "defined(__GCC_DESTRUCTIVE_SIZE)";
427 extra_cond = "defined(_GLIBCXX_HAVE_BUILTIN_IS_AGGREGATE)";
444 extra_cond = "defined(_GLIBCXX_HAVE_BUILTIN_LAUNDER)";
449 name = logical_traits;
457 name = make_from_tuple;
473 name = type_trait_variable_templates;
485 extra_cond = "__cpp_concepts >= 202002L && __cpp_constexpr >= 201811L && __cpp_explicit_this_parameter";
490 extra_cond = "__cpp_concepts >= 202002L && __cpp_constexpr >= 201811L";
499 // Used in earlier draft of SD6.
508 // Used in earlier draft of SD6.
525 name = raw_memory_algorithms;
529 extra_cond = "__cpp_constexpr >= 202406L";
538 name = array_constexpr;
550 name = nonmember_container_access;
574 name = boyer_moore_searcher;
588 cxx11abi = yes; // std::chrono::tzdb requires cxx11 std::string
600 v = 201902; // FIXME: should be 201603L
625 name = map_try_emplace;
634 name = math_special_functions;
643 name = memory_resource;
652 // For when there is no gthread.
669 name = parallel_algorithm;
696 name = shared_ptr_weak_type;
719 name = unordered_map_try_emplace;
728 name = assume_aligned;
736 name = atomic_flag_test;
752 name = atomic_lock_free_type_aliases;
756 extra_cond = "(__GCC_ATOMIC_INT_LOCK_FREE | __GCC_ATOMIC_LONG_LOCK_FREE | __GCC_ATOMIC_CHAR_LOCK_FREE) & 2";
769 name = atomic_value_initialization;
773 extra_cond = "__cpp_concepts >= 201907L";
790 extra_cond = "__cpp_explicit_this_parameter";
795 name = starts_ends_with;
807 extra_cond = "__has_builtin(__builtin_bit_cast)";
820 name = bounded_array_traits;
832 extra_cond = "__cpp_concepts >= 201907L";
836 // Moved down here (after concepts) by topological sort.
842 extra_cond = "__glibcxx_concepts";
855 name = optional_range_support;
863 name = destroying_delete;
867 extra_cond = "__cpp_impl_destroying_delete";
872 name = constexpr_string_view;
896 name = integer_comparison_functions;
904 name = is_constant_evaluated;
908 extra_cond = "defined(_GLIBCXX_HAVE_IS_CONSTANT_EVALUATED)";
912 // Moved down here (after is_constant_evaluated) by topological sort.
914 name = constexpr_char_traits;
916 // Unofficial macro indicating P1032R1 support in C++20
919 extra_cond = "defined(__glibcxx_is_constant_evaluated)";
922 // Unofficial macro indicating P0426R1 support in C++17
925 extra_cond = "_GLIBCXX_HAVE_IS_CONSTANT_EVALUATED";
930 name = is_layout_compatible;
934 extra_cond = "__has_builtin(__is_layout_compatible) "
935 "&& __has_builtin(__builtin_is_corresponding_member)";
940 name = is_nothrow_convertible;
948 name = is_pointer_interconvertible;
953 "__has_builtin(__is_pointer_interconvertible_base_of) "
954 "&& __has_builtin(__builtin_is_pointer_interconvertible_with_class)";
959 name = math_constants;
967 name = make_obj_using_allocator;
970 // Not specified by C++20, used internally
973 extra_cond = "__cpp_concepts";
986 name = source_location;
990 extra_cond = "__has_builtin(__builtin_source_location)";
999 extra_cond = "__glibcxx_concepts";
1004 extra_cond = "__glibcxx_concepts";
1025 name = three_way_comparison;
1029 extra_cond = "__cpp_impl_three_way_comparison >= 201907L "
1030 "&& __glibcxx_concepts";
1047 extra_cond = "__cpp_generic_lambdas >= 201707L";
1052 name = type_identity;
1068 name = constexpr_iterator;
1084 name = constexpr_utility;
1108 extra_cond = "__glibcxx_concepts";
1113 extra_cond = "__glibcxx_concepts";
1118 extra_cond = "__glibcxx_concepts";
1123 name = constexpr_numeric;
1131 name = constexpr_functional;
1139 name = constexpr_algorithms;
1151 name = constexpr_tuple;
1159 name = constexpr_memory;
1163 extra_cond = "__cpp_constexpr_dynamic_alloc";
1172 name = atomic_shared_ptr;
1182 // atomic_wait is available if either futexes or gthread are.
1194 extra_cond = "defined(_GLIBCXX_HAVE_LINUX_FUTEX)";
1203 // This condition carries in the hosted&&(futex||gthread) logic from above.
1204 extra_cond = "__cpp_aligned_new && __glibcxx_atomic_wait";
1210 // 202305 P2757R3 Type checking format args
1211 // 202306 P2637R3 Member visit
1212 // 202311 P2918R2 Runtime format strings II
1218 // 201907 Text Formatting, Integration of chrono, printf corner cases.
1219 // 202106 std::format improvements.
1220 // 202110 Fixing locale handling in chrono formatters, generator-like types.
1221 // 202207 Encodings in localized formatting of chrono, basic-format-string.
1222 // 202304 P2510R3 Formatting pointers
1231 name = format_uchar;
1239 // FIXME: #define __glibcxx_execution 201902L
1242 name = constexpr_complex;
1251 name = constexpr_dynamic_alloc;
1260 name = constexpr_string;
1266 extra_cond = "defined(__glibcxx_is_constant_evaluated)";
1273 extra_cond = "defined(__glibcxx_is_constant_evaluated)";
1279 extra_cond = "_GLIBCXX_HAVE_IS_CONSTANT_EVALUATED";
1284 name = constexpr_vector;
1293 name = constrained_equality;
1297 extra_cond = "__glibcxx_three_way_comparison";
1302 extra_cond = "__glibcxx_three_way_comparison";
1316 name = generic_unordered_lookup;
1339 extra_cond = "__glibcxx_atomic_wait";
1344 name = list_remove_return_type;
1353 name = polymorphic_allocator;
1362 name = move_iterator_concept;
1365 // This is P2520R0, a C++23 change, but we treat it as a DR against C++20.
1367 extra_cond = "__glibcxx_concepts";
1377 extra_cond = "__glibcxx_atomic_wait";
1382 name = smart_ptr_for_overwrite;
1409 name = constexpr_charconv;
1417 name = constexpr_typeinfo;
1429 extra_cond = "__cpp_concepts >= 202002L";
1434 name = format_ranges;
1435 // 202207 P2286R8 Formatting Ranges
1436 // 202207 P2585R1 Improving default container formatting
1437 // LWG3750 Too many papers bump __cpp_lib_format
1446 name = freestanding_algorithm;
1449 // This is a C++26 feature, but we support it in C++23.
1455 name = freestanding_array;
1458 // This is a C++26 feature, but we support it in C++23.
1464 name = freestanding_cstring;
1467 // This is a C++26 feature, but we support it in C++23.
1473 name = freestanding_expected;
1477 // This is a C++26 feature, but we support it in C++23.
1478 extra_cond = "__cpp_lib_expected";
1483 name = freestanding_optional;
1486 // This is a C++26 feature, but we support it in C++23.
1492 name = freestanding_string_view;
1495 // This is a C++26 feature, but we support it in C++23.
1501 name = freestanding_variant;
1504 // This is a C++26 feature, but we support it in C++23.
1518 name = is_scoped_enum;
1526 name = reference_from_temporary;
1530 "__has_builtin(__reference_constructs_from_temporary) "
1531 "&& __has_builtin(__reference_converts_from_temporary)";
1537 name = containers_ranges;
1546 name = ranges_to_container;
1563 name = ranges_chunk;
1571 name = ranges_slide;
1579 name = ranges_chunk_by;
1587 name = ranges_join_with;
1595 name = ranges_repeat;
1603 name = ranges_stride;
1611 name = ranges_cartesian_product;
1619 name = ranges_as_rvalue;
1627 name = ranges_as_const;
1635 name = ranges_enumerate;
1651 name = ranges_contains;
1667 name = ranges_find_last;
1675 name = ranges_starts_ends_with;
1683 name = constexpr_bitset;
1688 extra_cond = "__cpp_constexpr_dynamic_alloc";
1701 name = adaptor_iterator_pair_constructor;
1735 name = forward_like;
1747 extra_cond = "__glibcxx_coroutine && __cpp_sized_deallocation";
1752 name = ios_noreplace;
1761 name = move_only_function;
1770 name = copyable_function;
1779 name = function_ref;
1809 extra_cond = "__glibcxx_span";
1819 extra_cond = "_GLIBCXX_HAVE_STACKTRACE";
1824 name = string_contains;
1833 name = string_resize_and_overwrite;
1842 name = to_underlying;
1854 extra_cond = "__cpp_explicit_this_parameter >= 202110L";
1871 name = algorithm_default_value_type;
1879 name = constexpr_new;
1883 extra_cond = "__cpp_constexpr >= 202406L";
1888 name = fstream_native_handle;
1897 name = is_virtual_base_of;
1901 extra_cond = "__has_builtin(__builtin_is_virtual_base_of)";
1906 name = ranges_cache_latest;
1914 name = ranges_concat;
1918 extra_cond = "__cpp_pack_indexing";
1931 name = reference_wrapper;
1939 name = saturation_arithmetic;
1947 name = span_initializer_list;
1955 name = text_encoding;
1960 extra_cond = "_GLIBCXX_USE_NL_LANGINFO_L";
1965 name = ranges_to_input;
1978 extra_cond = "__glibcxx_to_chars";
1987 extra_cond = "__cpp_modules";
2010 name = smart_ptr_owner_equality;
2019 name = sstream_from_string_view;
2032 extra_cond = "__has_builtin(__builtin_type_order) "
2033 "&& __cpp_lib_three_way_comparison >= 201907L";
2038 name = exception_ptr_cast;
2046 name = bitset; // ...construct from string_view
2054 name = constexpr_exceptions;
2058 extra_cond = "__cpp_constexpr_exceptions >= 202411L";
2062 // Standard test specifications.
2063 stds[97] = ">= 199711L";
2064 stds[03] = ">= 199711L";
2065 stds[11] = ">= 201103L";
2066 stds[14] = ">= 201402L";
2067 stds[17] = ">= 201703L";
2068 stds[20] = ">= 202002L";
2069 stds[23] = ">= 202100L"; // Should be 202302L but Clang 16 uses 202101L
2070 stds[26] = "> 202302L"; // TODO: update when finalized
2073 // compile-command: "autogen version.def"