[Libreoffice-commits] core.git: 2 commits - bridges/Library_cpp_uno.mk oox/Library_oox.mk solenv/gbuild tools/CppunitTest_tools_test.mk
Luboš Luňák (via logerrit)
logerrit at kemper.freedesktop.org
Fri Oct 4 06:58:14 UTC 2019
bridges/Library_cpp_uno.mk | 19 ++++-------
oox/Library_oox.mk | 4 +-
solenv/gbuild/LinkTarget.mk | 44 ++++++++++++++++++--------
solenv/gbuild/extensions/post_GbuildToJson.mk | 4 +-
tools/CppunitTest_tools_test.mk | 4 +-
5 files changed, 46 insertions(+), 29 deletions(-)
New commits:
commit f87c4e1c2458177c75b12f8ff59d214afcc71c47
Author: Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Thu Oct 3 12:29:18 2019 +0200
Commit: Luboš Luňák <l.lunak at collabora.com>
CommitDate: Fri Oct 4 08:57:40 2019 +0200
do not abort build on PCH CXXFLAGS mismatch if set explicitly
All the various gb_CppunitTest_add_cxxobjects variants actually
allow passing additional CXXFLAGS. However, currently that would
abort the build if PCH is used, because PCH requires the same
CXXFLAGS. But if those extra CXXFLAGS are set explicitly, just
skip using the PCH for that one file, as the mismatch is intentional.
Change-Id: Iec4eed6d5f94c3e97ee461241203a84d21e8113c
Reviewed-on: https://gerrit.libreoffice.org/80120
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak at collabora.com>
diff --git a/solenv/gbuild/LinkTarget.mk b/solenv/gbuild/LinkTarget.mk
index 72c4de1dd206..2d9f35900d22 100644
--- a/solenv/gbuild/LinkTarget.mk
+++ b/solenv/gbuild/LinkTarget.mk
@@ -266,21 +266,24 @@ gb_CxxObject_get_source = $(1)/$(2).cxx
# should never be overridden on an object -- they should be the same as for the
# whole linktarget. In general it should be cleaner to use a static library
# compiled with different flags and link that in rather than mixing different
-# flags in one linktarget.
+# flags in one linktarget. If OBJECT_HAS_EXTRA_CXXFLAGS is set, the object
+# has explicitly set additional CXXFLAGS, so in that case avoid using the PCH.
define gb_CxxObject__set_pchflags
ifneq ($(gb_ENABLE_PCH),)
ifneq ($(strip $$(PCH_NAME)),)
-ifeq ($$(sort $$(PCH_CXXFLAGS) $$(PCH_DEFS) $$(gb_LinkTarget_EXCEPTIONFLAGS)),$$(sort $$(T_CXXFLAGS) $$(T_CXXFLAGS_APPEND) $$(DEFS)))
+ifeq ($(OBJECT_HAS_EXTRA_CXXFLAGS),)
+ifeq ($$(sort $$(PCH_CXXFLAGS) $$(PCH_DEFS)),$$(sort $$(T_CXXFLAGS) $$(T_CXXFLAGS_APPEND) $$(DEFS)))
$$@ : PCHFLAGS := $$(call gb_PrecompiledHeader_get_enableflags,$$(PCH_NAME),$$(PCH_LINKTARGETMAKEFILENAME))
else
$$(warning No precompiled header available for $$*.cxx .)
-$$(info precompiled header flags : $$(sort $$(PCH_CXXFLAGS) $$(PCH_DEFS) $$(gb_LinkTarget_EXCEPTIONFLAGS)))
+$$(info precompiled header flags : $$(sort $$(PCH_CXXFLAGS) $$(PCH_DEFS)))
$$(info . object flags : $$(sort $$(T_CXXFLAGS) $$(T_CXXFLAGS_APPEND) $$(DEFS)))
$$(error Incorrect precompiled header setup or internal gbuild error.)
$$@ : PCHFLAGS :=
endif
endif
endif
+endif
endef
ifneq ($(COMPILER_EXTERNAL_TOOL)$(COMPILER_PLUGIN_TOOL),)
@@ -762,6 +765,7 @@ $(call gb_LinkTarget_get_target,$(1)) : T_CFLAGS_APPEND :=
$(call gb_LinkTarget_get_target,$(1)) : T_CXXFLAGS := $$(gb_LinkTarget_CXXFLAGS)
$(call gb_LinkTarget_get_target,$(1)) : T_CXXFLAGS_APPEND :=
$(call gb_LinkTarget_get_target,$(1)) : PCH_CXXFLAGS := $$(gb_LinkTarget_CXXFLAGS)
+$(call gb_LinkTarget_get_target,$(1)) : OBJECT_HAS_EXTRA_CXXFLAGS :=
$(call gb_LinkTarget_get_target,$(1)) : T_OBJCXXFLAGS := $$(gb_LinkTarget_OBJCXXFLAGS)
$(call gb_LinkTarget_get_target,$(1)) : T_OBJCXXFLAGS_APPEND :=
$(call gb_LinkTarget_get_target,$(1)) : T_OBJCFLAGS := $$(gb_LinkTarget_OBJCFLAGS)
@@ -1114,15 +1118,20 @@ endif
endef
-# call gb_LinkTarget_add_cxxobject,linktarget,sourcefile,cxxflags,linktargetmakefilename
-define gb_LinkTarget_add_cxxobject
+# call gb_LinkTarget_add_cxxobject_internal,linktarget,sourcefile,cxxflags,linktargetmakefilename,exceptionflags
+# The purpose of the exceptionflags extra argument is to differentiate between usage that just needs
+# exception flags and usage that adds other flags. Using a PCH requires the same cxxflags as the ones used
+# to create the PCH, so non-empty cxxflags here mean the object cannot use the PCH, and the add_exception_cxxobject
+# variant passes the necessary flags by setting the extra argument.
+define gb_LinkTarget_add_cxxobject_internal
$(if $(wildcard $(call gb_CxxObject_get_source,$(SRCDIR),$(2))),,$(eval $(call gb_Output_error,No such source file $(call gb_CxxObject_get_source,$(SRCDIR),$(2)))))
$(call gb_LinkTarget_get_target,$(1)) : CXXOBJECTS += $(2)
$(call gb_LinkTarget_get_clean_target,$(1)) : CXXOBJECTS += $(2)
$(call gb_LinkTarget_get_target,$(1)) : $(call gb_CxxObject_get_target,$(2))
$(call gb_CxxObject_get_target,$(2)) : | $(call gb_LinkTarget_get_headers_target,$(1))
-$(call gb_CxxObject_get_target,$(2)) : T_CXXFLAGS += $(call gb_LinkTarget__get_cxxflags,$(4)) $(3)
+$(call gb_CxxObject_get_target,$(2)) : T_CXXFLAGS += $(call gb_LinkTarget__get_cxxflags,$(4)) $(3) $(5)
+$(call gb_CxxObject_get_target,$(2)) : OBJECT_HAS_EXTRA_CXXFLAGS := $(if $(strip $(3)),1)
$(call gb_CxxObject_get_target,$(2)) : \
OBJECTOWNER := $(call gb_Object__owner,$(2),$(1))
ifneq ($(gb_ENABLE_PCH),)
@@ -1138,6 +1147,11 @@ endif
endef
+# call gb_LinkTarget_add_cxxobject,linktarget,sourcefile,cxxflags,linktargetmakefilename
+define gb_LinkTarget_add_cxxobject
+$(call gb_LinkTarget_add_cxxobject_internal,$(1),$(2),$(3),$(4))
+endef
+
# call gb_LinkTarget_add_objcobject,linktarget,sourcefile,objcflags,linktargetmakefilename
define gb_LinkTarget_add_objcobject
$(if $(wildcard $(call gb_ObjCObject_get_source,$(SRCDIR),$(2))),,$(eval $(call gb_Output_error,No such source file $(call gb_ObjCObject_get_source,$(SRCDIR),$(2)))))
@@ -1246,8 +1260,8 @@ endif
endef
-# call gb_LinkTarget_add_generated_cxx_object,linktarget,sourcefile,cxxflags,linktargetmakefilename
-define gb_LinkTarget_add_generated_cxx_object
+# call gb_LinkTarget_add_generated_cxx_object_internal,linktarget,sourcefile,cxxflags,linktargetmakefilename,exceptionflags
+define gb_LinkTarget_add_generated_cxx_object_internal
$(call gb_LinkTarget_get_target,$(1)) : GENCXXOBJECTS += $(2)
$(call gb_LinkTarget_get_clean_target,$(1)) : GENCXXOBJECTS += $(2)
@@ -1258,7 +1272,8 @@ $(call gb_GenCxxObject_get_target,$(2)) : $(call gb_GenCxxObject_get_source,$(2)
$(call gb_GenCxxObject_get_source,$(2),$(1)) : | $(gb_Helper_MISCDUMMY)
$(call gb_GenCxxObject_get_target,$(2)) : | $(call gb_LinkTarget_get_headers_target,$(1))
$(call gb_GenCxxObject_get_target,$(2)) : WARNINGS_NOT_ERRORS := $(true)
-$(call gb_GenCxxObject_get_target,$(2)) : T_CXXFLAGS += $(call gb_LinkTarget__get_cxxflags,$(4)) $(3)
+$(call gb_GenCxxObject_get_target,$(2)) : T_CXXFLAGS += $(call gb_LinkTarget__get_cxxflags,$(4)) $(3) $(5)
+$(call gb_GenCxxObject_get_target,$(2)) : OBJECT_HAS_EXTRA_CXXFLAGS := $(if $(strip $(3)),1)
$(call gb_GenCxxObject_get_target,$(2)) : \
OBJECTOWNER := $(call gb_Object__owner,$(2),$(1))
$(call gb_GenCxxObject_get_target,$(2)) : GEN_CXX_SOURCE := $(call gb_GenCxxObject_get_source,$(2),$(1))
@@ -1275,6 +1290,11 @@ endif
endef
+# call gb_LinkTarget_add_generated_cxx_object,linktarget,sourcefile,cxxflags,linktargetmakefilename
+define gb_LinkTarget_add_generated_cxx_object
+$(call gb_LinkTarget_add_generated_cxx_object_internal,$(1),$(2),$(3),$(4))
+endef
+
# call gb_LinkTarget_add_generated_cxxclrobject,linktarget,sourcefile,cxxclrflags,linktargetmakefilename
define gb_LinkTarget_add_generated_cxxclrobject
$(call gb_LinkTarget_get_target,$(1)) : GENCXXCLROBJECTS += $(2)
@@ -1333,7 +1353,7 @@ endef
# call gb_LinkTarget_add_exception_object,linktarget,sourcefile,cxxflags,linktargetmakefilename
define gb_LinkTarget_add_exception_object
-$(call gb_LinkTarget_add_cxxobject,$(1),$(2),$(gb_LinkTarget_EXCEPTIONFLAGS) $(3),$(4))
+$(call gb_LinkTarget_add_cxxobject_internal,$(1),$(2),$(3),$(4),$(gb_LinkTarget_EXCEPTIONFLAGS))
endef
# call gb_LinkTarget__use_linktarget_objects,linktarget,linktargets
@@ -1418,7 +1438,7 @@ endef
# call gb_LinkTarget_add_generated_exception_object,linktarget,sourcefile,cxxflags,linktargetmakefilename
define gb_LinkTarget_add_generated_exception_object
-$(call gb_LinkTarget_add_generated_cxx_object,$(1),$(2),$(gb_LinkTarget_EXCEPTIONFLAGS) $(3),$(4))
+$(call gb_LinkTarget_add_generated_cxx_object_internal,$(1),$(2),$(3),$(4),$(gb_LinkTarget_EXCEPTIONFLAGS))
endef
# call gb_LinkTarget_add_generated_exception_objects,linktarget,sourcefile,cxxflags,linktargetmakefilename
@@ -1518,7 +1538,7 @@ $(call gb_LinkTarget_get_target,$(1)) : PCHOBJEX = $(call gb_PrecompiledHeader_g
$(call gb_LinkTarget_get_target,$(1)) : PCHOBJS = $$(PCHOBJEX)
$(call gb_LinkTarget_get_target,$(1)) : PCH_DEFS := $$(DEFS)
-$(call gb_LinkTarget_get_target,$(1)) : PCH_CXXFLAGS := $$(T_CXXFLAGS) $(call gb_LinkTarget__get_cxxflags,$(4))
+$(call gb_LinkTarget_get_target,$(1)) : PCH_CXXFLAGS := $$(T_CXXFLAGS) $(call gb_LinkTarget__get_cxxflags,$(4)) $(gb_LinkTarget_EXCEPTIONFLAGS)
$(call gb_LinkTarget_get_target,$(1)) : DEFS += -DPCH_LEVEL=$(gb_ENABLE_PCH)
$(call gb_LinkTarget_get_target,$(1)) : PCH_DEFS += -DPCH_LEVEL=$(gb_ENABLE_PCH)
diff --git a/solenv/gbuild/extensions/post_GbuildToJson.mk b/solenv/gbuild/extensions/post_GbuildToJson.mk
index a14f6a9145e3..7f05392e1179 100644
--- a/solenv/gbuild/extensions/post_GbuildToJson.mk
+++ b/solenv/gbuild/extensions/post_GbuildToJson.mk
@@ -103,7 +103,7 @@ define gb_LinkTarget_add_cobject
$(call gb_LinkTarget_get_target,$(1)) : COBJECTS += $(2)
endef
-define gb_LinkTarget_add_cxxobject
+define gb_LinkTarget_add_cxxobject_internal
$(call gb_LinkTarget_get_target,$(1)) : CXXOBJECTS += $(2)
endef
@@ -111,7 +111,7 @@ define gb_LinkTarget_add_generated_c_object
$(call gb_LinkTarget_get_target,$(1)) : GENCOBJECTS += $(2)
endef
-define gb_LinkTarget_add_generated_cxx_object
+define gb_LinkTarget_add_generated_cxx_object_internal
$(call gb_LinkTarget_get_target,$(1)) : GENCXXOBJECTS += $(2)
endef
commit dc34ab8105d9a3a0766a1cbd09b2eeb36fa8f2d2
Author: Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Thu Oct 3 11:54:28 2019 +0200
Commit: Luboš Luňák <l.lunak at collabora.com>
CommitDate: Fri Oct 4 08:57:29 2019 +0200
always use gb_LinkTarget__get_cxxflags for cxxobjects
E.g. gb_LinkTarget_add_exception_object adds it explicitly, but
gb_LinkTarget_add_cxxobject itself does not, even though other variants
(c,objc,objcxx) do it.
This means that when compiling tools/qa/cppunit/test_cpuid.cxx it
doesn't get the correct -O/-g flags, because CppunitTest_tools_test.mk
uses gb_CppunitTest_add_cxxobjects to add $(INTRINSICS_CXXFLAGS).
And that in its own actually should use the add_exception_objects variant,
it didn't presumably because that one used to have cxxflags passing broken
until I fixed it in 4bbdab901eb3c7d32d28910fb830f4b0422eee91. The usage
in Library_cpp_uno.mk even explicitly works around the lack of debug symbols.
Change-Id: Idc794e95bb817cd2ba2942b8e1f04f80d6722f97
Reviewed-on: https://gerrit.libreoffice.org/80119
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak at collabora.com>
diff --git a/bridges/Library_cpp_uno.mk b/bridges/Library_cpp_uno.mk
index 0ca679e4b216..f9e573bd7ff2 100644
--- a/bridges/Library_cpp_uno.mk
+++ b/bridges/Library_cpp_uno.mk
@@ -32,10 +32,9 @@ ifneq ($(filter ANDROID DRAGONFLY FREEBSD LINUX NETBSD OPENBSD,$(OS)),)
bridges_SELECTED_BRIDGE := gcc3_linux_aarch64
bridge_exception_objects := abi callvirtualfunction uno2cpp
-$(eval $(call gb_Library_add_cxxobjects,$(gb_CPPU_ENV)_uno, \
+$(eval $(call gb_Library_add_exception_objects,$(gb_CPPU_ENV)_uno, \
bridges/source/cpp_uno/$(bridges_SELECTED_BRIDGE)/cpp2uno, \
- $(gb_LinkTarget_EXCEPTIONFLAGS) \
- $(call gb_LinkTarget__get_cxxflags,$(gb_CPPU_ENV)_uno) -fstack-protector \
+ -fstack-protector \
))
endif
@@ -219,8 +218,6 @@ bridges_NON_CALL_EXCEPTIONS_FLAGS := -fnon-call-exceptions
endif
endif
-bridges_DEBUGINFO_FLAGS := $(if $(call gb_LinkTarget__symbols_enabled,Library_$(gb_CPPU_ENV)_uno),$(gb_DEBUGINFO_FLAGS))
-
$(eval $(call gb_Library_use_libraries,$(gb_CPPU_ENV)_uno,\
cppu \
sal \
@@ -231,19 +228,19 @@ $(foreach obj,$(bridge_exception_objects),\
bridges/source/cpp_uno/$(bridges_SELECTED_BRIDGE)/$(obj))) \
)
$(foreach obj,$(bridge_noncallexception_objects),\
- $(eval $(call gb_Library_add_cxxobjects,$(gb_CPPU_ENV)_uno,\
+ $(eval $(call gb_Library_add_exception_objects,$(gb_CPPU_ENV)_uno,\
bridges/source/cpp_uno/$(bridges_SELECTED_BRIDGE)/$(obj) \
- , $(bridges_NON_CALL_EXCEPTIONS_FLAGS) $(gb_LinkTarget_EXCEPTIONFLAGS) $(bridges_DEBUGINFO_FLAGS))) \
+ , $(bridges_NON_CALL_EXCEPTIONS_FLAGS) )) \
)
$(foreach obj,$(bridge_noopt_objects),\
- $(eval $(call gb_Library_add_cxxobjects,$(gb_CPPU_ENV)_uno,\
+ $(eval $(call gb_Library_add_exception_objects,$(gb_CPPU_ENV)_uno,\
bridges/source/cpp_uno/$(bridges_SELECTED_BRIDGE)/$(obj) \
- , $(gb_COMPILERNOOPTFLAGS) $(gb_LinkTarget_EXCEPTIONFLAGS) $(bridges_DEBUGINFO_FLAGS))) \
+ , $(gb_COMPILERNOOPTFLAGS))) \
)
$(foreach obj,$(bridge_noncallexception_noopt_objects),\
- $(eval $(call gb_Library_add_cxxobjects,$(gb_CPPU_ENV)_uno,\
+ $(eval $(call gb_Library_add_exception_objects,$(gb_CPPU_ENV)_uno,\
bridges/source/cpp_uno/$(bridges_SELECTED_BRIDGE)/$(obj) \
- , $(gb_COMPILERNOOPTFLAGS) $(bridges_NON_CALL_EXCEPTIONS_FLAGS) $(gb_LinkTarget_EXCEPTIONFLAGS) $(bridges_DEBUGINFO_FLAGS))) \
+ , $(gb_COMPILERNOOPTFLAGS) $(bridges_NON_CALL_EXCEPTIONS_FLAGS) )) \
)
$(foreach obj,$(bridge_cxx_objects),\
$(eval $(call gb_Library_add_cxxobjects,$(gb_CPPU_ENV)_uno,\
diff --git a/oox/Library_oox.mk b/oox/Library_oox.mk
index cce41174dcc7..cc235b87e360 100644
--- a/oox/Library_oox.mk
+++ b/oox/Library_oox.mk
@@ -308,9 +308,9 @@ ifeq ($(OS),iOS)
# behaviour in the source code... Compiling this source file with
# optimization causes some Smart Art images to end up with completely
# wrong colour, some even totally black.
-$(eval $(call gb_Library_add_cxxobjects,oox,\
+$(eval $(call gb_Library_add_exception_objects,oox,\
oox/source/drawingml/color \
- , $(gb_COMPILERNOOPTFLAGS) $(gb_LinkTarget_EXCEPTIONFLAGS) \
+ , $(gb_COMPILERNOOPTFLAGS) \
))
else
$(eval $(call gb_Library_add_exception_objects,oox,\
diff --git a/solenv/gbuild/LinkTarget.mk b/solenv/gbuild/LinkTarget.mk
index 5abd3c2ba3cf..72c4de1dd206 100644
--- a/solenv/gbuild/LinkTarget.mk
+++ b/solenv/gbuild/LinkTarget.mk
@@ -1122,7 +1122,7 @@ $(call gb_LinkTarget_get_clean_target,$(1)) : CXXOBJECTS += $(2)
$(call gb_LinkTarget_get_target,$(1)) : $(call gb_CxxObject_get_target,$(2))
$(call gb_CxxObject_get_target,$(2)) : | $(call gb_LinkTarget_get_headers_target,$(1))
-$(call gb_CxxObject_get_target,$(2)) : T_CXXFLAGS += $(3)
+$(call gb_CxxObject_get_target,$(2)) : T_CXXFLAGS += $(call gb_LinkTarget__get_cxxflags,$(4)) $(3)
$(call gb_CxxObject_get_target,$(2)) : \
OBJECTOWNER := $(call gb_Object__owner,$(2),$(1))
ifneq ($(gb_ENABLE_PCH),)
@@ -1258,7 +1258,7 @@ $(call gb_GenCxxObject_get_target,$(2)) : $(call gb_GenCxxObject_get_source,$(2)
$(call gb_GenCxxObject_get_source,$(2),$(1)) : | $(gb_Helper_MISCDUMMY)
$(call gb_GenCxxObject_get_target,$(2)) : | $(call gb_LinkTarget_get_headers_target,$(1))
$(call gb_GenCxxObject_get_target,$(2)) : WARNINGS_NOT_ERRORS := $(true)
-$(call gb_GenCxxObject_get_target,$(2)) : T_CXXFLAGS += $(3)
+$(call gb_GenCxxObject_get_target,$(2)) : T_CXXFLAGS += $(call gb_LinkTarget__get_cxxflags,$(4)) $(3)
$(call gb_GenCxxObject_get_target,$(2)) : \
OBJECTOWNER := $(call gb_Object__owner,$(2),$(1))
$(call gb_GenCxxObject_get_target,$(2)) : GEN_CXX_SOURCE := $(call gb_GenCxxObject_get_source,$(2),$(1))
@@ -1333,7 +1333,7 @@ endef
# call gb_LinkTarget_add_exception_object,linktarget,sourcefile,cxxflags,linktargetmakefilename
define gb_LinkTarget_add_exception_object
-$(call gb_LinkTarget_add_cxxobject,$(1),$(2),$(gb_LinkTarget_EXCEPTIONFLAGS) $(call gb_LinkTarget__get_cxxflags,$(4)) $(3),$(4))
+$(call gb_LinkTarget_add_cxxobject,$(1),$(2),$(gb_LinkTarget_EXCEPTIONFLAGS) $(3),$(4))
endef
# call gb_LinkTarget__use_linktarget_objects,linktarget,linktargets
@@ -1418,7 +1418,7 @@ endef
# call gb_LinkTarget_add_generated_exception_object,linktarget,sourcefile,cxxflags,linktargetmakefilename
define gb_LinkTarget_add_generated_exception_object
-$(call gb_LinkTarget_add_generated_cxx_object,$(1),$(2),$(gb_LinkTarget_EXCEPTIONFLAGS) $(call gb_LinkTarget__get_cxxflags,$(4)) $(3),$(4))
+$(call gb_LinkTarget_add_generated_cxx_object,$(1),$(2),$(gb_LinkTarget_EXCEPTIONFLAGS) $(3),$(4))
endef
# call gb_LinkTarget_add_generated_exception_objects,linktarget,sourcefile,cxxflags,linktargetmakefilename
diff --git a/tools/CppunitTest_tools_test.mk b/tools/CppunitTest_tools_test.mk
index 515c3fbd1e14..65f6d02fd782 100644
--- a/tools/CppunitTest_tools_test.mk
+++ b/tools/CppunitTest_tools_test.mk
@@ -32,8 +32,8 @@ $(eval $(call gb_CppunitTest_add_exception_objects,tools_test, \
tools/qa/cppunit/test_GenericTypeSerializer \
))
-$(eval $(call gb_CppunitTest_add_cxxobjects,tools_test,\
- tools/qa/cppunit/test_cpuid, $(gb_LinkTarget_EXCEPTIONFLAGS) $(INTRINSICS_CXXFLAGS) \
+$(eval $(call gb_CppunitTest_add_exception_objects,tools_test,\
+ tools/qa/cppunit/test_cpuid, $(INTRINSICS_CXXFLAGS) \
))
$(eval $(call gb_CppunitTest_use_sdk_api,tools_test))
More information about the Libreoffice-commits
mailing list