Lubos Lunak l.lunak at suse.cz
Tue Mar 13 07:00:55 PDT 2012

On Tuesday 13 of March 2012, Stephan Bergmann wrote:
> On 03/13/2012 11:43 AM, Tor Lillqvist wrote:
> > Hmm, now that the reason for using  -Wno-non-virtual-dtor has been
> > documented (760e0d2d7329ca6fc00a8439715bae38becb168a ), I wonder,
> > should we globally then also turn off the corresponding MSVC warning?
> >
> > That would be kinda predictable (from a "the usual waste of time"
> > point of view), as I and others have committed over times dozens of
> > WaE fixes for this very issue... (I.e. added a virtual no-op
> > destructor in most cases).
> >
> > Or does gcc and MSVC warn for different cases of lack of virtual
> > destructor? Is it certain that in all cases this warning is bogus, in
> > both the gcc and MSVC cases?
> I think the warning is generally non-bogus.  The problem is that we were
> not able to change the cppumaker-generated C++ headers without breaking
> backwards compatiblity[1], and GCC was somewhat over-ambitious with this
> warning[2], so had to disable it -- even if we would have preferred to
> keep it on.

 The original message about the problem, 
http://markmail.org/message/664jsoqe6n6smy3b , mentions that it is not 
possible to selectively disable the warning for just the classes where we 
need to keep the binary compatibility.

 Assuming that my attached testcase correctly matches the problem, I do not 
see a warning with either gcc-4.6.3 or clang-3.1r152540. So it looks like we 
can either just enable the warning and selectively disable it, or we can have 
a configure check if some older gcc version has the problem (well, given that 
#pragma diagnostic is recent with gcc, it'll need an #ifdef anyway).

$ g++ -Wall dtor.cpp -Wnon-virtual-dtor -c

 Lubos Lunak
 l.lunak at suse.cz
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dtor.cpp
Type: text/x-c++src
Size: 98 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20120313/f251d65e/attachment-0001.cpp>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dtor.h
Type: text/x-c++hdr
Size: 315 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20120313/f251d65e/attachment-0001.hpp>

More information about the LibreOffice mailing list