diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2012-03-14 13:27:56 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2012-03-14 13:32:02 +0100 |
commit | 6e67c03dc0225fc66343546b14e902b9d238b1a3 (patch) | |
tree | 6e078783d65e280a721b4e46f0ae0ca6b950f121 /solenv | |
parent | fe4be5047988782f3143a1af505c5eecb3f2af5a (diff) |
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.
Diffstat (limited to 'solenv')
-rw-r--r-- | solenv/gbuild/UnoApiTarget.mk | 2 | ||||
-rw-r--r-- | solenv/gbuild/platform/unxgcc.mk | 21 | ||||
-rw-r--r-- | solenv/inc/unxgcc.mk | 14 |
3 files changed, 27 insertions, 10 deletions
diff --git a/solenv/gbuild/UnoApiTarget.mk b/solenv/gbuild/UnoApiTarget.mk index af79bee2c3eb..8d851ef2d5ac 100644 --- a/solenv/gbuild/UnoApiTarget.mk +++ b/solenv/gbuild/UnoApiTarget.mk @@ -270,7 +270,7 @@ endif # - get idlc switch "-P" (generate .urd into package dir) # - empty $? in headertarget? -$(call gb_UnoApiTarget_get_target,%): +$(call gb_UnoApiTarget_get_target,%): $(gb_UnoApiTarget_CPPUMAKERTARGET) $(call gb_Output_announce,$*,$(true),RDB,3) $(if $(gb_UnoApiTarget_IDLFILES_$*),$(call gb_UnoApiTarget__command,$@,$*,$<,UCR,$(addprefix $(call gb_UnoApiPartTarget_get_target,),$(patsubst %.idl,%.urd,$(gb_UnoApiTarget_IDLFILES_$*))))) $(if $(UNOAPI_MERGE),$(call gb_UnoApiTarget__command,$@,$*,$<,/,$(UNOAPI_MERGE))) diff --git a/solenv/gbuild/platform/unxgcc.mk b/solenv/gbuild/platform/unxgcc.mk index 43f58a7cf0b4..1565d1c765e9 100644 --- a/solenv/gbuild/platform/unxgcc.mk +++ b/solenv/gbuild/platform/unxgcc.mk @@ -32,6 +32,9 @@ gb_Executable_EXT:= include $(GBUILDDIR)/platform/com_GCC_defs.mk +gb_CCVER := $(shell $(gb_CC) -dumpversion | $(gb_AWK) -F. -- '{ print $$1*10000+$$2*100+$$3 }') +gb_GccLess460 := $(shell expr $(gb_CCVER) \< 40600) + gb_MKTEMP := mktemp -t gbuild.XXXXXX ifneq ($(origin AR),default) @@ -55,16 +58,23 @@ gb_CFLAGS := \ -Wdeclaration-after-statement \ -Wshadow \ -# For -Wno-non-virtual-dtor see <http://markmail.org/message/664jsoqe6n6smy3b> -# "Re: [dev] warnings01: -Wnon-virtual-dtor" message to dev@openoffice.org from -# Feb 1, 2006: gb_CXXFLAGS := \ $(gb_CXXFLAGS_COMMON) \ -fPIC \ -Wshadow \ -Wsign-promo \ -Woverloaded-virtual \ - -Wno-non-virtual-dtor \ + +# Only GCC 4.6 has a fix for <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=7302> +# "-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: +ifeq ($(gb_GccLess460),1) +gb_CXXFLAGS += -Wno-non-virtual-dtor +else +gb_CXXFLAGS += -Wnon-virtual-dtor +endif ifeq ($(HAVE_GCC_VISIBILITY_FEATURE),TRUE) gb_COMPILERDEFS += \ @@ -97,9 +107,6 @@ gb_COMPILERDEFS += \ endif -gb_CCVER := $(shell $(gb_CC) -dumpversion | $(gb_AWK) -F. -- '{ print $$1*10000+$$2*100+$$3 }') -gb_GccLess460 := $(shell expr $(gb_CCVER) \< 40600) - #At least SLED 10.2 gcc 4.3 overly agressively optimizes uno::Sequence into #junk, so only strict-alias on >= 4.6.0 gb_StrictAliasingUnsafe := $(gb_GccLess460) 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 <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=7302> +# "-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 |