[Libreoffice-commits] core.git: 2 commits - compilerplugins/Makefile-clang.mk config_host/config_clang.h.in configure.ac

Luboš Luňák (via logerrit) logerrit at kemper.freedesktop.org
Mon May 27 14:04:36 UTC 2019


 compilerplugins/Makefile-clang.mk |    6 ++++--
 config_host/config_clang.h.in     |    4 ++++
 configure.ac                      |    3 ++-
 3 files changed, 10 insertions(+), 3 deletions(-)

New commits:
commit 5e075c3fbfd13d24042e420c340e9ae05f942dc5
Author:     Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Sun May 26 14:31:54 2019 +0200
Commit:     Luboš Luňák <l.lunak at collabora.com>
CommitDate: Mon May 27 16:03:41 2019 +0200

    fix compilerplugin rebuilding when system clang changes
    
    Since Clang doesn't keep backwards binary compatibility, it's necessary
    to rebuild when Clang (major version?) changes. This was broken
    because e.g. check.cxx didn't include plugin.hxx, and so it didn't depend
    on config_clang.h . Now simply force timestamp change if config_clang.h
    changes.
    This still needs re-running configure though.
    
    Change-Id: Icbc404b37105599f1ca6c8996f5a3d45d50082db
    Reviewed-on: https://gerrit.libreoffice.org/72976
    Tested-by: Jenkins
    Reviewed-by: Luboš Luňák <l.lunak at collabora.com>

diff --git a/compilerplugins/Makefile-clang.mk b/compilerplugins/Makefile-clang.mk
index 7cdf407bd0f0..ce3ab90a0ec2 100644
--- a/compilerplugins/Makefile-clang.mk
+++ b/compilerplugins/Makefile-clang.mk
@@ -171,8 +171,10 @@ else
 			-Wl$(CLANG_COMMA)-undefined -Wl$(CLANG_COMMA)suppress)
 endif
 
-# Clang most probably doesn't maintain binary compatibility, so rebuild when clang changes.
-$(CLANGOUTDIR)/clang-timestamp: $(CLANGDIR)/bin/clang$(CLANG_EXE_EXT)
+# Clang most probably doesn't maintain binary compatibility, so rebuild when clang changes
+# (either the binary can change if it's a local build, or config_clang.h will change if configure detects
+# a new version of a newly installed system clang).
+$(CLANGOUTDIR)/clang-timestamp: $(CLANGDIR)/bin/clang$(CLANG_EXE_EXT) $(BUILDDIR)/config_host/config_clang.h
 	$(QUIET)touch $@
 
 
diff --git a/compilerplugins/clang/plugin.hxx b/compilerplugins/clang/plugin.hxx
index 75672ff09915..984bd11cd315 100644
--- a/compilerplugins/clang/plugin.hxx
+++ b/compilerplugins/clang/plugin.hxx
@@ -12,8 +12,6 @@
 #ifndef PLUGIN_H
 #define PLUGIN_H
 
-#include <config_clang.h>
-
 #include <clang/AST/ASTContext.h>
 #include <clang/AST/RecursiveASTVisitor.h>
 #include <clang/Basic/FileManager.h>
commit d4bb16adcd2327cb99b42f64d62a180a0f08c147
Author:     Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Sun May 26 13:53:34 2019 +0200
Commit:     Luboš Luňák <l.lunak at collabora.com>
CommitDate: Mon May 27 16:03:31 2019 +0200

    Revert "Remove broken rebuild of compilerplugins when CLANG_FULL_VERSION..."
    
    This reverts commit efe28895498b03f1468a9dc9f510452f36affc2f.
    It is that commit that is broken. The only thing that does not work is
    that not all compilerplugin sources depend on config_clang.h, the rest is fine.
    So instead of reverting something that in principle works (and even complaining
    in the commit message about the original problem), just fix it
    (will do in next commit).
    
    Change-Id: Ic7766a97220d5b7ef1cd195320899564140fdf1c
    Reviewed-on: https://gerrit.libreoffice.org/72975
    Tested-by: Jenkins
    Reviewed-by: Luboš Luňák <l.lunak at collabora.com>

diff --git a/compilerplugins/clang/plugin.hxx b/compilerplugins/clang/plugin.hxx
index 984bd11cd315..75672ff09915 100644
--- a/compilerplugins/clang/plugin.hxx
+++ b/compilerplugins/clang/plugin.hxx
@@ -12,6 +12,8 @@
 #ifndef PLUGIN_H
 #define PLUGIN_H
 
+#include <config_clang.h>
+
 #include <clang/AST/ASTContext.h>
 #include <clang/AST/RecursiveASTVisitor.h>
 #include <clang/Basic/FileManager.h>
diff --git a/config_host/config_clang.h.in b/config_host/config_clang.h.in
index 66629bfd780e..c19c0875ce86 100644
--- a/config_host/config_clang.h.in
+++ b/config_host/config_clang.h.in
@@ -13,4 +13,8 @@ Settings related to Clang compiler plugins.
 
 #undef CLANG_VERSION
 
+/* This is actually unused, but it should change whenever Clang changes,
+thus causing update of this .h file and triggering rebuild of our Clang plugin. */
+#undef CLANG_FULL_VERSION
+
 #endif
diff --git a/configure.ac b/configure.ac
index b411ee9d92a6..dfa860de51af 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3673,15 +3673,16 @@ if test "$COM_IS_CLANG" = TRUE; then
             my_args="-E -P"
         fi
         clang_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $CC_PLAIN $my_args - | sed 's/ //g'`
+        CLANG_FULL_VERSION=`echo __clang_version__ | $CC_PLAIN $my_args -`
         CLANGVER=`echo $clang_version \
             | $AWK -F. '{ print \$1*10000+(\$2<100?\$2:99)*100+(\$3<100?\$3:99) }'`
         if test "$CLANGVER" -ge 50002; then
             AC_MSG_RESULT([yes ($clang_version)])
         else
-            CLANG_FULL_VERSION=`echo __clang_version__ | $CC_PLAIN $my_args -`
             AC_MSG_ERROR(["$CLANG_FULL_VERSION" is too old or unrecognized, must be at least Clang 5.0.2])
         fi
         AC_DEFINE_UNQUOTED(CLANG_VERSION,$CLANGVER)
+        AC_DEFINE_UNQUOTED(CLANG_FULL_VERSION,$CLANG_FULL_VERSION)
     fi
 fi
 


More information about the Libreoffice-commits mailing list