public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Jonathan Wakely <redi@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r13-4266] doc: -Wdelete-non-virtual-dtor supersedes -Wnon-virtual-dtor
Date: Wed, 23 Nov 2022 15:45:59 +0000 (GMT)	[thread overview]
Message-ID: <20221123154559.44E843852C6D@sourceware.org> (raw)

https://gcc.gnu.org/g:51f28e3aaf8b50554e7d356c8117399e63132323

commit r13-4266-g51f28e3aaf8b50554e7d356c8117399e63132323
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Wed Nov 23 10:01:06 2022 +0000

    doc: -Wdelete-non-virtual-dtor supersedes -Wnon-virtual-dtor
    
    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.

Diff:
---
 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

                 reply	other threads:[~2022-11-23 15:45 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221123154559.44E843852C6D@sourceware.org \
    --to=redi@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).