diff options
author | Luboš Luňák <l.lunak@suse.cz> | 2012-07-04 20:32:52 +0200 |
---|---|---|
committer | Luboš Luňák <l.lunak@suse.cz> | 2012-12-10 14:46:48 +0100 |
commit | 2d2bb1e3aa14c9e8b663484eb7af7e48d6d1e712 (patch) | |
tree | ec7cb17e27f2913e7975e459109d6f285dff4512 /solenv | |
parent | 9bf210cfc044c8cd4db5cb2db117c00630b973d9 (diff) |
use noexceptions .pch only when actually needed
Let's assume that all cxx objects use exceptions by default, unless explicitly
added using add_noexception_cxxobject. This should avoid the need to generate
noexceptions .pch in most cases, as noexceptions cxx objects are currently rare.
It also avoids a bug in MSVC that makes .pch generation fail with error C1033
(e.g. comment from 'Fish Fish' in
https://connect.microsoft.com/VisualStudio/feedback/details/98831/fatal-error-c1033-cannot-open-program-database-debug-vc80-idb).
Change-Id: I31c575a34539d58c42754ecfe6639c5b5e5854f1
Diffstat (limited to 'solenv')
-rw-r--r-- | solenv/gbuild/LinkTarget.mk | 12 | ||||
-rw-r--r-- | solenv/gbuild/platform/com_MSC_class.mk | 6 |
2 files changed, 14 insertions, 4 deletions
diff --git a/solenv/gbuild/LinkTarget.mk b/solenv/gbuild/LinkTarget.mk index 3df81343ee47..6715a2f5bee7 100644 --- a/solenv/gbuild/LinkTarget.mk +++ b/solenv/gbuild/LinkTarget.mk @@ -560,6 +560,8 @@ $(call gb_LinkTarget_get_target,$(1)) : LIBRARY_X64 := $(call gb_LinkTarget_get_headers_target,$(1)) \ $(call gb_LinkTarget_get_target,$(1)) : PCH_NAME := $(call gb_LinkTarget_get_target,$(1)) : PCHOBJS := +$(call gb_LinkTarget_get_target,$(1)) : PCHOBJEX := +$(call gb_LinkTarget_get_target,$(1)) : PCHOBJNOEX := $(call gb_LinkTarget_get_headers_target,$(1)) \ $(call gb_LinkTarget_get_target,$(1)) : PDBFILE := $(call gb_LinkTarget_get_target,$(1)) : EXTRAOBJECTLISTS := @@ -876,10 +878,7 @@ $(call gb_CxxObject_get_target,$(2)) : \ ifeq ($(gb_FULLDEPS),$(true)) $(call gb_LinkTarget_get_dep_target,$(1)) : CXXOBJECTS += $(2) $(call gb_LinkTarget_get_dep_target,$(1)) : $(call gb_CxxObject_get_dep_target,$(2)) -# It is not known by this time (or at least I don't know how to find out) which -# PCH variant will be used, so depend on both. $(call gb_CxxObject_get_target,$(2)) : $(call gb_PrecompiledHeader_get_timestamp,$(1)) -$(call gb_CxxObject_get_target,$(2)) : $(call gb_NoexPrecompiledHeader_get_timestamp,$(1)) endif endef @@ -1016,6 +1015,9 @@ endef define gb_LinkTarget_add_noexception_object $(call gb_LinkTarget_add_cxxobject,$(1),$(2),$(gb_LinkTarget_NOEXCEPTIONFLAGS) $(call gb_LinkTarget__get_cxxflags,$(3))) +# noexception objects are rare, so generate matching .pch only when needed +$(call gb_CxxObject_get_target,$(2)) : $(call gb_NoexPrecompiledHeader_get_timestamp,$(1)) +$(call gb_LinkTarget_get_target,$(1)) : PCHOBJS = $$(PCHOBJEX) $$(PCHOBJNOEX) endef define gb_LinkTarget_add_exception_object @@ -1197,7 +1199,9 @@ $(call gb_LinkTarget_get_clean_target,$(1)) : $(call gb_NoexPrecompiledHeader_ge $(call gb_NoexPrecompiledHeader_get_target,$(3)) : $(2).cxx $(call gb_LinkTarget_get_target,$(1)) : PCH_NAME := $(3) -$(call gb_LinkTarget_get_target,$(1)) : PCHOBJS = $(call gb_PrecompiledHeader_get_target,$(3)).obj $(call gb_NoexPrecompiledHeader_get_target,$(3)).obj +$(call gb_LinkTarget_get_target,$(1)) : PCHOBJEX = $(call gb_PrecompiledHeader_get_target,$(3)).obj +$(call gb_LinkTarget_get_target,$(1)) : PCHOBJNOEX = $(call gb_NoexPrecompiledHeader_get_target,$(3)).obj +$(call gb_LinkTarget_get_target,$(1)) : PCHOBJS = $$(PCHOBJEX) $(call gb_LinkTarget_get_headers_target,$(1)) \ $(call gb_LinkTarget_get_target,$(1)) : DEFS := $$(DEFS) -DPRECOMPILED_HEADERS diff --git a/solenv/gbuild/platform/com_MSC_class.mk b/solenv/gbuild/platform/com_MSC_class.mk index 0ce41541e907..04209f999385 100644 --- a/solenv/gbuild/platform/com_MSC_class.mk +++ b/solenv/gbuild/platform/com_MSC_class.mk @@ -90,6 +90,12 @@ endef # PrecompiledHeader class +# Note: MSVC has a race condition when dealing with .pdb files, that can result in error C1033 when +# the .pdb file already exists and two cl.exe invocations try to modify it at the same time (which +# is apparently most likely when generating both .pch files). The no-exceptions variant should be +# rarely needed now, but in case this turns out to be a problem in practice, this will need to +# be handled somehow (such as order-dependency of one on another). + gb_PrecompiledHeader_get_enableflags = -Yu$(1).hxx \ -FI$(1).hxx \ -Fp$(call gb_PrecompiledHeader_get_target,$(1)) |