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: 61021 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7E0D5385457E for ; Wed, 23 Nov 2022 10:11:11 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7E0D5385457E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1669198271; 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=WGHkIdpu7XDMNfO8pR8j/0qIpsYMrgFLnH55YT/eH5DJSpeBK8ndztXGappRXbIuX 5NCFnWT8f6t9c9uQjm9VSxV5lHqIde/OK6ezIkrYm4jDj7hdSCRq4YWsD3/3FO4qTc woPwQCSr8DrBIlk+Spy9FMO/w+sFAXQpf1Tic4lo= 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+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" 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