-Wno-non-virtual-dtor

Stephan Bergmann sbergman at redhat.com
Tue Mar 13 06:24:52 PDT 2012


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.

[1] There might be a way around that after all, adding a non-virtual, 
protected destructor to the C++ classes representing UNO interfaces. 
Will look into that.

[2] <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=7302> 
"-Wnon-virtual-dtor should't complain of protected dtor" apparently 
solves the problem for cppuhelper/propertysetmixin.hxx that originally 
caused problems.  Seems to be available at least in the Fedora-16 GCC 
4.6.2.  (And -Wall appears to no longer automatically enable 
-Wnon-virtual-dtor.)  Maybe all this allows us to re-enable 
-Wnon-virtual-dtor after all; will look into that.

Stephan


More information about the LibreOffice mailing list