From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 2AED83870886 for ; Wed, 23 Mar 2022 10:12:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 2AED83870886 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-584-fQiIUMb7MhqYadvD9ed-tA-1; Wed, 23 Mar 2022 06:12:55 -0400 X-MC-Unique: fQiIUMb7MhqYadvD9ed-tA-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 81325899EC2; Wed, 23 Mar 2022 10:12:54 +0000 (UTC) Received: from localhost (unknown [10.33.36.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4868E112132C; Wed, 23 Mar 2022 10:12:54 +0000 (UTC) From: Jonathan Wakely To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [committed] libstdc++: Fix feature test macros in for freestanding Date: Wed, 23 Mar 2022 10:12:53 +0000 Message-Id: <20220323101253.915951-1-jwakely@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" X-Spam-Status: No, score=-12.3 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libstdc++@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libstdc++ mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Mar 2022 10:12:58 -0000 Tested powerpc64le-linux, pushed to trunk. Backport to gcc-11 needed too. -- >8 -- Some C++17 and C++20 feature test macros are only defined in for hosted builds, even though the features are supported for freestanding. All C++23 feature test macros are defined in for freestanding, but most of the features are only supported for hosted. libstdc++-v3/ChangeLog: * include/std/version [!_GLIBCXX_HOSTED] (__cpp_lib_hardware_interference_size): Define for freestanding. (__cpp_lib_bit_cast): Likewise. (__cpp_lib_is_layout_compatible): Likewise. (__cpp_lib_is_pointer_interconvertible): Likewise. (__cpp_lib_adaptor_iterator_pair_constructor): Do not define for freestanding. (__cpp_lib_invoke_r): Likewise. (__cpp_lib_ios_noreplace): Likewise. (__cpp_lib_monadic_optional): Likewise. (__cpp_lib_move_only_function): Likewise. (__cpp_lib_spanstream): Likewise. (__cpp_lib_stacktrace): Likewise. (__cpp_lib_string_contains): Likewise. (__cpp_lib_string_resize_and_overwrite): Likewise. (__cpp_lib_to_underlying): Likewise. --- libstdc++-v3/include/std/version | 35 +++++++++++++++++--------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/libstdc++-v3/include/std/version b/libstdc++-v3/include/std/version index d730a7ea3c7..535f095108a 100644 --- a/libstdc++-v3/include/std/version +++ b/libstdc++-v3/include/std/version @@ -108,6 +108,9 @@ #ifdef _GLIBCXX_HAVE_BUILTIN_HAS_UNIQ_OBJ_REP # define __cpp_lib_has_unique_object_representations 201606L #endif +#ifdef __GCC_DESTRUCTIVE_SIZE +# define __cpp_lib_hardware_interference_size 201703L +#endif #ifdef _GLIBCXX_HAVE_BUILTIN_IS_AGGREGATE # define __cpp_lib_is_aggregate 201703L #endif @@ -142,9 +145,6 @@ #define __cpp_lib_filesystem 201703L #define __cpp_lib_gcd 201606L #define __cpp_lib_gcd_lcm 201606L -#ifdef __GCC_DESTRUCTIVE_SIZE -# define __cpp_lib_hardware_interference_size 201703L -#endif #define __cpp_lib_hypot 201603L #define __cpp_lib_invoke 201411L #define __cpp_lib_lcm 201606L @@ -188,6 +188,9 @@ #define __cpp_lib_atomic_float 201711L #define __cpp_lib_atomic_ref 201806L #define __cpp_lib_atomic_value_initialization 201911L +#if __has_builtin(__builtin_bit_cast) +# define __cpp_lib_bit_cast 201806L +#endif #define __cpp_lib_bitops 201907L #define __cpp_lib_bounded_array_traits 201902L // __cpp_lib_char8_t is defined in @@ -202,7 +205,15 @@ #ifdef _GLIBCXX_HAVE_IS_CONSTANT_EVALUATED # define __cpp_lib_is_constant_evaluated 201811L #endif +#if __has_builtin(__is_layout_compatible) \ + && __has_builtin(__builtin_is_corresponding_member) +# define __cpp_lib_is_layout_compatible 201907L +#endif #define __cpp_lib_is_nothrow_convertible 201806L +#if __has_builtin(__is_pointer_interconvertible_base_of) \ + && __has_builtin(__builtin_is_pointer_interconvertible_with_class) +# define __cpp_lib_is_pointer_interconvertible 201907L +#endif #define __cpp_lib_remove_cvref 201711L #if __has_builtin(__builtin_source_location) # define __cpp_lib_source_location 201907L @@ -224,9 +235,6 @@ # endif #endif #define __cpp_lib_bind_front 201907L -#if __has_builtin(__builtin_bit_cast) -# define __cpp_lib_bit_cast 201806L -#endif // FIXME: #define __cpp_lib_execution 201902L #define __cpp_lib_integer_comparison_functions 202002L #define __cpp_lib_constexpr_algorithms 201806L @@ -255,14 +263,6 @@ #ifdef _GLIBCXX_HAS_GTHREADS # define __cpp_lib_jthread 201911L #endif -#if __has_builtin(__is_layout_compatible) \ - && __has_builtin(__builtin_is_corresponding_member) -# define __cpp_lib_is_layout_compatible 201907L -#endif -#if __has_builtin(__is_pointer_interconvertible_base_of) \ - && __has_builtin(__builtin_is_pointer_interconvertible_with_class) -# define __cpp_lib_is_pointer_interconvertible 201907L -#endif #if __cpp_lib_atomic_wait # define __cpp_lib_latch 201907L #endif @@ -300,12 +300,14 @@ #if __cplusplus > 202002L // c++2b -#define __cpp_lib_adaptor_iterator_pair_constructor 202106L #define __cpp_lib_byteswap 202110L #define __cpp_lib_constexpr_typeinfo 202106L +#define __cpp_lib_is_scoped_enum 202011L + +#if _GLIBCXX_HOSTED +#define __cpp_lib_adaptor_iterator_pair_constructor 202106L #define __cpp_lib_invoke_r 202106L #define __cpp_lib_ios_noreplace 202200L -#define __cpp_lib_is_scoped_enum 202011L #if __cpp_lib_concepts # define __cpp_lib_monadic_optional 202110L #endif @@ -321,6 +323,7 @@ # define __cpp_lib_string_resize_and_overwrite 202110L #endif #define __cpp_lib_to_underlying 202102L +#endif #endif // C++2b #endif // C++20 #endif // C++17 -- 2.34.1