From 6e67c03dc0225fc66343546b14e902b9d238b1a3 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Wed, 14 Mar 2012 13:27:56 +0100 Subject: Enable -Wnon-virtual-dtor for GCC 4.6 ...which has the necessary features to support it. Change a lot of classes to either contain a protected non-virtual dtor (which is backwards compatible, so even works for cppumaker-generated UNO headers) or a public virtual one. cppuhelper/propertysetmixin.hxx still needs to disable the warning, as the relevant class has a non-virtual dtor but friends, which would still cause GCC to warn. Includes a patch for libcmis, intended to be upstreamed. --- solenv/inc/unxgcc.mk | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'solenv/inc') diff --git a/solenv/inc/unxgcc.mk b/solenv/inc/unxgcc.mk index 8bfeebc20cf6..5ef9f9871569 100644 --- a/solenv/inc/unxgcc.mk +++ b/solenv/inc/unxgcc.mk @@ -143,12 +143,22 @@ CFLAGSOUTOBJ=-o # -Wshadow does not work for C with nested uses of pthread_cleanup_push: CFLAGSWARNBOTH=-Wall -Wextra -Wendif-labels CFLAGSWARNCC=$(CFLAGSWARNBOTH) -Wdeclaration-after-statement -CFLAGSWARNCXX=$(CFLAGSWARNBOTH) -Wshadow -Wno-ctor-dtor-privacy \ - -Wno-non-virtual-dtor +CFLAGSWARNCXX=$(CFLAGSWARNBOTH) -Wshadow -Wno-ctor-dtor-privacy CFLAGSWALLCC=$(CFLAGSWARNCC) CFLAGSWALLCXX=$(CFLAGSWARNCXX) CFLAGSWERRCC=-Werror -DLIBO_WERROR +# Only GCC 4.6 has a fix for +# "-Wnon-virtual-dtor should't complain of protected dtor" and supports #pragma +# GCC diagnostic push/pop required e.g. in cppuhelper/propertysetmixin.hxx to +# silence warnings about a protected, non-virtual dtor in a class with virtual +# members and friends: +.IF "$(GCCNUMVER)" <= "000400059999" +CFLAGSWARNCXX += -Wno-non-virtual-dtor +.ELSE +CFLAGSWARNCXX += -Wnon-virtual-dtor +.END + COMPILER_WARN_ERRORS=TRUE # switches for dynamic and static linking -- cgit