From f03e8526def1a820f811a649bc245dde18f18c02 Mon Sep 17 00:00:00 2001 From: Mark Mitchell <mark@codesourcery.com> Date: Mon, 7 Mar 2005 23:08:58 +0000 Subject: [PATCH] class.c (finish_struct_1): Do not warn about non-virtual destructors in Java classes. * class.c (finish_struct_1): Do not warn about non-virtual destructors in Java classes. * g++.dg/warn/Wnvdtor.C: New test. From-SVN: r96054 --- gcc/cp/ChangeLog | 5 +++++ gcc/cp/class.c | 4 +++- gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/g++.dg/warn/Wnvdtor.C | 10 ++++++++++ 4 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/warn/Wnvdtor.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 4c40681333fa..3048511f23b0 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2005-03-07 Mark Mitchell <mark@codesourcery.com> + + * class.c (finish_struct_1): Do not warn about non-virtual + destructors in Java classes. + 2005-03-05 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net> PR c++/19311 diff --git a/gcc/cp/class.c b/gcc/cp/class.c index ba89ea146ed4..89346d6cf4ae 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -5029,7 +5029,9 @@ finish_struct_1 (tree t) /* Build the VTT for T. */ build_vtt (t); - if (warn_nonvdtor && TYPE_POLYMORPHIC_P (t)) + /* This warning does not make sense for Java classes, since they + cannot have destructors. */ + if (!TYPE_FOR_JAVA (t) && warn_nonvdtor && TYPE_POLYMORPHIC_P (t)) { tree dtor; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 3b330421f4bf..452046fa557c 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2005-03-07 Mark Mitchell <mark@codesourcery.com> + + * g++.dg/warn/Wnvdtor.C: New test. + 2005-03-07 Richard Sandiford <rsandifo@redhat.com> * gcc.dg/torture/pr19683-1.c: New test. diff --git a/gcc/testsuite/g++.dg/warn/Wnvdtor.C b/gcc/testsuite/g++.dg/warn/Wnvdtor.C new file mode 100644 index 000000000000..b04fdcbe6b1f --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/Wnvdtor.C @@ -0,0 +1,10 @@ +// { dg-options "-Wnon-virtual-dtor" } + +extern "Java" +{ + class Foo + { + public: + virtual void bar( void); + }; +} -- GitLab