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;
216 name = transformation_trait_aliases;
224 name = transparent_operators;
232 name = tuple_element_t;
240 name = tuples_by_type;
248 name = robust_nonmodifying_seq_ops;
260 extra_cond = "_GLIBCXX_FLOAT_IS_IEEE_BINARY32 "
261 "&& _GLIBCXX_DOUBLE_IS_IEEE_BINARY64 "
262 "&& __SIZE_WIDTH__ >= 32";
267 extra_cond = "_GLIBCXX_FLOAT_IS_IEEE_BINARY32 "
268 "&& _GLIBCXX_DOUBLE_IS_IEEE_BINARY64 "
269 "&& __SIZE_WIDTH__ >= 32";
292 name = generic_associative_lookup;
310 name = quoted_string_io;
319 name = shared_timed_mutex;
338 name = addressof_constexpr;
340 // _GLIBCXX_RESOLVE_LIB_DEFECTS
341 // 2296. std::addressof should be constexpr
372 name = atomic_is_always_lock_free;
380 name = bool_constant;
396 name = has_unique_object_representations;
400 extra_cond = "defined(_GLIBCXX_HAVE_BUILTIN_HAS_UNIQ_OBJ_REP)";
405 name = hardware_interference_size;
409 extra_cond = "defined(__GCC_DESTRUCTIVE_SIZE)";
426 extra_cond = "defined(_GLIBCXX_HAVE_BUILTIN_IS_AGGREGATE)";
443 extra_cond = "defined(_GLIBCXX_HAVE_BUILTIN_LAUNDER)";
448 name = logical_traits;
456 name = make_from_tuple;
472 name = type_trait_variable_templates;
484 extra_cond = "__cpp_concepts >= 202002L && __cpp_constexpr >= 201811L";
493 // Used in earlier draft of SD6.
502 // Used in earlier draft of SD6.
519 name = raw_memory_algorithms;
527 name = array_constexpr;
539 name = nonmember_container_access;
563 name = boyer_moore_searcher;
588 v = 201902; // FIXME: should be 201603L
613 name = map_try_emplace;
622 name = math_special_functions;
631 name = memory_resource;
640 /* For when there's no gthread. */
657 name = parallel_algorithm;
686 name = shared_ptr_weak_type;
704 name = unordered_map_try_emplace;
713 name = assume_aligned;
721 name = atomic_flag_test;
737 name = atomic_lock_free_type_aliases;
741 extra_cond = "(__GCC_ATOMIC_INT_LOCK_FREE | __GCC_ATOMIC_LONG_LOCK_FREE | __GCC_ATOMIC_CHAR_LOCK_FREE) & 2";
754 name = atomic_value_initialization;
774 extra_cond = "__cpp_explicit_this_parameter";
779 name = starts_ends_with;
791 extra_cond = "__has_builtin(__builtin_bit_cast)";
804 name = bounded_array_traits;
816 extra_cond = "__cpp_concepts >= 201907L";
820 // Moved down here (after concepts) by topological sort.
826 extra_cond = "__glibcxx_concepts";
839 name = destroying_delete;
843 extra_cond = "__cpp_impl_destroying_delete";
848 name = constexpr_string_view;
872 name = integer_comparison_functions;
880 name = is_constant_evaluated;
884 extra_cond = "defined(_GLIBCXX_HAVE_IS_CONSTANT_EVALUATED)";
888 // Moved down here (after is_constant_evaluated) by topological sort.
890 name = constexpr_char_traits;
892 // Unofficial macro indicating P1032R1 support in C++20
895 extra_cond = "defined(__glibcxx_is_constant_evaluated)";
898 // Unofficial macro indicating P0426R1 support in C++17
901 extra_cond = "_GLIBCXX_HAVE_IS_CONSTANT_EVALUATED";
906 name = is_layout_compatible;
910 extra_cond = "__has_builtin(__is_layout_compatible) "
911 "&& __has_builtin(__builtin_is_corresponding_member)";
916 name = is_nothrow_convertible;
924 name = is_pointer_interconvertible;
929 "__has_builtin(__is_pointer_interconvertible_base_of) "
930 "&& __has_builtin(__builtin_is_pointer_interconvertible_with_class)";
935 name = math_constants;
943 name = make_obj_using_allocator;
945 // Not specified by C++20, used internally
948 extra_cond = "__cpp_concepts";
961 name = source_location;
965 extra_cond = "__has_builtin(__builtin_source_location)";
974 extra_cond = "__glibcxx_concepts";
979 extra_cond = "__glibcxx_concepts";
992 name = three_way_comparison;
996 extra_cond = "__cpp_impl_three_way_comparison >= 201907L "
997 "&& __glibcxx_concepts";
1014 extra_cond = "__cpp_generic_lambdas >= 201707L";
1019 name = type_identity;
1035 name = constexpr_iterator;
1051 name = constexpr_utility;
1071 extra_cond = "__glibcxx_concepts";
1076 extra_cond = "__glibcxx_concepts";
1081 name = constexpr_numeric;
1089 name = constexpr_functional;
1097 name = constexpr_algorithms;
1105 name = constexpr_tuple;
1113 name = constexpr_memory;
1117 extra_cond = "__cpp_constexpr_dynamic_alloc";
1126 name = atomic_shared_ptr;
1136 // atomic_wait is available if either futexes or gthread are.
1148 extra_cond = "defined(_GLIBCXX_HAVE_LINUX_FUTEX)";
1157 // This condition carries in the hosted&&(futex||gthread) logic from above.
1158 extra_cond = "__cpp_aligned_new && __glibcxx_atomic_wait";
1163 // 201907 Text Formatting, Integration of chrono, printf corner cases.
1164 // 202106 std::format improvements.
1165 // 202110 Fixing locale handling in chrono formatters, generator-like types.
1166 // 202207 Encodings in localized formatting of chrono, basic-format-string.
1167 // 202207 P2286R8 Formatting Ranges
1168 // 202207 P2585R1 Improving default container formatting
1169 // TODO: #define __cpp_lib_format_ranges 202207L
1179 name = format_uchar;
1187 // FIXME: #define __glibcxx_execution 201902L
1190 name = constexpr_complex;
1199 name = constexpr_dynamic_alloc;
1208 name = constexpr_string;
1214 extra_cond = "defined(__glibcxx_is_constant_evaluated)";
1221 extra_cond = "defined(__glibcxx_is_constant_evaluated)";
1227 extra_cond = "_GLIBCXX_HAVE_IS_CONSTANT_EVALUATED";
1232 name = constexpr_vector;
1241 name = constrained_equality;
1245 extra_cond = "__glibcxx_three_way_comparison";
1259 name = generic_unordered_lookup;
1282 extra_cond = "__glibcxx_atomic_wait";
1287 name = list_remove_return_type;
1296 name = polymorphic_allocator;
1305 name = move_iterator_concept;
1308 // This is P2520R0, a C++23 change, but we treat it as a DR against C++20.
1310 extra_cond = "__glibcxx_concepts";
1320 extra_cond = "__glibcxx_atomic_wait || _GLIBCXX_HAVE_POSIX_SEMAPHORE";
1325 name = smart_ptr_for_overwrite;
1352 name = constexpr_charconv;
1360 name = constexpr_typeinfo;
1372 extra_cond = "__cpp_concepts >= 202002L";
1377 name = freestanding_algorithm;
1380 // This is a C++26 feature, but we support it in C++23.
1386 name = freestanding_array;
1389 // This is a C++26 feature, but we support it in C++23.
1395 name = freestanding_cstring;
1398 // This is a C++26 feature, but we support it in C++23.
1404 name = freestanding_expected;
1408 // This is a C++26 feature, but we support it in C++23.
1409 extra_cond = "__cpp_lib_expected";
1414 name = freestanding_optional;
1417 // This is a C++26 feature, but we support it in C++23.
1423 name = freestanding_string_view;
1426 // This is a C++26 feature, but we support it in C++23.
1432 name = freestanding_variant;
1435 // This is a C++26 feature, but we support it in C++23.
1449 name = is_scoped_enum;
1457 name = reference_from_temporary;
1461 "__has_builtin(__reference_constructs_from_temporary) "
1462 "&& __has_builtin(__reference_converts_from_temporary)";
1468 // name = containers_ranges;
1477 name = ranges_to_container;
1494 name = ranges_chunk;
1502 name = ranges_slide;
1510 name = ranges_chunk_by;
1518 name = ranges_join_with;
1526 name = ranges_repeat;
1534 name = ranges_stride;
1542 name = ranges_cartesian_product;
1550 name = ranges_as_rvalue;
1558 name = ranges_as_const;
1566 name = ranges_enumerate;
1582 name = ranges_contains;
1598 name = ranges_find_last;
1606 name = constexpr_bitset;
1611 extra_cond = "__cpp_constexpr_dynamic_alloc";
1624 name = adaptor_iterator_pair_constructor;
1642 name = forward_like;
1654 extra_cond = "__glibcxx_coroutine && __cpp_sized_deallocation";
1659 name = ios_noreplace;
1668 name = move_only_function;
1699 extra_cond = "__glibcxx_span";
1709 extra_cond = "_GLIBCXX_HAVE_STACKTRACE";
1714 name = string_contains;
1723 name = string_resize_and_overwrite;
1732 name = to_underlying;
1756 name = fstream_native_handle;
1773 name = reference_wrapper;
1781 name = saturation_arithmetic;
1789 name = text_encoding;
1794 extra_cond = "_GLIBCXX_USE_NL_LANGINFO_L";
1804 extra_cond = "__glibcxx_to_chars";
1809 name = ranges_concat;
1816 // Standard test specifications.
1817 stds[97] = ">= 199711L";
1818 stds[03] = ">= 199711L";
1819 stds[11] = ">= 201103L";
1820 stds[14] = ">= 201402L";
1821 stds[17] = ">= 201703L";
1822 stds[20] = ">= 202002L";
1823 stds[23] = ">= 202100L"; // Should be 202302L but Clang 16 uses 202101L
1824 stds[26] = "> 202302L"; // TODO: update when finalized
1827 // compile-command: "autogen version.def"