public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] doc: -Wdelete-non-virtual-dtor supersedes -Wnon-virtual-dtor
@ 2022-11-23 10:10 Jonathan Wakely
  2022-11-23 15:33 ` Jason Merrill
  0 siblings, 1 reply; 2+ messages in thread
From: Jonathan Wakely @ 2022-11-23 10:10 UTC (permalink / raw)
  To: gcc-patches; +Cc: Jason Merrill

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
-- 
2.38.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] doc: -Wdelete-non-virtual-dtor supersedes -Wnon-virtual-dtor
  2022-11-23 10:10 [PATCH] doc: -Wdelete-non-virtual-dtor supersedes -Wnon-virtual-dtor Jonathan Wakely
@ 2022-11-23 15:33 ` Jason Merrill
  0 siblings, 0 replies; 2+ messages in thread
From: Jason Merrill @ 2022-11-23 15:33 UTC (permalink / raw)
  To: Jonathan Wakely, gcc-patches

On 11/23/22 05:10, Jonathan Wakely wrote:
> 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?

OK.

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-11-23 15:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-23 10:10 [PATCH] doc: -Wdelete-non-virtual-dtor supersedes -Wnon-virtual-dtor Jonathan Wakely
2022-11-23 15:33 ` Jason Merrill

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).