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 0FC3B3858284 for ; Fri, 3 Feb 2023 14:52:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0FC3B3858284 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1675435920; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=nsDXx4cGPh6/msQAMx8HPpRm8IJBtDmwOII3DijASvg=; b=Mikfl/Hwgv9iSoPLzm6ZOMwZm4+R9i0RKMGKdD7z/8N42/MjFxoqRG5TbHDJqdT0SpsguC dPQ4WDuLFAgeLES9CGPKXqvMNhHaGjQ8+4yXaoscbLQKOYFzDTP0KXsDKe7SMHClMfkWEM nusSY+UyTFNHmlKUmmFQIJjKhTEHz3U= Received: from mail-lf1-f70.google.com (mail-lf1-f70.google.com [209.85.167.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-66-gOlCSBc5MvGSqis03w6o9g-1; Fri, 03 Feb 2023 09:51:59 -0500 X-MC-Unique: gOlCSBc5MvGSqis03w6o9g-1 Received: by mail-lf1-f70.google.com with SMTP id i13-20020a056512340d00b004b8825890a1so2213473lfr.1 for ; Fri, 03 Feb 2023 06:51:59 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=nsDXx4cGPh6/msQAMx8HPpRm8IJBtDmwOII3DijASvg=; b=NJsq2VpSw+JNYdIkMXO9bvUBEL/JHHaUcgWB8caW4wkkZ2vrYQ65q6HpiMDtQ7QJ7i 23YssGe8YcC3wnY7QoFwB9eIrw/ep84k7LOEFquBNpu1tl3cd2800sV+d6lfpOz4tldd 7ji6hopm958UwOVXnK0ScGaLmRlriTMhLxsi7cH2OAJ2CZdZtbDQsJiAzoyieAg7pmMU bIQaIqLGHnNtwXK00n/Q0BbW07fpSlNZla4PphTckpkn3lZzyjDjMNW9YOirZTYzXpoR ocdIfLSvklXtS97Wo2eN+yYe7WLKdJZXDCo2WyxHnVpp5K6kC7N4H7kO5WckcYiSPqP9 6IXQ== X-Gm-Message-State: AO0yUKXwEbAX7nKXMD+uIXiD6HoJJ12EPO0jJjXVC1pExN66D0hCggZ+ PYC/+zRF91dh/VNVRH5/q33obqsGysxZiGOLRVN7GCDbsomRJKmzHl5nx6rcdaCDGuG+coVvXde xBOXOYT54qK8DyBwkAku//mzIDprIq3k= X-Received: by 2002:a05:6512:949:b0:4c9:af8b:ebe5 with SMTP id u9-20020a056512094900b004c9af8bebe5mr1862653lft.232.1675435918157; Fri, 03 Feb 2023 06:51:58 -0800 (PST) X-Google-Smtp-Source: AK7set//w9a8GMEPMCWEUX6BgfSCg5KIOqjX9sMDGuknOwAiidToLmTjQfBcDek+5UIuzArOk9CizdkzuZbKsRX2++A= X-Received: by 2002:a05:6512:949:b0:4c9:af8b:ebe5 with SMTP id u9-20020a056512094900b004c9af8bebe5mr1862650lft.232.1675435917958; Fri, 03 Feb 2023 06:51:57 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Jonathan Wakely Date: Fri, 3 Feb 2023 14:51:46 +0000 Message-ID: Subject: Re: [PATCH 1/2] libstdc++: Normalise _GLIBCXX20_DEPRECATED macro To: Nathaniel Shead Cc: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-12.2 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_H2,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Wed, 28 Dec 2022 at 14:28, Nathaniel Shead via Libstdc++ wrote: > > These two patches implement P1413 (deprecate std::aligned_storage and > std::aligned_union) for C++23. Tested on x86_64-linux. > > -- >8 -- > > Updates _GLIBCXX20_DEPRECATED to be defined and behave the same as the > versions for other standards (e.g. _GLIBCXX17_DEPRECATED). > > libstdc++-v3/ChangeLog: > > * doc/doxygen/user.cfg.in (PREDEFINED): Update macros. > * include/bits/c++config (_GLIBCXX20_DEPRECATED): Make > consistent with other 'deprecated' macros. > * include/std/type_traits (is_pod, is_pod_v): Use > _GLIBCXX20_DEPRECATED_SUGGEST instead. > > Signed-off-by: Nathaniel Shead > --- > libstdc++-v3/doc/doxygen/user.cfg.in | 4 ++-- > libstdc++-v3/include/bits/c++config | 6 +++--- > libstdc++-v3/include/std/type_traits | 4 ++-- > 3 files changed, 7 insertions(+), 7 deletions(-) > > diff --git a/libstdc++-v3/doc/doxygen/user.cfg.in b/libstdc++-v3/doc/doxygen/user.cfg.in > index 834ad9e4fd5..fc46e722529 100644 > --- a/libstdc++-v3/doc/doxygen/user.cfg.in > +++ b/libstdc++-v3/doc/doxygen/user.cfg.in > @@ -2394,8 +2394,8 @@ PREDEFINED = __cplusplus=202002L \ > "_GLIBCXX11_DEPRECATED_SUGGEST(E)= " \ > "_GLIBCXX17_DEPRECATED= " \ > "_GLIBCXX17_DEPRECATED_SUGGEST(E)= " \ > - "_GLIBCXX20_DEPRECATED(E)= " \ > - "_GLIBCXX20_DEPRECATED(E)= " \ > + "_GLIBCXX20_DEPRECATED= " \ > + "_GLIBCXX20_DEPRECATED_SUGGEST(E)= " \ Oops, good catch, that should definitely be fixed. > _GLIBCXX17_INLINE=inline \ > _GLIBCXX_CHRONO_INT64_T=int64_t \ > _GLIBCXX_DEFAULT_ABI_TAG \ > diff --git a/libstdc++-v3/include/bits/c++config b/libstdc++-v3/include/bits/c++config > index 50406066afe..d2b0cfa15ce 100644 > --- a/libstdc++-v3/include/bits/c++config > +++ b/libstdc++-v3/include/bits/c++config > @@ -84,7 +84,7 @@ > // _GLIBCXX14_DEPRECATED_SUGGEST( string-literal ) > // _GLIBCXX17_DEPRECATED > // _GLIBCXX17_DEPRECATED_SUGGEST( string-literal ) > -// _GLIBCXX20_DEPRECATED( string-literal ) > +// _GLIBCXX20_DEPRECATED > // _GLIBCXX20_DEPRECATED_SUGGEST( string-literal ) > #ifndef _GLIBCXX_USE_DEPRECATED > # define _GLIBCXX_USE_DEPRECATED 1 > @@ -124,10 +124,10 @@ > #endif > > #if defined(__DEPRECATED) && (__cplusplus >= 202002L) > -# define _GLIBCXX20_DEPRECATED(MSG) [[deprecated(MSG)]] > +# define _GLIBCXX20_DEPRECATED [[__deprecated__]] > # define _GLIBCXX20_DEPRECATED_SUGGEST(ALT) _GLIBCXX_DEPRECATED_SUGGEST(ALT) > #else > -# define _GLIBCXX20_DEPRECATED(MSG) > +# define _GLIBCXX20_DEPRECATED I think this inconsistency was actually deliberate... > # define _GLIBCXX20_DEPRECATED_SUGGEST(ALT) > #endif > > diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits > index 5dc9e1b2921..2f4d4bb8d4d 100644 > --- a/libstdc++-v3/include/std/type_traits > +++ b/libstdc++-v3/include/std/type_traits > @@ -815,7 +815,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION > // Could use is_standard_layout && is_trivial instead of the builtin. > template > struct > - _GLIBCXX20_DEPRECATED("use is_standard_layout && is_trivial instead") > + _GLIBCXX20_DEPRECATED_SUGGEST("is_standard_layout && is_trivial") This doesn't quite work. The SUGGEST macro will enclose its argument in single quotes, so here we get: is_pod is deprecated, use 'is_standard_layout && is_trivial' instead. That makes it look like 'is_standard_layout && is_trivial' is a piece of valid code, but it's not. It would need to use the variable templates not the class templates, and would need template argument lists: is_pod is deprecated, use 'is_standard_layout_v && is_trivial_v' instead. Then we have the question of whether it's OK to use 'T' here when that is neither the template parameter in the header (that's '_Tp') nor the user's code (that will be some class type that we can't know in the attribute's string-literal). So I think my preference would be to leave _GLIBCXX20_DEPRECATED as is, and always require a message. If possible, we should always say something user-friendly, e.g. for std::aligned_storage we could use something like: _GLIBCXX23_DEPRECATED("use an aligned array of bytes instead") We don't want to use the SUGGEST macro here because we don't want the single quotes. But I don't see an obvious message we could use for std::aligned_union ... so because I'm too lazy to spend any longer thinking about it, I think I'll just merge both your patches. Thanks for contributing them!