From patchwork Wed Dec 4 01:30:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: JeanHeyd Meneide X-Patchwork-Id: 1203944 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-515106-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="ZyQf4ewK"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="WJQ/aqrO"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 47SLsQ4QnFz9sPL for ; Wed, 4 Dec 2019 12:31:04 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:from:date:message-id:subject:to:content-type; q= dns; s=default; b=sKDUjVMJ2WInOPwMjhcnJrb4Fl0dzhjPbk3ox+pgaKiCeM pYQVa19UGUyb2AiZ7C/N5B5WUvmCJJ76bVWfjRvVeF3mWAiMTbwXPQn3X3UHuoKC t7bKpPaGxtzRRnTUGCnjgOGWO8y2OWAx6aattr1nvI2ZyGJxV7JVOk1BO5rqY= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:from:date:message-id:subject:to:content-type; s= default; bh=bXDIdOI9F8PJJpz8wGgY/SX14z4=; b=ZyQf4ewKimpQ8gaAVqW/ jxbHshMnD7cizOvoDSY9ZA1DxFMwjoCH/3jV2hDFPLkzlkrtQTp9j27JM78MqfAP 4+i9wfu9IQMre5rUfcl4PqVdwTR/GcK5noCMeaEg/EhG3UnoWShM/zX6OOGgPAx9 Oc3xyFpktoMMQn5dc5vKkbY= Received: (qmail 46066 invoked by alias); 4 Dec 2019 01:30:50 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 45636 invoked by uid 89); 4 Dec 2019 01:30:48 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-24.3 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=pod, POD, insane X-HELO: mail-ua1-f46.google.com Received: from mail-ua1-f46.google.com (HELO mail-ua1-f46.google.com) (209.85.222.46) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 04 Dec 2019 01:30:44 +0000 Received: by mail-ua1-f46.google.com with SMTP id o42so2153947uad.10; Tue, 03 Dec 2019 17:30:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=AuAvMiGml8/6Ww4Xximc71idU2IciLQ8keOd88Tz0+g=; b=WJQ/aqrOycCC7cut1Kf0AlW48Nf7oWhgtdGHSb8dI8cCMmBvBInxerk+dFLnDVGZ9f dwtksUGGw3DFM60at09p1z5ePhhi1ITuhTqwzCGhaHvNuBUtTCcrTbejsunSmvxTZDpD KYuNY4PeVAcr7Kwwo06CBYAugRy913tCDoDxHzrixYSx8xMbXykJ/FmktZgZISwRFga5 +Hbo2ym2NGhTPUvktkEB1bhEpuXeQAfeRP78vMRMhZEt8upFK05f6Lb9lm5AnzsrAfUA WxBlYeJ0It8c5v0YGrW4WkLzAiZMm7DTeFHtTMVhtWdfjzmMpUsFJrAWBCqHmqfSPCrG QCYQ== MIME-Version: 1.0 From: JeanHeyd Meneide Date: Tue, 3 Dec 2019 20:30:31 -0500 Message-ID: Subject: [ PATCH ] [ C++ ] Implementing P0767 - deprecate POD To: "libstdc++" , gcc-patches@gcc.gnu.org X-IsSubscribed: yes This patch implements deprecate POD for the C++ Standard Library, bringing libstdc++ that much closer to 2020 conformance 🎉! Hilariously, a small bug in the [[deprecated]] warning message was found while implementing this patch, which drove me a bit insane for a good 10 minutes until I realized what was going on: https://godbolt.org/z/WwBNUx Either way, here you go! Someone will probably have to fix the template-class [[deprecated("foo")]] bug at some point too. 2019-12-03 JeanHeyd "ThePhD" Meneide * include/bits/c++config: Add new _GLIBCXX20_DEPRECATED macro. * include/std/type_traits: Deprecate is_pod with message. * testuite/20_util/is_pod/deprecated-2a.cc (new): test deprecation diff --git a/libstdc++-v3/include/bits/c++config b/libstdc++-v3/include/bits/c++config index 7ccfc5f199d..5876b0b977b 100644 --- a/libstdc++-v3/include/bits/c++config +++ b/libstdc++-v3/include/bits/c++config @@ -78,6 +78,7 @@ // _GLIBCXX_USE_DEPRECATED // _GLIBCXX_DEPRECATED // _GLIBCXX17_DEPRECATED +// _GLIBCXX20_DEPRECATED( STRINGS... ) #ifndef _GLIBCXX_USE_DEPRECATED # define _GLIBCXX_USE_DEPRECATED 1 #endif @@ -94,6 +95,12 @@ # define _GLIBCXX17_DEPRECATED #endif +#if defined(__DEPRECATED) && (__cplusplus > 201703L) +# define _GLIBCXX20_DEPRECATED(...) [[deprecated(__VA_ARGS__)]] +#else +# define _GLIBCXX20_DEPRECATED(...) +#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 8e787a994c3..91269d1bd02 100644 --- a/libstdc++-v3/include/std/type_traits +++ b/libstdc++-v3/include/std/type_traits @@ -685,10 +685,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION "template argument must be a complete class or an unbounded array"); }; - /// is_pod + /// is_pod (deprecated C++2a) // Could use is_standard_layout && is_trivial instead of the builtin. template - struct is_pod + struct + _GLIBCXX20_DEPRECATED("is_pod is deprecated in C++20: use is_standard_layout && is_trivial instead") + is_pod : public integral_constant { static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}), @@ -3073,6 +3075,7 @@ template template inline constexpr bool is_standard_layout_v = is_standard_layout<_Tp>::value; template + _GLIBCXX20_DEPRECATED("is_pod is deprecated in C++20: use is_standard_layout && is_trivial instead") inline constexpr bool is_pod_v = is_pod<_Tp>::value; template inline constexpr bool is_literal_type_v = is_literal_type<_Tp>::value; diff --git a/libstdc++-v3/testsuite/20_util/is_pod/deprecated-2a.cc b/libstdc++-v3/testsuite/20_util/is_pod/deprecated-2a.cc new file mode 100644 index 00000000000..9782c3f551d --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/is_pod/deprecated-2a.cc @@ -0,0 +1,25 @@ +// Copyright (C) 2010-2019 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-do compile { target c++2a } } + +// { dg-prune-output "declared here" } + +#include + +static_assert(std::is_pod::value); // { dg-warning "is deprecated" } +static_assert(std::is_pod_v); // { dg-warning "is deprecated" }