1 // Feature test macro definitions -*- C++ -*-
2 // Copyright (C) 2023-2024 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;]
34 // v = VALUE FOR FTM IF MATCHING;
35 // [extra_cond = STRING;]
37 // [gnuxxmin = NUMBER;]
38 // [gthread = yes|no;]
40 // [cxx11abi = yes|no;]
44 // The elements in square brackets are optional. These are formulated into a
45 // logical expression like:
46 // ((strict && c++ >= cxxmin) || (!strict && c++ >= gnuxxmin))
47 // && (gthr <=> gthread)
48 // && (host <=> hosted)
49 // && (cxx11 <=> cxx11abi)
51 // Where gthr, cxx11 and host are _GLIBCXX_HAS_GTHREADS, _GLIBCXX_USE_CXX11_ABI
52 // and _GLIBCXX_HOSTED respectively. If any of these are omitted, their
53 // sub-expressions are equivalent to the identity. Specially, if gnuxxmin is
54 // omitted, it is taken to be the value of cxxmin, and so, only if both are
55 // omitted, the clause is omitted.
57 // stdname configures the name of the *standard* macro emitted, i.e. it
58 // replaces only the __cpp_lib_ macro in the emitted definition. Defaults to
61 // N.B This list needs to be in topological sort order, as later entries in
62 // this list can and do use the earlier entries.
65 name = incomplete_container_elements;
73 name = uncaught_exceptions;
82 name = allocator_traits_is_always_equal;
90 name = is_null_pointer;
98 name = result_of_sfinae;
106 name = shared_ptr_arrays;
138 name = enable_shared_from_this;
148 name = math_spec_funcs;
149 stdname = "__STDCPP_MATH_SPEC_FUNCS__";
160 // It is very likely that earlier versions would work, but they are
163 extra_cond = "__cpp_impl_coroutine";
168 name = exchange_function;
176 name = integer_sequence;
184 name = integral_constant_callable;
200 name = make_reverse_iterator;
208 name = null_iterators;
212 extra_cond = "!defined(_GLIBCXX_DEBUG)";
217 name = transformation_trait_aliases;
225 name = transparent_operators;
233 name = tuple_element_t;
241 name = tuples_by_type;
249 name = robust_nonmodifying_seq_ops;
261 extra_cond = "_GLIBCXX_FLOAT_IS_IEEE_BINARY32 "
262 "&& _GLIBCXX_DOUBLE_IS_IEEE_BINARY64 "
263 "&& __SIZE_WIDTH__ >= 32";
268 extra_cond = "_GLIBCXX_FLOAT_IS_IEEE_BINARY32 "
269 "&& _GLIBCXX_DOUBLE_IS_IEEE_BINARY64 "
270 "&& __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";
494 // Used in earlier draft of SD6.
503 // Used in earlier draft of SD6.
520 name = raw_memory_algorithms;
528 name = array_constexpr;
540 name = nonmember_container_access;
564 name = boyer_moore_searcher;
589 v = 201902; // FIXME: should be 201603L
614 name = map_try_emplace;
623 name = math_special_functions;
632 name = memory_resource;
641 /* For when there's no gthread. */
658 name = parallel_algorithm;
687 name = shared_ptr_weak_type;
705 name = unordered_map_try_emplace;
714 name = assume_aligned;
722 name = atomic_flag_test;
738 name = atomic_lock_free_type_aliases;
754 name = atomic_value_initialization;
770 name = starts_ends_with;
782 extra_cond = "__has_builtin(__builtin_bit_cast)";
795 name = bounded_array_traits;
807 extra_cond = "__cpp_concepts >= 201907L";
811 // Moved down here (after concepts) by topological sort.
817 extra_cond = "__glibcxx_concepts";
830 name = destroying_delete;
834 extra_cond = "__cpp_impl_destroying_delete";
839 name = constexpr_string_view;
863 name = integer_comparison_functions;
871 name = is_constant_evaluated;
875 extra_cond = "defined(_GLIBCXX_HAVE_IS_CONSTANT_EVALUATED)";
879 // Moved down here (after is_constant_evaluated) by topological sort.
881 name = constexpr_char_traits;
883 // Unofficial macro indicating P1032R1 support in C++20
886 extra_cond = "defined(__glibcxx_is_constant_evaluated)";
889 // Unofficial macro indicating P0426R1 support in C++17
892 extra_cond = "_GLIBCXX_HAVE_IS_CONSTANT_EVALUATED";
897 name = is_layout_compatible;
901 extra_cond = "__has_builtin(__is_layout_compatible) "
902 "&& __has_builtin(__builtin_is_corresponding_member)";
907 name = is_nothrow_convertible;
915 name = is_pointer_interconvertible;
920 "__has_builtin(__is_pointer_interconvertible_base_of) "
921 "&& __has_builtin(__builtin_is_pointer_interconvertible_with_class)";
926 name = math_constants;
934 name = make_obj_using_allocator;
936 // Not specified by C++20, used internally
939 extra_cond = "__cpp_concepts";
952 name = source_location;
956 extra_cond = "__has_builtin(__builtin_source_location)";
965 extra_cond = "__glibcxx_concepts";
970 extra_cond = "__glibcxx_concepts";
983 name = three_way_comparison;
987 extra_cond = "__cpp_impl_three_way_comparison >= 201907L "
988 "&& __glibcxx_concepts";
1005 extra_cond = "__cpp_generic_lambdas >= 201707L";
1010 name = type_identity;
1026 name = constexpr_iterator;
1042 name = constexpr_utility;
1062 extra_cond = "__glibcxx_concepts";
1067 extra_cond = "__glibcxx_concepts";
1072 name = constexpr_numeric;
1080 name = constexpr_functional;
1088 name = constexpr_algorithms;
1096 name = constexpr_tuple;
1104 name = constexpr_memory;
1108 extra_cond = "__cpp_constexpr_dynamic_alloc";
1117 name = atomic_shared_ptr;
1127 // atomic_wait is available if either futexes or gthread are.
1139 extra_cond = "defined(_GLIBCXX_HAVE_LINUX_FUTEX)";
1148 // This condition carries in the hosted&&(futex||gthread) logic from above.
1149 extra_cond = "__cpp_aligned_new && __glibcxx_atomic_wait";
1154 // 201907 Text Formatting, Integration of chrono, printf corner cases.
1155 // 202106 std::format improvements.
1156 // 202110 Fixing locale handling in chrono formatters, generator-like types.
1157 // 202207 Encodings in localized formatting of chrono, basic-format-string.
1158 // 202207 P2286R8 Formatting Ranges
1159 // 202207 P2585R1 Improving default container formatting
1160 // TODO: #define __cpp_lib_format_ranges 202207L
1169 // FIXME: #define __glibcxx_execution 201902L
1172 name = constexpr_complex;
1181 name = constexpr_dynamic_alloc;
1190 name = constexpr_string;
1196 extra_cond = "defined(__glibcxx_is_constant_evaluated)";
1203 extra_cond = "defined(__glibcxx_is_constant_evaluated)";
1209 extra_cond = "_GLIBCXX_HAVE_IS_CONSTANT_EVALUATED";
1214 name = constexpr_vector;
1232 name = generic_unordered_lookup;
1255 extra_cond = "__glibcxx_atomic_wait";
1260 name = list_remove_return_type;
1269 name = polymorphic_allocator;
1278 name = move_iterator_concept;
1281 // This is P2520R0, a C++23 change, but we treat it as a DR against C++20.
1283 extra_cond = "__glibcxx_concepts";
1293 extra_cond = "__glibcxx_atomic_wait || _GLIBCXX_HAVE_POSIX_SEMAPHORE";
1298 name = smart_ptr_for_overwrite;
1325 name = constexpr_charconv;
1333 name = constexpr_typeinfo;
1345 extra_cond = "__cpp_concepts >= 202002L";
1350 name = freestanding_algorithm;
1353 // This is a C++26 feature, but we support it in C++23.
1359 name = freestanding_array;
1362 // This is a C++26 feature, but we support it in C++23.
1368 name = freestanding_cstring;
1371 // This is a C++26 feature, but we support it in C++23.
1377 name = freestanding_expected;
1381 // This is a C++26 feature, but we support it in C++23.
1382 extra_cond = "__cpp_lib_expected";
1387 name = freestanding_optional;
1390 // This is a C++26 feature, but we support it in C++23.
1396 name = freestanding_string_view;
1399 // This is a C++26 feature, but we support it in C++23.
1405 name = freestanding_variant;
1408 // This is a C++26 feature, but we support it in C++23.
1422 name = is_scoped_enum;
1430 name = reference_from_temporary;
1434 "__has_builtin(__reference_constructs_from_temporary) "
1435 "&& __has_builtin(__reference_converts_from_temporary)";
1441 // name = container_ranges;
1450 name = ranges_to_container;
1467 name = ranges_chunk;
1475 name = ranges_slide;
1483 name = ranges_chunk_by;
1491 name = ranges_join_with;
1499 name = ranges_repeat;
1507 name = ranges_stride;
1515 name = ranges_cartesian_product;
1523 name = ranges_as_rvalue;
1531 name = ranges_as_const;
1539 name = ranges_enumerate;
1555 name = ranges_contains;
1571 name = ranges_find_last;
1579 name = constexpr_bitset;
1584 extra_cond = "__cpp_constexpr_dynamic_alloc";
1597 name = adaptor_iterator_pair_constructor;
1615 name = forward_like;
1623 name = ios_noreplace;
1632 name = move_only_function;
1663 extra_cond = "__glibcxx_span";
1673 extra_cond = "_GLIBCXX_HAVE_STACKTRACE";
1678 name = string_contains;
1687 name = string_resize_and_overwrite;
1696 name = to_underlying;
1712 name = fstream_native_handle;
1729 name = saturation_arithmetic;
1742 extra_cond = "__glibcxx_to_chars";
1751 extra_cond = "__glibcxx_coroutine";
1755 // Standard test specifications.
1756 stds[97] = ">= 199711L";
1757 stds[03] = ">= 199711L";
1758 stds[11] = ">= 201103L";
1759 stds[14] = ">= 201402L";
1760 stds[17] = ">= 201703L";
1761 stds[20] = ">= 202002L";
1762 stds[23] = ">= 202100L"; // Should be 202302L but Clang 16 uses 202101L
1763 stds[26] = "> 202302L"; // TODO: update when finalized
1766 // compile-command: "autogen version.def"