[Libreoffice-commits] core.git: compilerplugins/clang solenv/gbuild

Stephan Bergmann sbergman at redhat.com
Fri Jan 27 09:46:57 UTC 2017


 compilerplugins/clang/pluginhandler.cxx |    6 ++
 solenv/gbuild/LinkTarget.mk             |   79 ++++++++++++++++++++++++++++++++
 solenv/gbuild/platform/com_GCC_class.mk |   74 -----------------------------
 3 files changed, 85 insertions(+), 74 deletions(-)

New commits:
commit 38da1ed9195578aed4edb9d3c9c9eb2587923658
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Fri Jan 27 10:46:15 2017 +0100

    Make plugin rewriting work on Windows too
    
    ...in a somewhat hacked-up way for now (see the TODO comment)
    
    Change-Id: Ida89fb8257b876cfca05b3048ce15996091c5703

diff --git a/compilerplugins/clang/pluginhandler.cxx b/compilerplugins/clang/pluginhandler.cxx
index b46079bb1..b6e45c8 100644
--- a/compilerplugins/clang/pluginhandler.cxx
+++ b/compilerplugins/clang/pluginhandler.cxx
@@ -191,6 +191,11 @@ void PluginHandler::HandleTranslationUnit( ASTContext& context )
         if( plugins[ i ].object != NULL )
             plugins[ i ].object->run();
         }
+#if defined _WIN32
+    //TODO: make the call to 'rename' work on Windows (where the renamed-to
+    // original file is probably still held open somehow):
+    rewriter.overwriteChangedFiles();
+#else
     for( Rewriter::buffer_iterator it = rewriter.buffer_begin();
          it != rewriter.buffer_end();
          ++it )
@@ -256,6 +261,7 @@ void PluginHandler::HandleTranslationUnit( ASTContext& context )
             report( DiagnosticsEngine::Error, "cannot write modified source to %0 (%1)" ) << modifyFile << error;
         delete[] filename;
         }
+#endif
     }
 
 #if CLANG_VERSION >= 30600
diff --git a/solenv/gbuild/LinkTarget.mk b/solenv/gbuild/LinkTarget.mk
index 3b9a0d5..ca1f5ad 100644
--- a/solenv/gbuild/LinkTarget.mk
+++ b/solenv/gbuild/LinkTarget.mk
@@ -73,6 +73,85 @@ gb_LinkTarget_LAYER_LINKPATHS := \
 	NONE:URELIB+OOO+NONE. \
 
 
+# Used to run a compiler plugin tool.
+#
+# At least for now, these definitions are generic enough so that they can be
+# shared across all current use cases (COMPILER_EXTERNAL_TOOL,
+# COMPILER_PLUGIN_TOOL) on all relevant toolchains (GCC?, Clang, clang-cl).  If
+# it ever becomes necessary, they can be moved to e.g.
+# platform/com_{GCC,MSC}_class.mk and made different there.
+#
+# $(call gb_CObject__tool_command,relative-source,source)
+define gb_CObject__tool_command
+$(call gb_Output_announce,$(1).c,$(true),C  ,3)
+$(call gb_Helper_abbreviate_dirs,\
+        ICECC=no CCACHE_DISABLE=1 \
+	$(gb_CC) \
+		$(DEFS) \
+		$(gb_LTOFLAGS) \
+		$(if $(VISIBILITY),,$(gb_VISIBILITY_FLAGS)) \
+		$(if $(WARNINGS_NOT_ERRORS),$(if $(ENABLE_WERROR),$(if $(PLUGIN_WARNINGS_AS_ERRORS),$(gb_COMPILER_PLUGINS_WARNINGS_AS_ERRORS))),$(gb_CFLAGS_WERROR)) \
+		$(gb_COMPILER_PLUGINS) \
+		$(T_CFLAGS) $(T_CFLAGS_APPEND) \
+		$(if $(EXTERNAL_CODE),$(gb_CXXFLAGS_Wundef),$(gb_DEFS_INTERNAL)) \
+		-c $(2) \
+		-I$(dir $(2)) \
+		$(INCLUDE) \
+		)
+endef
+define gb_ObjCObject__tool_command
+$(call gb_Output_announce,$(1).m,$(true),OCC,3)
+$(call gb_Helper_abbreviate_dirs,\
+        ICECC=no CCACHE_DISABLE=1 \
+	$(gb_CC) \
+		$(DEFS) \
+		$(gb_LTOFLAGS) \
+		$(if $(VISIBILITY),,$(gb_VISIBILITY_FLAGS)) \
+		$(if $(WARNINGS_NOT_ERRORS),$(if $(ENABLE_WERROR),$(if $(PLUGIN_WARNINGS_AS_ERRORS),$(gb_COMPILER_PLUGINS_WARNINGS_AS_ERRORS))),$(gb_CFLAGS_WERROR)) \
+		$(gb_COMPILER_PLUGINS) \
+		$(T_OBJCFLAGS) $(T_OBJCFLAGS_APPEND) \
+		$(if $(EXTERNAL_CODE),$(gb_CXXFLAGS_Wundef),$(gb_DEFS_INTERNAL)) \
+		-c $(2) \
+		-I$(dir $(2)) \
+		$(INCLUDE) \
+		)
+endef
+define gb_CxxObject__tool_command
+$(call gb_Output_announce,$(1).cxx,$(true),CXX,3)
+$(call gb_Helper_abbreviate_dirs,\
+        ICECC=no CCACHE_DISABLE=1 \
+	$(gb_CXX) \
+		$(DEFS) \
+		$(gb_LTOFLAGS) \
+		$(if $(VISIBILITY),,$(gb_VISIBILITY_FLAGS)) \
+		$(if $(WARNINGS_NOT_ERRORS),$(if $(ENABLE_WERROR),$(if $(PLUGIN_WARNINGS_AS_ERRORS),$(gb_COMPILER_PLUGINS_WARNINGS_AS_ERRORS))),$(gb_CFLAGS_WERROR)) \
+		$(gb_COMPILER_PLUGINS) \
+		$(T_CXXFLAGS) $(T_CXXFLAGS_APPEND) \
+		$(if $(EXTERNAL_CODE),$(gb_CXXFLAGS_Wundef),$(gb_DEFS_INTERNAL)) \
+		-c $(2) \
+		-I$(dir $(2)) \
+		$(INCLUDE) \
+		)
+endef
+define gb_ObjCxxObject__tool_command
+$(call gb_Output_announce,$(1).mm,$(true),OCX,3)
+$(call gb_Helper_abbreviate_dirs,\
+        ICECC=no CCACHE_DISABLE=1 \
+	$(gb_CXX) \
+		$(DEFS) \
+		$(gb_LTOFLAGS) \
+		$(if $(VISIBILITY),,$(gb_VISIBILITY_FLAGS)) \
+		$(if $(WARNINGS_NOT_ERRORS),$(if $(ENABLE_WERROR),$(if $(PLUGIN_WARNINGS_AS_ERRORS),$(gb_COMPILER_PLUGINS_WARNINGS_AS_ERRORS))),$(gb_CFLAGS_WERROR)) \
+		$(gb_COMPILER_PLUGINS) \
+		$(T_OBJCXXFLAGS) $(T_OBJCXXFLAGS_APPEND) \
+		$(if $(EXTERNAL_CODE),$(gb_CXXFLAGS_Wundef),$(gb_DEFS_INTERNAL)) \
+		-c $(2) \
+		-I$(dir $(2)) \
+		$(INCLUDE) \
+		)
+endef
+
+
 # Overview of dependencies and tasks of LinkTarget
 #
 # target                      task                         depends on
diff --git a/solenv/gbuild/platform/com_GCC_class.mk b/solenv/gbuild/platform/com_GCC_class.mk
index f80336d..b918f96 100644
--- a/solenv/gbuild/platform/com_GCC_class.mk
+++ b/solenv/gbuild/platform/com_GCC_class.mk
@@ -67,80 +67,6 @@ $(call gb_Helper_abbreviate_dirs,\
 		)
 endef
 
-# Used to run a compiler plugin tool.
-# $(call gb_CObject__tool_command,relative-source,source)
-define gb_CObject__tool_command
-$(call gb_Output_announce,$(1).c,$(true),C  ,3)
-$(call gb_Helper_abbreviate_dirs,\
-        ICECC=no CCACHE_DISABLE=1 \
-	$(gb_CC) \
-		$(DEFS) \
-		$(gb_LTOFLAGS) \
-		$(if $(VISIBILITY),,$(gb_VISIBILITY_FLAGS)) \
-		$(if $(WARNINGS_NOT_ERRORS),$(if $(ENABLE_WERROR),$(if $(PLUGIN_WARNINGS_AS_ERRORS),$(gb_COMPILER_PLUGINS_WARNINGS_AS_ERRORS))),$(gb_CFLAGS_WERROR)) \
-		$(gb_COMPILER_PLUGINS) \
-		$(T_CFLAGS) $(T_CFLAGS_APPEND) \
-		$(if $(EXTERNAL_CODE),$(gb_CXXFLAGS_Wundef),$(gb_DEFS_INTERNAL)) \
-		-c $(2) \
-		-I$(dir $(2)) \
-		$(INCLUDE) \
-		)
-endef
-define gb_ObjCObject__tool_command
-$(call gb_Output_announce,$(1).m,$(true),OCC,3)
-$(call gb_Helper_abbreviate_dirs,\
-        ICECC=no CCACHE_DISABLE=1 \
-	$(gb_CC) \
-		$(DEFS) \
-		$(gb_LTOFLAGS) \
-		$(if $(VISIBILITY),,$(gb_VISIBILITY_FLAGS)) \
-		$(if $(WARNINGS_NOT_ERRORS),$(if $(ENABLE_WERROR),$(if $(PLUGIN_WARNINGS_AS_ERRORS),$(gb_COMPILER_PLUGINS_WARNINGS_AS_ERRORS))),$(gb_CFLAGS_WERROR)) \
-		$(gb_COMPILER_PLUGINS) \
-		$(T_OBJCFLAGS) $(T_OBJCFLAGS_APPEND) \
-		$(if $(EXTERNAL_CODE),$(gb_CXXFLAGS_Wundef),$(gb_DEFS_INTERNAL)) \
-		-c $(2) \
-		-I$(dir $(2)) \
-		$(INCLUDE) \
-		)
-endef
-
-# Used to run a compiler plugin tool.
-# $(call gb_CxxObject__tool_command,relative-source,source)
-define gb_CxxObject__tool_command
-$(call gb_Output_announce,$(1).cxx,$(true),CXX,3)
-$(call gb_Helper_abbreviate_dirs,\
-        ICECC=no CCACHE_DISABLE=1 \
-	$(gb_CXX) \
-		$(DEFS) \
-		$(gb_LTOFLAGS) \
-		$(if $(VISIBILITY),,$(gb_VISIBILITY_FLAGS)) \
-		$(if $(WARNINGS_NOT_ERRORS),$(if $(ENABLE_WERROR),$(if $(PLUGIN_WARNINGS_AS_ERRORS),$(gb_COMPILER_PLUGINS_WARNINGS_AS_ERRORS))),$(gb_CFLAGS_WERROR)) \
-		$(gb_COMPILER_PLUGINS) \
-		$(T_CXXFLAGS) $(T_CXXFLAGS_APPEND) \
-		$(if $(EXTERNAL_CODE),$(gb_CXXFLAGS_Wundef),$(gb_DEFS_INTERNAL)) \
-		-c $(2) \
-		-I$(dir $(2)) \
-		$(INCLUDE) \
-		)
-endef
-define gb_ObjCxxObject__tool_command
-$(call gb_Output_announce,$(1).mm,$(true),OCX,3)
-$(call gb_Helper_abbreviate_dirs,\
-        ICECC=no CCACHE_DISABLE=1 \
-	$(gb_CXX) \
-		$(DEFS) \
-		$(gb_LTOFLAGS) \
-		$(if $(VISIBILITY),,$(gb_VISIBILITY_FLAGS)) \
-		$(if $(WARNINGS_NOT_ERRORS),$(if $(ENABLE_WERROR),$(if $(PLUGIN_WARNINGS_AS_ERRORS),$(gb_COMPILER_PLUGINS_WARNINGS_AS_ERRORS))),$(gb_CFLAGS_WERROR)) \
-		$(gb_COMPILER_PLUGINS) \
-		$(T_OBJCXXFLAGS) $(T_OBJCXXFLAGS_APPEND) \
-		$(if $(EXTERNAL_CODE),$(gb_CXXFLAGS_Wundef),$(gb_DEFS_INTERNAL)) \
-		-c $(2) \
-		-I$(dir $(2)) \
-		$(INCLUDE) \
-		)
-endef
-
 define gb_SrsPartTarget__command_dep
 $(call gb_Helper_abbreviate_dirs,\
 	mkdir -p $(dir $(call gb_SrsPartTarget_get_dep_target,$(1))) && cd $(SRCDIR) && \


More information about the Libreoffice-commits mailing list