From patchwork Wed Nov 23 10:10:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 24846 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2699603wrr; Wed, 23 Nov 2022 02:11:27 -0800 (PST) X-Google-Smtp-Source: AA0mqf78KNFmfAXCZIruG/JNG8xU7ggA7ysJbgah7ZJEoggeyiwX2TbXy0cvMQfGv9VEeSDLzfvs X-Received: by 2002:a05:6402:1f08:b0:461:d21a:c0f3 with SMTP id b8-20020a0564021f0800b00461d21ac0f3mr2692253edb.71.1669198287212; Wed, 23 Nov 2022 02:11:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669198287; cv=none; d=google.com; s=arc-20160816; b=qokWtmDx8L3jcgMj9gVZORAh0RtGSCnpGX+iC3d2rqINWIj9ChoCTzeDEwnSnBhXR5 +qH9WOyjWV9IwS022qMK856VosEIWjlG72e6OxyHTb/rMM5KYKrXPeCIouEHt7knPoP4 j1oCgKDHiWpizdYcMDyiqBcfkVhW/L5xfd78v5xGU2szitdMsZPvdoyIfS0CyKyBiEzd 712AeZTgvv324fKNrgxvFc0aJRaQreQWl8sP1qt8qSJrmTobOXu+ZbPviIuPC2g0IcwC /4XdmTVemji+uLC+g5VrPJFpK3UnF9GMID9qvUvf80iczd4hhl92zCcZodTyQBQKdkK5 FuXg== 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-transfer-encoding:mime-version:message-id:date:subject:cc :to:dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=o3lBG3Kjqxg/ri7+HxhO+4hKxx6K1T+D7aRIaZDwEZM=; b=T2lyD1zaTvboDsyF639MRIeWfjMluxY1U1WvAzjysmEnp7qwHrGSUA74dOCNJa0khj nbrXIB2gVyWbzU3XpzVPUW9qNcOoWtc8VlbovDUx8/3aQVxjt/zNYBgAl+tSG4o34X+G I3CNFeITDUg25ZM6UELjhd3DahwIQ0M2VhvK/4N3iMBAaUcvJh2Kj56WlMAgKpyp8Sa0 DkRiDVOhmPZjOplkBMfFXXZjomSQxEL+q2mo29/UvWUxSy6PPtSTKCTMAMVD/lBZEDrl BHv7iRYSmNnbn3YSHLerbNyrF+Kb9+0XPMQjAC0m2WT7qNo+4ODE3odeZFqalYh5KuRY frjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=Wj0X76Mu; 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 (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id e22-20020a17090658d600b007b2a6aaff06si16634392ejs.50.2022.11.23.02.11.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Nov 2022 02:11:27 -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=Wj0X76Mu; 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 2592F3853D59 for ; Wed, 23 Nov 2022 10:11:26 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2592F3853D59 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1669198286; bh=o3lBG3Kjqxg/ri7+HxhO+4hKxx6K1T+D7aRIaZDwEZM=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=Wj0X76MuRlQPBmg2RK22uaSzv+kDG1OJvsqsrfQCA0dNuAhJqY0Yax56pJ21oYJyS KdDM/kjFiRgiB18HrQueFZJWO/NrgF0ha3VETXwvTAu8zyC53DgS6pPTh14xDdksfP om36qC/DqH6E2w2gk6FN9pU1R9ar2aV6DADHCrTA= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org 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 5F69C3853D64 for ; Wed, 23 Nov 2022 10:10:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 5F69C3853D64 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-48--HKlij_SPey17I89olPE4w-1; Wed, 23 Nov 2022 05:10:41 -0500 X-MC-Unique: -HKlij_SPey17I89olPE4w-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 5EF81801585 for ; Wed, 23 Nov 2022 10:10:41 +0000 (UTC) Received: from localhost (unknown [10.33.36.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id 277D84B3FC6; Wed, 23 Nov 2022 10:10:41 +0000 (UTC) To: gcc-patches@gcc.gnu.org Cc: Jason Merrill Subject: [PATCH] doc: -Wdelete-non-virtual-dtor supersedes -Wnon-virtual-dtor Date: Wed, 23 Nov 2022 10:10:38 +0000 Message-Id: <20221123101038.2192550-1-jwakely@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-11.8 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 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: Jonathan Wakely via Gcc-patches From: Jonathan Wakely Reply-To: Jonathan Wakely 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?1750281263362407455?= X-GMAIL-MSGID: =?utf-8?q?1750281263362407455?= The existence of this option makes users think they need it (even though it's in neither -Wall nor -Wextra). Document that there's a better option (since 2011). OK for trunk? -- >8 -- The newer -Wdelete-non-virtual-dtor has no false positives and fewer bugs. There is very little reason to use -Wnon-virtual-dtor instead. gcc/ChangeLog: * doc/invoke.texi (C++ Dialect Options): Recommend using -Wdelete-non-virtual-dtor instead of -Wnon-virtual-dtor. --- gcc/doc/invoke.texi | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 330da6eb5d4..4899bd1ea4c 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -3986,6 +3986,9 @@ destructor itself or in an accessible polymorphic base class, in which case it is possible but unsafe to delete an instance of a derived class through a pointer to the class itself or base class. This warning is automatically enabled if @option{-Weffc++} is specified. +The @option{-Wdelete-non-virtual-dtor} option (enabled by @option{-Wall}) +should be preferred because it warns about the unsafe cases without false +positives. @item -Wregister @r{(C++ and Objective-C++ only)} @opindex Wregister