Issue 56995 - Compiling C++ UNO component with gcc4 produces lots of "has virtual functions but non-virtual destructor" warnings.
Summary: Compiling C++ UNO component with gcc4 produces lots of "has virtual functions...
Status: CLOSED FIXED
Alias: None
Product: udk
Classification: Code
Component: code (show other issues)
Version: OOo 2.0
Hardware: All All
: P3 Trivial (vote)
Target Milestone: OOo 2.0.4
Assignee: Stephan Bergmann
QA Contact: issues@udk
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-10-30 21:09 UTC by kyoshida
Modified: 2006-06-29 13:15 UTC (History)
2 users (show)

See Also:
Issue Type: ENHANCEMENT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description kyoshida 2005-10-30 21:09:12 UTC
When compiling a C++ UNO Component with gcc4, it will generate a lot of "has
virtual functions but non-virtual destructor" warnings.  This makes it very hard
to see more important warnings, and should be fixed.

The reason for this warning is those *.hdl files automatically generated by
cppumaker contain classes with virtual methods but no virtual destructor (like
the warning says ;-) ).  This is not a recommended practice because, when an
object of a derived class gets deleted through its base class pointer, the base
class destructor gets called to delete that object, and the base class
destructor releases memory for the wrong object size (size of the base class,
not of the derived class).

Fixing this issue will ease the pain of C++ UNO component developers.

Thanks,
Kohei
Comment 1 kay.ramme 2005-11-02 16:12:56 UTC
Stephan, I hope you take care of this anyway ... ;-)
Comment 2 Stephan Bergmann 2005-11-03 09:21:02 UTC
As discussed on dev@openoffice.org, will be fixed by adding #pragma GCC
system_header to the relevant files generated by cppumaker.
Comment 3 Stephan Bergmann 2006-04-07 08:32:50 UTC
.
Comment 4 Stephan Bergmann 2006-06-19 16:37:14 UTC
The solution of "adding #pragma GCC system_header to the relevant files
generated by cppumaker" has since been reverted as described in
<http://www.openoffice.org/servlets/ReadMsg?list=dev&msgNo=16009> by instead
globally setting -Wno-non-virtual-dtor in the (unxlngi6, at least) OOo build
environment.  This means that when "compiling a C++ UNO Component with gcc4"
within the OOo build environment, this issue is fixed now, but not yet when
compiling within the SDK build environment, see issue 61508.
Comment 5 Stephan Bergmann 2006-06-29 13:15:53 UTC
.