From patchwork Wed Dec 28 14:28:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathaniel Shead X-Patchwork-Id: 37208 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp1918500wrt; Wed, 28 Dec 2022 06:29:40 -0800 (PST) X-Google-Smtp-Source: AMrXdXs4s3yEUm3OCIUReudl6TrftdJIIa9J5I8JCTFUkLq/+Bu4SF2YAYBn6XsqNVNH8lM5dqhk X-Received: by 2002:aa7:d0d4:0:b0:461:ed76:cb45 with SMTP id u20-20020aa7d0d4000000b00461ed76cb45mr21030422edo.24.1672237780566; Wed, 28 Dec 2022 06:29:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672237780; cv=none; d=google.com; s=arc-20160816; b=jleNFew/kUYJIYoYk/XLJCiR1/K3tUGlSxWDDvs2ot/FuRasgevXs07aYge8eAgryr 5+MewBSPlaBNy6b4mAPNco3v/OP/jYbUb2nzywS6FmXnY2U1ooakpW55AWNw99d1iQpl G8CMEhJeNGxiWPwhQClSLAvzHrZM51qeilgd/aH6aSqo6h1MoYJuxtPt0Wd+kyeoDrza ILJvX2NXVIYlthl9XWqa27hg77kIRAyGoVXJyMVX3FXYw29vR8p2Tltw6XX8fCz+CL2G dKUCZfeZStrk5t3HmE2JvIZSD3K94BnJ/2Ib1fZLf6zyj3QqTel/igQLHbISI6hw+npW qgOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-disposition:mime-version:message-id:subject:to:date :dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=NVJ/RORKCUV0X0vV7D6Ackm2BL/A93NTBAfiMlo6UJY=; b=ODyJglQ7/hcQ1TUkOSH8dX5Q43C+GH6dZvdxu45Ie8n4XL6UfzeXvZy1B93lrUF3Lp TK/CCOXqZ40l4X1c3TspL0dM5EmYMVpNCOvi5k2sHNRK0D4/HZE4E7Cby5T4HvpJ7GiR sRGVA0XXPzx2zcPOWUSiYOo47hkYXIJGTVKxvJtJmlSgePhEKsYuvLdO/7AXWM5Z5MBM phKhh+mSRhhX6qpQ2IuJJcjEvjgnvHILtcoGLGj7IpFNhDfALxe+rY1wKQwIjwzcGFhx 61MJ+6nNWm+4eM0VP7V3lu9m03ToCvAxLx0ox8Ty/J32Naw3dMeWeDUrUPLASsXiXxdE eX8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b="W/FKsWok"; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id q33-20020a05640224a100b004855f088a3csi6246087eda.608.2022.12.28.06.29.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Dec 2022 06:29:40 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b="W/FKsWok"; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B6C30384E7A7 for ; Wed, 28 Dec 2022 14:29:06 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B6C30384E7A7 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1672237746; bh=NVJ/RORKCUV0X0vV7D6Ackm2BL/A93NTBAfiMlo6UJY=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=W/FKsWokFCTAbMucl8EjyIkeK3e65f/QoVhYBOdKwe4sIRImSPmEi7lb6T//0iPjk BNl+07VTtDBhLB0YPoceqZR7mC5FwyA/aRpSghBWVawCbrfOMBwlQT1Lo3ToAT4Xzg uF8sDGORUNs1K99mEhWW9j8tC9cwLxXs7T2QwvH4= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-pl1-x636.google.com (mail-pl1-x636.google.com [IPv6:2607:f8b0:4864:20::636]) by sourceware.org (Postfix) with ESMTPS id 5E0CF3858D33; Wed, 28 Dec 2022 14:28:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 5E0CF3858D33 Received: by mail-pl1-x636.google.com with SMTP id s7so16191061plk.5; Wed, 28 Dec 2022 06:28:21 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-disposition:mime-version:message-id:subject:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=NVJ/RORKCUV0X0vV7D6Ackm2BL/A93NTBAfiMlo6UJY=; b=p6gQ8+yD4sOp+J6Su3+XQjVCnqFvlJUqmlizlBhxWy5Z3T46cKHoHl4MBDNKbsFhnU v+yACa7UELqrDOZWWX7ht8wMI/9Buc3QPqszHRT/wRVQNjHtF9cOr2SSyG2QuIPDdG18 TQJtkw4ayMj3ej4vwYzTTMrZI3kIqsFfGrldSgb/2PerJkTOyRhz/rXojeunrLjoiJJu 5OplVqi92UL5B2KOvn7ZS2LkOniWnDoxItZKmEg3KjuDCN2YUE7fYatEQ7cfxL+D/IZB mypWGtPufCrumoT3DpIVFyM0jztflrPgCnol5Yt6PcP9zJ0pL9ireX32fh2T92KqCT70 udYA== X-Gm-Message-State: AFqh2kqa8wQEdQsZMtnGRbU/YAAs8EESWSh2WKILOiN8sAKnhN92bGj0 Qv0t9T7gh7MMe68EoExwDNnAKZgllMkARw== X-Received: by 2002:a17:90b:3d0b:b0:219:5955:7570 with SMTP id pt11-20020a17090b3d0b00b0021959557570mr32126394pjb.46.1672237698489; Wed, 28 Dec 2022 06:28:18 -0800 (PST) Received: from Thaum.localdomain ([114.198.17.102]) by smtp.gmail.com with ESMTPSA id d15-20020a17090a3b0f00b002190eabb890sm5214508pjc.25.2022.12.28.06.28.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Dec 2022 06:28:17 -0800 (PST) Date: Thu, 29 Dec 2022 01:28:11 +1100 To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [PATCH 1/2] libstdc++: Normalise _GLIBCXX20_DEPRECATED macro Message-ID: MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-10.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, 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 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Nathaniel Shead via Gcc-patches From: Nathaniel Shead Reply-To: Nathaniel Shead Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1753468403054959468?= X-GMAIL-MSGID: =?utf-8?q?1753468403054959468?= 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)= " \ _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 # 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") is_pod : public integral_constant { @@ -3210,7 +3210,7 @@ template template inline constexpr bool is_standard_layout_v = __is_standard_layout(_Tp); template - _GLIBCXX20_DEPRECATED("use is_standard_layout_v && is_trivial_v instead") + _GLIBCXX20_DEPRECATED_SUGGEST("is_standard_layout_v && is_trivial_v") inline constexpr bool is_pod_v = __is_pod(_Tp); template _GLIBCXX17_DEPRECATED From patchwork Wed Dec 28 14:28:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathaniel Shead X-Patchwork-Id: 37209 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp1918798wrt; Wed, 28 Dec 2022 06:30:17 -0800 (PST) X-Google-Smtp-Source: AMrXdXt/Bd4e6NxEHts7nzB3RSeZBaehJf4jaAQwRvFtriKTj2blv5lXohjeUsirml79sMKpHSUf X-Received: by 2002:a05:6402:2a02:b0:470:44eb:9e58 with SMTP id ey2-20020a0564022a0200b0047044eb9e58mr22914001edb.30.1672237817049; Wed, 28 Dec 2022 06:30:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672237817; cv=none; d=google.com; s=arc-20160816; b=kFUGKPg9YHy+7QiWunniGHcTVp8ByBYRyvJFjJKOtCh86f64i+IzT9wG6Ar/Xb4cCS PPYjQH9tHUoORhUuHnYq4aN39pcafLnje0rJSTq6ab/DIhX3HyPKJ9ZSaVvqEK/ufIXW 8RtFKAUH1t9mP4m6YrjcqxA+2kohOtphNvS1BT5dn90FiW4SzYIpOOE8u94dbCxSF8XK tTm+ei37GNxE43f6glmYaUr+AZFoITVniV/N2kdOCUGvMc1eUkBWwBM5N9pdKMipEQDr XWSQv6I6t/FH7s9KeIMgDTUIQ2SiqvNgUlJzArUiBgIvyqaPskVXxFdCUc1a8RybdOHI xBYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-disposition:mime-version:message-id:subject:to:date :dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=AOvp+85YGEY3OJ3JyYH9EH/9YtKp9ARXkrBKb9xDcuQ=; b=Oz0a5DqqcehFH+F+J1XH6IZ00bmkRcfGvK5FGNdQgYDZyoR6ew/a8gXPocWeVizSTZ 71ALa89sI7WJMsIyzQAMgHrXFm9+uy0GDpPOOT5mM52kQUNxwev+r8bRRwAtM4bW1iO/ cjzlW+XyML+cNRkLEOQiLaNutv+ndWaat8m73bqIn4uXhyNxWmEsyHuNMQmMhE1ltqtQ iAsp26O/oNY7JwofNzSF9SAisb36IEa76trD4AA5WZwPCoMTlm8YTUVxyUoA8MzeYGhv CiVMKCVAbXhHrmwKvln5GCRismSo7qJ2C73NbkQHs1R3BZef2NB+OAMJCeMymHF6UqAz dzEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=GtrhQTIJ; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id e19-20020a056402191300b0046ffcd4df07si15869669edz.569.2022.12.28.06.30.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Dec 2022 06:30:17 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=GtrhQTIJ; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A64C23857C51 for ; Wed, 28 Dec 2022 14:29:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A64C23857C51 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1672237778; bh=AOvp+85YGEY3OJ3JyYH9EH/9YtKp9ARXkrBKb9xDcuQ=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=GtrhQTIJgSVkCgQbKYeWP1fxLtwPnWQsVoItfhDoQTUqVjh3H7jRgIjpXb1W1rAe3 gIqLtTrJMZXwm6r6earqEf9glGkvCAAlAZT3aYekHVjyJhij0T/qP8rYPWou9AvOTE UWTiuGjSiIXw5wUL8rxe5jo+9ZvBdy6JIv3ZV1KU= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-pl1-x635.google.com (mail-pl1-x635.google.com [IPv6:2607:f8b0:4864:20::635]) by sourceware.org (Postfix) with ESMTPS id 38F653858280; Wed, 28 Dec 2022 14:28:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 38F653858280 Received: by mail-pl1-x635.google.com with SMTP id t2so16209563ply.2; Wed, 28 Dec 2022 06:28:33 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-disposition:mime-version:message-id:subject:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=AOvp+85YGEY3OJ3JyYH9EH/9YtKp9ARXkrBKb9xDcuQ=; b=i6Pkl0APGK/uxmugRwlU4LjA+1rhG/LMRe9M7mvkoR+x8vkM3Ja7u/W60Xp+XmM3af pcQmfZbkG+Hk3Tt5JakQYgwRsWYExeIuWUWbKfHsk1lKG1jLFI/imXdsvsgrHcvap7QD Je2lAHT8YjM26+IrzZcY14VzyT9bBpq78jmdaD5YQ2qSD6KtelRVtlCYK6U4KvMLRNOR x+iaAygueRUZnBjFh/khoJOIbN2YckJrJ3xEvjr/HY91EAgN4tDAVDoqoRXPL6n7idtD ZdJeR6LR5c4elzRQFcck4KVblmaDtonOg9tioTTjYI9STv2zkOzsCjeUCcTjW+aOSRup dp4w== X-Gm-Message-State: AFqh2kp5UDlhWZlQj2iOeGj83OMJFcyQ8bV6D4q2Xk4euEt83c8fLJ2s JCxNQyMvSIxCaPLAwfd3nsU2azABq/aABQ== X-Received: by 2002:a17:903:451:b0:192:820d:d1 with SMTP id iw17-20020a170903045100b00192820d00d1mr12075824plb.25.1672237711815; Wed, 28 Dec 2022 06:28:31 -0800 (PST) Received: from Thaum.localdomain ([114.198.17.102]) by smtp.gmail.com with ESMTPSA id u14-20020a170903124e00b00189c26719cdsm11083506plh.272.2022.12.28.06.28.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Dec 2022 06:28:31 -0800 (PST) Date: Thu, 29 Dec 2022 01:28:25 +1100 To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [PATCH 2/2] libstdc++: Implement P1413R3 'deprecate aligned_storage and aligned_union' Message-ID: MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-10.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, KAM_SHORT, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, 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 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Nathaniel Shead via Gcc-patches From: Nathaniel Shead Reply-To: Nathaniel Shead Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1753468441480516458?= X-GMAIL-MSGID: =?utf-8?q?1753468441480516458?= These two patches implement P1413 (deprecate std::aligned_storage and std::aligned_union) for C++23. Tested on x86_64-linux. -- >8 -- Adds deprecated attributes for C++23, and makes use of it for std::aligned_storage, std::aligned_storage_t, std::aligned_union, and std::aligned_union_t. libstdc++-v3/ChangeLog: * doc/doxygen/user.cfg.in (PREDEFINED): Add new macros. * include/bits/c++config (_GLIBCXX23_DEPRECATED) (_GLIBCXX23_DEPRECATED_SUGGEST): New macros. * include/std/type_traits (aligned_storage, aligned_union) (aligned_storage_t, aligned_union_t): Deprecate for C++23. * testsuite/20_util/aligned_storage/deprecated-2b.cc: New test. * testsuite/20_util/aligned_union/deprecated-2b.cc: New test. Signed-off-by: Nathaniel Shead --- libstdc++-v3/doc/doxygen/user.cfg.in | 2 ++ libstdc++-v3/include/bits/c++config | 10 +++++++ libstdc++-v3/include/std/type_traits | 17 +++++++++--- .../20_util/aligned_storage/deprecated-2b.cc | 26 +++++++++++++++++++ .../20_util/aligned_union/deprecated-2b.cc | 26 +++++++++++++++++++ 5 files changed, 77 insertions(+), 4 deletions(-) create mode 100644 libstdc++-v3/testsuite/20_util/aligned_storage/deprecated-2b.cc create mode 100644 libstdc++-v3/testsuite/20_util/aligned_union/deprecated-2b.cc diff --git a/libstdc++-v3/doc/doxygen/user.cfg.in b/libstdc++-v3/doc/doxygen/user.cfg.in index fc46e722529..31613f51517 100644 --- a/libstdc++-v3/doc/doxygen/user.cfg.in +++ b/libstdc++-v3/doc/doxygen/user.cfg.in @@ -2396,6 +2396,8 @@ PREDEFINED = __cplusplus=202002L \ "_GLIBCXX17_DEPRECATED_SUGGEST(E)= " \ "_GLIBCXX20_DEPRECATED= " \ "_GLIBCXX20_DEPRECATED_SUGGEST(E)= " \ + "_GLIBCXX23_DEPRECATED= " \ + "_GLIBCXX23_DEPRECATED_SUGGEST(E)= " \ _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 d2b0cfa15ce..7cec5d3de2d 100644 --- a/libstdc++-v3/include/bits/c++config +++ b/libstdc++-v3/include/bits/c++config @@ -86,6 +86,8 @@ // _GLIBCXX17_DEPRECATED_SUGGEST( string-literal ) // _GLIBCXX20_DEPRECATED // _GLIBCXX20_DEPRECATED_SUGGEST( string-literal ) +// _GLIBCXX23_DEPRECATED +// _GLIBCXX23_DEPRECATED_SUGGEST( string-literal ) #ifndef _GLIBCXX_USE_DEPRECATED # define _GLIBCXX_USE_DEPRECATED 1 #endif @@ -131,6 +133,14 @@ # define _GLIBCXX20_DEPRECATED_SUGGEST(ALT) #endif +#if defined(__DEPRECATED) && (__cplusplus >= 202100L) +# define _GLIBCXX23_DEPRECATED [[__deprecated__]] +# define _GLIBCXX23_DEPRECATED_SUGGEST(ALT) _GLIBCXX_DEPRECATED_SUGGEST(ALT) +#else +# define _GLIBCXX23_DEPRECATED +# define _GLIBCXX23_DEPRECATED_SUGGEST(ALT) +#endif + // Macros for ABI tag attributes. #ifndef _GLIBCXX_ABI_TAG_CXX11 # define _GLIBCXX_ABI_TAG_CXX11 __attribute ((__abi_tag__ ("cxx11"))) diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits index 2f4d4bb8d4d..9df833e82be 100644 --- a/libstdc++-v3/include/std/type_traits +++ b/libstdc++-v3/include/std/type_traits @@ -2088,10 +2088,15 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION * type shall be a POD type suitable for use as uninitialized * storage for any object whose size is at most _Len and whose * alignment is a divisor of _Align. + * + * @deprecated Deprecated in C++23. Uses can be replaced by an + * array std::byte[_Len] declared with alignas(_Align). */ template::__type)> - struct aligned_storage + struct + _GLIBCXX23_DEPRECATED + aligned_storage { union type { @@ -2127,9 +2132,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION * least size _Len. * * @see aligned_storage + * + * @deprecated Deprecated in C++23. */ template - struct aligned_union + struct + _GLIBCXX23_DEPRECATED + aligned_union { private: static_assert(sizeof...(_Types) != 0, "At least one type is required"); @@ -2580,10 +2589,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION /// Alias template for aligned_storage template::__type)> - using aligned_storage_t = typename aligned_storage<_Len, _Align>::type; + using aligned_storage_t _GLIBCXX23_DEPRECATED = typename aligned_storage<_Len, _Align>::type; template - using aligned_union_t = typename aligned_union<_Len, _Types...>::type; + using aligned_union_t _GLIBCXX23_DEPRECATED = typename aligned_union<_Len, _Types...>::type; /// Alias template for decay template diff --git a/libstdc++-v3/testsuite/20_util/aligned_storage/deprecated-2b.cc b/libstdc++-v3/testsuite/20_util/aligned_storage/deprecated-2b.cc new file mode 100644 index 00000000000..a0e338a5843 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/aligned_storage/deprecated-2b.cc @@ -0,0 +1,26 @@ +// Copyright (C) 2022 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// { dg-options "-std=gnu++23" } +// { dg-do compile { target c++23 } } + +#include + +std::aligned_storage<1, 1>::type x; // { dg-warning "is deprecated" } +std::aligned_storage_t<1, 1> y; // { dg-warning "is deprecated" } + +// { dg-prune-output "declared here" } diff --git a/libstdc++-v3/testsuite/20_util/aligned_union/deprecated-2b.cc b/libstdc++-v3/testsuite/20_util/aligned_union/deprecated-2b.cc new file mode 100644 index 00000000000..fa00a923856 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/aligned_union/deprecated-2b.cc @@ -0,0 +1,26 @@ +// Copyright (C) 2022 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// { dg-options "-std=gnu++23" } +// { dg-do compile { target c++23 } } + +#include + +std::aligned_union<4, int>::type x; // { dg-warning "is deprecated" } +std::aligned_union_t<4, int> y; // { dg-warning "is deprecated" } + +// { dg-prune-output "declared here" }