This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PATCH: fix PR 15214
- From: Jason Merrill <jason at redhat dot com>
- To: Tom Marshall <tmarshall at real dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Thu, 20 May 2004 17:54:28 -0400
- Subject: Re: PATCH: fix PR 15214
- References: <20040511171434.GA10950@real.com>
On Tue, 11 May 2004 10:14:34 -0700, Tom Marshall <tmarshall@real.com> wrote:
> The author assigns the copyright for the following patch to the FSF, with
> employer approval. This is against GCC 3.4.0 release.
Do you have an assignment on file with the FSF? I think this patch is
small enough not to need one, but you might want to have one in place if
you'll be working on the compiler.
The patch is ok, but you need a ChangeLog entry. Also,
> --- gcc/cp/class.c.orig 2004-03-08 23:27:23.000000000 -0800
> +++ gcc/cp/class.c 2004-05-06 09:30:14.000000000 -0700
> @@ -5102,7 +5102,17 @@
>
> if (warn_nonvdtor && TYPE_POLYMORPHIC_P (t) && TYPE_HAS_DESTRUCTOR (t)
> && DECL_VINDEX (TREE_VEC_ELT (CLASSTYPE_METHOD_VEC (t), 1)) == NULL_TREE)
> - warning ("`%#T' has virtual functions but non-virtual destructor", t);
> + {
> + tree dtor = TREE_VEC_ELT (CLASSTYPE_METHOD_VEC (t), 1);
> +
> + /* Warn only if the dtor is non-private or the class has friends */
> + if (!TREE_PRIVATE (dtor) ||
> + (CLASSTYPE_FRIEND_CLASSES (t) ||
> + DECL_FRIENDLIST (TYPE_MAIN_DECL (t))))
> + {
> + warning ("%#T' has virtual functions but non-virtual destructor", t);
> + }
We don't use braces when there's only a single statement under an if.
Jason