On Nov 2, 2005, Stephan Bergmann wrote:
Hi all,

<http://www.openoffice.org/issues/show_bug.cgi?id=56995> shows the following problem: On compilers later than the GCC 3.4.1 we use at Hamburg (e.g., GCC 4.0.2, but from looking at the documentation also GCC 3.4.4), -Wall implies a new -Wnon-virtual-dtor which warns about classes with virtual functions that do not have a virtual destructor.

On such compilers, this warning will occur for each idlc-generated UNO header (com/sun/star/uno/XInterface.hpp etc.). For reasons of compatibility, it is not an option to change those idlc-generated headers and add a virtual destructor to them.

Thus, we can either switch off -Wnon-virtual-dtor globally, or switch off *all* warnings from within idlc-generated headers (#pragma GCC system_header). The second option is probably preferable, as -Wnon-virtual-dtor might point to real issues in other places of the code base, and it is unlikely that there would be other warnings from any idlc-generated header that we would thus suppress---the idlc-generated headers are pretty boiler-plate.

Opinions?

-Stephan

The consensus back then was to keep -Wnon-virtual-dtor switched on globally, and only switch it off (together with all other warnings) within cppumaker-generated headers, on the grounds that -Wnon-virtual-dtor was considered a useful tool to find errors.

However, trying to compile cppuhelper/qa/propertysetmixin/comp_propertysetmixin.cxx, I fear we have to rethink the case: cppu::PropertySetMixin is part of the stable API of OOo/URE, is a class template, and contains a non-virtual dtor and virtual functions. Since it is part of the stable API, we cannot change its dtor to be virtual (and even if we could, one could argue that that would not be what one would want to do, but consider it a hack to work around the warning). And since it is a template, we cannot disable the warning locally---the warning is emitted at the end of each compilation unit that includes cppuhelper/propertysetmixin.hxx, rather than from within cppuhelper/propertysetmixin.hxx itself.

The only solution I see is to bite the bullet and globally disable -Wnon-virtual-dtor.

Opinions?

-Stephan

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to