Hi! On Fri, Jan 11, 2019 at 04:54:11PM +0100, Jakub Jelinek wrote: > I've noticed we don't have any feature test macros in the table for C++20, > even when a couple of the features have them defined.
Here is an updated patch, that in addition to that makes 9 URLs as we now have #cxx in gcc-9/changes.html and adds missing P0941R2 entry that clang table has. For that one I'm not 100% sure what to say, I've copied all the macros from http://wg21.link/p0941r2 into two source files (attached below), one for core language features, another one for library and tested those with -std=c++2a with current trunk. Compared to what the paper lists, we have __has_cpp_attribute (carries_dependency) 0, __cpp_guaranteed_copy_elision and __cpp_nontype_template_parameter_auto not defined. Is that what we want? On the library side, __cpp_lib_any, __cpp_lib_execution, __cpp_lib_hardware_interference_size, __cpp_lib_null_iterators, __cpp_lib_parallel_algorithm, __cpp_lib_raw_memory_algorithms, __cpp_lib_to_chars, __cpp_lib_uncaught_exceptions, __cpp_lib_variant macros aren't defined (at least not in <version>) and __cpp_lib_optional, __cpp_lib_shared_ptr_arrays, __cpp_lib_string_view have smaller values than those in the P0941R2. Is that the desirable state given current C++2A implementation status? Ok for wwwdocs (or do you suggest something different for the P0941R2 imlementation status)? --- htdocs/projects/cxx-status.html.jj 2019-01-12 12:27:22.966732519 +0100 +++ htdocs/projects/cxx-status.html 2019-01-12 13:57:47.457900425 +0100 @@ -115,7 +115,7 @@ <tr> <td> Range-based for statements with initializer </td> <td><a href="http://wg21.link/p0614r1">P0614R1</a> </td> - <td class="supported"> 9 </td> + <td class="supported"> <a href="../gcc-9/changes.html#cxx">9</a> </td> <td> </td> </tr> <tr> @@ -127,28 +127,28 @@ <tr> <td> ADL and function templates that are not visible </td> <td><a href="http://wg21.link/p0846r0">P0846R0</a> </td> - <td class="supported"> 9 </td> + <td class="supported"> <a href="../gcc-9/changes.html#cxx">9</a> </td> <td> </td> </tr> <tr> <td> <code>const</code> mismatch with defaulted copy constructor </td> <td><a href="http://wg21.link/p0641r2">P0641R2</a> </td> - <td class="supported"> 9 </td> + <td class="supported"> <a href="../gcc-9/changes.html#cxx">9</a> </td> <td> </td> </tr> <tr> <td> Less eager instantiation of <code>constexpr</code> functions </td> <td><a href="http://wg21.link/p0859r0">P0859R0</a></td> - <td class="supported"> 5.2 (mostly)<br/>9 (P0859R0) </td> + <td class="supported"> 5.2 (mostly)<br/> <a href="../gcc-9/changes.html#cxx">9</a> (P0859R0) </td> <td> </td> </tr> <tr> <td> Consistent comparison (<code>operator<=></code>) </td> <td><a href="http://wg21.link/p0515r3">P0515R3</a><br/> - <a href="http://wg21.link/P0905r1">P0905R1</a><br/> + <a href="http://wg21.link/p0905r1">P0905R1</a><br/> <a href="http://wg21.link/p1120r0">P1120R0</a></td> <td class="unsupported"> No </td> - <td> </td> + <td> __cpp_impl_three_way_comparison >= 201711 </td> </tr> <tr> <td> Access checking on specializations </td> @@ -159,19 +159,19 @@ <tr> <td> Default constructible and assignable stateless lambdas </td> <td><a href="http://wg21.link/p0624r2">P0624R2</a></td> - <td class="supported"> 9 </td> + <td class="supported"> <a href="../gcc-9/changes.html#cxx">9</a> </td> <td> </td> </tr> <tr> <td> Lambdas in unevaluated contexts </td> <td><a href="http://wg21.link/p0315r4">P0315R4</a></td> - <td class="supported"> 9 </td> + <td class="supported"> <a href="../gcc-9/changes.html#cxx">9</a> </td> <td> </td> </tr> <tr> <td> Language support for empty objects </td> <td><a href="http://wg21.link/p0840r2">P0840R2</a></td> - <td class="supported"> 9 </td> + <td class="supported"> <a href="../gcc-9/changes.html#cxx">9</a> </td> <td> </td> </tr> <tr> @@ -195,32 +195,32 @@ <tr> <td> Down with typename! </td> <td><a href="http://wg21.link/p0634r3">P0634R3</a></td> - <td class="supported"> 9 </td> + <td class="supported"> <a href="../gcc-9/changes.html#cxx">9</a> </td> <td> </td> </tr> <tr> <td> Allow pack expansion in lambda init-capture </td> <td><a href="http://wg21.link/p0780r2">P0780R2</a></td> - <td class="supported"> 9 </td> + <td class="supported"> <a href="../gcc-9/changes.html#cxx">9</a> </td> <td> </td> </tr> <tr> <td> Proposed wording for likely and unlikely attributes </td> <td><a href="http://wg21.link/p0479r5">P0479R5</a></td> - <td class="supported"> 9 </td> + <td class="supported"> <a href="../gcc-9/changes.html#cxx">9</a> </td> <td> </td> </tr> <tr> <td> Deprecate implicit capture of this via [=] </td> <td><a href="http://wg21.link/p0806r2">P0806R2</a></td> - <td class="supported"> 9 </td> + <td class="supported"> <a href="../gcc-9/changes.html#cxx">9</a> </td> <td> </td> </tr> <tr> <td> Class Types in Non-Type Template Parameters </td> <td><a href="http://wg21.link/p0732r2">P0732R2</a></td> - <td class="supported"> 9 </td> - <td> </td> + <td class="supported"> <a href="../gcc-9/changes.html#cxx">9</a> </td> + <td> __cpp_nontype_template_parameter_class >= 201806 </td> </tr> <tr> <td> Atomic Compare-and-Exchange with Padding Bits </td> @@ -231,19 +231,19 @@ <tr> <td> Efficient sized delete for variable sized classes </td> <td><a href="http://wg21.link/p0722r3">P0722R3</a></td> - <td class="supported"> 9 </td> - <td> </td> + <td class="supported"> <a href="../gcc-9/changes.html#cxx">9</a> </td> + <td> __cpp_impl_destroying_delete >= 201806 </td> </tr> <tr> <td> Allowing Virtual Function Calls in Constant Expressions </td> <td><a href="http://wg21.link/p1064r0">P1064R0</a></td> - <td class="supported"> 9 </td> + <td class="supported"> <a href="../gcc-9/changes.html#cxx">9</a> </td> <td> </td> </tr> <tr> <td> Prohibit aggregates with user-declared constructors </td> <td><a href="http://wg21.link/p1008r1">P1008R1</a></td> - <td class="supported"> 9 </td> + <td class="supported"> <a href="../gcc-9/changes.html#cxx">9</a> </td> <td> </td> </tr> <tr> @@ -256,20 +256,20 @@ <tr> <td> explicit(bool) </td> <td><a href="http://wg21.link/p0892r2">P0892R2</a></td> - <td class="supported"> 9 </td> - <td> </td> + <td class="supported"> <a href="../gcc-9/changes.html#cxx">9</a> </td> + <td> __cpp_conditional_explicit >= 201806 </td> </tr> <tr> <td> Signed integers are two's complement </td> <td><a href="http://wg21.link/p1236r1">P1236R1</a></td> - <td class="supported"> 9 </td> + <td class="supported"> <a href="../gcc-9/changes.html#cxx">9</a> </td> <td> </td> </tr> <tr> <td> char8_t </td> <td><a href="http://wg21.link/p0482r6">P0482R6</a></td> <td class="unsupported"> No </td> - <td> </td> + <td> __cpp_char8_t >= 201811 </td> </tr> <tr> <td> Immediate functions (consteval) </td> @@ -280,23 +280,29 @@ <tr> <td> std::is_constant_evaluated </td> <td><a href="http://wg21.link/p0595r2">P0595R2</a></td> - <td class="supported"> 9 </td> + <td class="supported"> <a href="../gcc-9/changes.html#cxx">9</a> </td> <td> </td> </tr> <tr> <td> Nested inline namespaces </td> <td><a href="http://wg21.link/p1094r2">P1094R2</a></td> - <td class="supported"> 9 </td> + <td class="supported"> <a href="../gcc-9/changes.html#cxx">9</a> </td> <td> </td> </tr> <tr> - <td> Relaxations of constexpr restrictions</td> + <td> Relaxations of constexpr restrictions </td> <td><a href="http://wg21.link/p1002r1">P1002R1</a><br/> <a href="http://wg21.link/p1327r1">P1327R1</a><br/> <a href="http://wg21.link/p1330r0">P1330R0</a></td> <td class="unsupported"> No </td> <td> </td> </tr> + <tr> + <td> Feature test macros </td> + <td><a href="http://wg21.link/p0941r2">P0941R2</a><br/> + <td class="supported"> Almost all macros defined </td> + <td> </td> + </tr> </table> <h2 id="cxx17">C++17 Support in GCC</h2> Jakub
bool foo[] = { //__has_cpp_attribute (carries_dependency) >= 200809L, // is 0 __has_cpp_attribute (deprecated) >= 201309L, __has_cpp_attribute (fallthrough) >= 201603L, __has_cpp_attribute (likely) >= 201803L, __has_cpp_attribute (maybe_unused) >= 201603L, __has_cpp_attribute (no_unique_address) >= 201803L, __has_cpp_attribute (nodiscard) >= 201603L, __has_cpp_attribute (noreturn) >= 200809L, __has_cpp_attribute (unlikely) >= 201803L , __cpp_aggregate_bases >= 201603L, __cpp_aggregate_nsdmi >= 201304L, __cpp_alias_templates >= 200704L, __cpp_aligned_new >= 201606L, __cpp_attributes >= 200809L, __cpp_binary_literals >= 201304L, __cpp_capture_star_this >= 201603L, __cpp_constexpr >= 201603L, __cpp_decltype >= 200707L, __cpp_decltype_auto >= 201304L, __cpp_deduction_guides >= 201703L, __cpp_delegating_constructors >= 200604L, __cpp_enumerator_attributes >= 201411L, __cpp_fold_expressions >= 201603L, __cpp_generic_lambdas >= 201304L, // __cpp_guaranteed_copy_elision >= 201606L, __cpp_hex_float >= 201603L, __cpp_if_constexpr >= 201606L, __cpp_inheriting_constructors >= 201511L, __cpp_init_captures >= 201304L, __cpp_initializer_lists >= 200806L, __cpp_inline_variables >= 201606L, __cpp_lambdas >= 200907L, __cpp_namespace_attributes >= 201411L, __cpp_noexcept_function_type >= 201510L, __cpp_nontype_template_args >= 201411L, // __cpp_nontype_template_parameter_auto >= 201606L, __cpp_nsdmi >= 200809L, __cpp_range_based_for >= 201603L, __cpp_raw_strings >= 200710L, __cpp_ref_qualifiers >= 200710L, __cpp_return_type_deduction >= 201304L, __cpp_rvalue_references >= 200610L, __cpp_sized_deallocation >= 201309L, __cpp_static_assert >= 201411L, __cpp_structured_bindings >= 201606L, __cpp_template_template_args >= 201611L, __cpp_threadsafe_static_init >= 200806L, __cpp_unicode_characters >= 200704L, __cpp_unicode_literals >= 200710L, __cpp_user_defined_literals >= 200809L, __cpp_variable_templates >= 201304L, __cpp_variadic_templates >= 200704L, __cpp_variadic_using >= 201611L };
#include <version> bool bar[] = { __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 >= 201603L, __cpp_lib_byte >= 201603L, __cpp_lib_chrono >= 201611L, __cpp_lib_clamp >= 201603L, __cpp_lib_complex_udls >= 201309L, __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_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, // is 201603L // __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, // is 201603L __cpp_lib_shared_ptr_weak_type >= 201606L, __cpp_lib_shared_timed_mutex >= 201402L, __cpp_lib_string_udls >= 201304L, // __cpp_lib_string_view >= 201606L, // is 201603L // __cpp_lib_to_chars >= 201611L, __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 };