[Libreoffice-commits] core.git: compilerplugins/clang compilerplugins/Makefile-clang.mk config_host.mk.in configure.ac distro-configs/Jenkins
Stephan Bergmann (via logerrit)
logerrit at kemper.freedesktop.org
Mon Mar 9 12:49:12 UTC 2020
compilerplugins/Makefile-clang.mk | 7 ++-----
compilerplugins/clang/sharedvisitor/analyzer.cxx | 2 +-
config_host.mk.in | 1 +
configure.ac | 10 ++++++++++
distro-configs/Jenkins/linux_clang_dbgutil_64 | 1 +
5 files changed, 15 insertions(+), 6 deletions(-)
New commits:
commit 5ab0f79748cad1069cc0d0c9cd4b57ccb1e14408
Author: Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Mon Mar 9 11:25:29 2020 +0100
Commit: Stephan Bergmann <sbergman at redhat.com>
CommitDate: Mon Mar 9 13:48:35 2020 +0100
Add --disable-compiler-plugins-analyzer-pch for Jenkins/linux_clang_dbgutil_64
<https://ci.libreoffice.org/job/gerrit_linux_clang_dbgutil/54883/> had been a
case I noticed of a "Gerrit Linux clang/dbgutil" build failing due to stale PCH
information:
[...]
> [build GEN] compilerplugins/clang/sharedvisitor/makeshared.plugininfo
> fatal error: file '/usr/include/asm-generic/errno.h' has been modified since the precompiled header '/home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_clang_dbgutil_64/compilerplugins/clang/sharedvisitor/clang.pch' was built
> note: please rebuild precompiled header '/home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_clang_dbgutil_64/compilerplugins/clang/sharedvisitor/clang.pch'
[...]
and this issue had apparently caused all those Gerrit Jenkins builds to fail for
at least a day. For unmaintained builds like those, I think it is better to
have a more robust setup, where stale PCH information cannot break the build.
Also, as those builds do not make compilerplugins.clean and rather share it
across builds, there should not be much of a performance impact when disabling
PCH in the analyzer.
(It turns out that compilerplugins/clang/sharedvisitor/analyzer.cxx would always
have enabled PCH, as compilerplugins/Makefile-clang.mk always passes in some
definition of LO_CLANG_USE_ANALYZER_PCH. Fixed that now.)
Change-Id: I7b8b24c1049c501634bd59c5fb482bec72427cf6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90211
Reviewed-by: Luboš Luňák <l.lunak at collabora.com>
Reviewed-by: Stephan Bergmann <sbergman at redhat.com>
Tested-by: Jenkins
diff --git a/compilerplugins/Makefile-clang.mk b/compilerplugins/Makefile-clang.mk
index 65cfa67cb1ec..9d6b46019344 100644
--- a/compilerplugins/Makefile-clang.mk
+++ b/compilerplugins/Makefile-clang.mk
@@ -47,9 +47,6 @@ endif
# by gb_ENABLE_PCH like everywhere else, but unsetting this disables PCH.
LO_CLANG_USE_PCH=1
-# Whether to use precompiled headers for the analyzer too. Does not apply to compiling sources.
-LO_CLANG_USE_ANALYZER_PCH=1
-
# The uninteresting rest.
include $(SRCDIR)/solenv/gbuild/gbuild.mk
@@ -275,7 +272,7 @@ $(CLANGOUTDIR)/sharedvisitor/analyzer$(CLANG_EXE_EXT): $(CLANGINDIR)/sharedvisit
$(call gb_Output_announce,$(subst $(BUILDDIR)/,,$@),$(true),GEN,1)
$(QUIET)$(COMPILER_PLUGINS_CXX) $(CLANGDEFS) $(CLANGCXXFLAGS) $(CLANGWERROR) $(CLANGINCLUDES) \
-I$(BUILDDIR)/config_host -DCLANGFLAGS='"$(CLANGTOOLDEFS)"' \
- -DLO_CLANG_USE_ANALYZER_PCH=$(LO_CLANG_USE_ANALYZER_PCH) \
+ -DLO_CLANG_USE_ANALYZER_PCH=$(if $(COMPILER_PLUGINS_ANALYZER_PCH),1,0) \
-c $< -o $(CLANGOUTDIR)/sharedvisitor/analyzer.o -MMD -MT $@ -MP \
-MF $(CLANGOUTDIR)/sharedvisitor/analyzer.d
$(QUIET)$(COMPILER_PLUGINS_CXX) $(CLANGDEFS) $(CLANGCXXFLAGS) $(CLANGOUTDIR)/sharedvisitor/analyzer.o \
@@ -342,7 +339,7 @@ endif
endif
-ifdef LO_CLANG_USE_ANALYZER_PCH
+ifeq ($(COMPILER_PLUGINS_ANALYZER_PCH),TRUE)
# the PCH for usage in sharedvisitor/analyzer
# these are from the invocation in analyzer.cxx
diff --git a/compilerplugins/clang/sharedvisitor/analyzer.cxx b/compilerplugins/clang/sharedvisitor/analyzer.cxx
index 7c69e4a9381c..ea519abb0d95 100644
--- a/compilerplugins/clang/sharedvisitor/analyzer.cxx
+++ b/compilerplugins/clang/sharedvisitor/analyzer.cxx
@@ -273,7 +273,7 @@ int main(int argc, char** argv)
args.end(),
{ // These must match LO_CLANG_ANALYZER_PCH_CXXFLAGS in Makefile-clang.mk .
"-I" BUILDDIR "/config_host" // plugin sources use e.g. config_global.h
-#ifdef LO_CLANG_USE_ANALYZER_PCH
+#if LO_CLANG_USE_ANALYZER_PCH
,
"-include-pch", // use PCH with Clang headers to speed up parsing/analysing
BUILDDIR "/compilerplugins/clang/sharedvisitor/clang.pch"
diff --git a/config_host.mk.in b/config_host.mk.in
index 215212a6f06a..13e5e906a3f6 100644
--- a/config_host.mk.in
+++ b/config_host.mk.in
@@ -78,6 +78,7 @@ export COMMONS_LOGGING_JAR=@COMMONS_LOGGING_JAR@
export COMMONS_LOGGING_VERSION=@COMMONS_LOGGING_VERSION@
export COMPATH=@COMPATH@
export COMPILER_PLUGINS=@COMPILER_PLUGINS@
+export COMPILER_PLUGINS_ANALYZER_PCH=@COMPILER_PLUGINS_ANALYZER_PCH@
export COMPILER_PLUGINS_COM_IS_CLANG=@COMPILER_PLUGINS_COM_IS_CLANG@
export COMPILER_PLUGINS_CXX=@COMPILER_PLUGINS_CXX@
export COMPILER_PLUGINS_CXXFLAGS=@COMPILER_PLUGINS_CXXFLAGS@
diff --git a/configure.ac b/configure.ac
index d17299ecd23f..e82bc1b5adf5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1223,6 +1223,11 @@ if test "$enable_compiler_plugins" = debug; then
COMPILER_PLUGINS_DEBUG=TRUE
fi
+libo_FUZZ_ARG_ENABLE(compiler-plugins-analyzer-pch,
+ AS_HELP_STRING([--disable-compiler-plugins-analyzer-pch],
+ [Disable use of precompiled headers when running the Clang compiler plugin analyzer. Not
+ relevant in the --disable-compiler-plugins case.]))
+
libo_FUZZ_ARG_ENABLE(ooenv,
AS_HELP_STRING([--disable-ooenv],
[Disable ooenv for the instdir installation.]))
@@ -7336,7 +7341,12 @@ else
AC_MSG_ERROR([Compiler plugins are currently supported only with the Clang compiler.])
fi
fi
+COMPILER_PLUGINS_ANALYZER_PCH=
+if test "$enable_compiler_plugins_analyzer_pch" != no; then
+ COMPILER_PLUGINS_ANALYZER_PCH=TRUE
+fi
AC_SUBST(COMPILER_PLUGINS)
+AC_SUBST(COMPILER_PLUGINS_ANALYZER_PCH)
AC_SUBST(COMPILER_PLUGINS_COM_IS_CLANG)
AC_SUBST(COMPILER_PLUGINS_CXX)
AC_SUBST(COMPILER_PLUGINS_CXXFLAGS)
diff --git a/distro-configs/Jenkins/linux_clang_dbgutil_64 b/distro-configs/Jenkins/linux_clang_dbgutil_64
index 758c83606d51..b64e77363a02 100644
--- a/distro-configs/Jenkins/linux_clang_dbgutil_64
+++ b/distro-configs/Jenkins/linux_clang_dbgutil_64
@@ -2,4 +2,5 @@
--enable-compiler-plugins
COMPILER_PLUGINS_CXX=ccache g++ -std=c++11
--enable-kf5
+--disable-compiler-plugins-analyzer-pch
--disable-dependency-tracking
More information about the Libreoffice-commits
mailing list