[Libreoffice-commits] .: 8 commits - compilerplugins/clang compilerplugins/Makefile-clang.mk config/config_clang.h.in config/config_global.h.in configure.ac solenv/bin solenv/doc solenv/gbuild

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Dec 26 06:07:25 PST 2012


 compilerplugins/Makefile-clang.mk             |    2 -
 compilerplugins/clang/plugin.cxx              |   27 ++++++++++++++++----------
 compilerplugins/clang/sallogareas.cxx         |    8 ++-----
 config/config_clang.h.in                      |   12 +++++++++++
 config/config_global.h.in                     |    5 ++++
 configure.ac                                  |    7 ++----
 solenv/bin/update_pch.sh                      |    4 +--
 solenv/doc/gbuild/solenv/gbuild/linktarget.mk |    2 -
 solenv/doc/gbuild/solenv/gbuild/types.mk      |    4 ---
 solenv/gbuild/PrecompiledHeaders.mk           |    4 +--
 solenv/gbuild/platform/com_GCC_class.mk       |    4 +--
 11 files changed, 47 insertions(+), 32 deletions(-)

New commits:
commit 34e53da47bee5c1799339e8e550662d55f01555a
Author: Lubos Lunak <l.lunak at suse.cz>
Date:   Wed Dec 26 13:57:24 2012 +0100

    add a systematic solution

diff --git a/configure.ac b/configure.ac
index d5ce6af..e5b44da 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4165,11 +4165,7 @@ if test "$cross_compiling" = "yes"; then
         config_host.mk.in \
         configure \
         Makefile.in \
-        config/config_clang.h.in \
-        config/config_global.h.in \
-        config/config_graphite.h.in \
-        config/config_telepathy.h.in \
-        config/config_vclplug.h.in \
+        config/config_*.h.in \
         bin/get_config_variables \
         $srcdir/solenv/bin/getcompver.awk \
         $SRC_ROOT/solenv/inc/langlist.mk \
commit 6340adaf8b22cb36ce71a0eecfa066f350cfae7e
Author: Lubos Lunak <l.lunak at suse.cz>
Date:   Wed Dec 26 13:27:09 2012 +0100

    LC_ALL=C for consistent sort

diff --git a/solenv/bin/update_pch.sh b/solenv/bin/update_pch.sh
index 693aee6..f89bfb2 100755
--- a/solenv/bin/update_pch.sh
+++ b/solenv/bin/update_pch.sh
@@ -103,7 +103,7 @@ function filter_ignore()
 )
 
     # " in #include "foo" breaks echo down below, so " -> @
-    cat $tmpfile | sort -u | filter_ignore | sed 's/"/@/g' | \
+    cat $tmpfile | LC_ALL=C sort -u | filter_ignore | sed 's/"/@/g' | \
         (
         while read line; do
             file=`echo $line | sed 's/.*[<"@]\([^>"@]*\)[>"@].*/\1/'`
commit 9f44fe19eb4d9bc668f1325a5dd53c3823c86312
Author: Lubos Lunak <l.lunak at suse.cz>
Date:   Wed Dec 26 12:51:31 2012 +0100

    INCLUDE_STL does not exist

diff --git a/solenv/doc/gbuild/solenv/gbuild/linktarget.mk b/solenv/doc/gbuild/solenv/gbuild/linktarget.mk
index 3de605e..0321c8a 100644
--- a/solenv/doc/gbuild/solenv/gbuild/linktarget.mk
+++ b/solenv/doc/gbuild/solenv/gbuild/linktarget.mk
@@ -112,7 +112,6 @@ namespace gb
             List<Library> LINKED_LIBS;
             List<Path> AUXTARGETS;
             List<Path> INCLUDE;
-            List<Path> INCLUDE_STL;
             List<StaticLibrary> LINKED_STATIC_LIBS;
             List<String> CFLAGS;
             List<String> CXXFLAGS;
@@ -140,7 +139,6 @@ namespace gb
             static const List<String> CXXFLAGS;
             static const List<String> LDFLAGS;
             static const List<Path> INCLUDE;
-            static const List<Path> INCLUDE_STL;
     };
 }
 /* vim: set filetype=cpp : */
diff --git a/solenv/doc/gbuild/solenv/gbuild/types.mk b/solenv/doc/gbuild/solenv/gbuild/types.mk
index acad953..8cdf802 100644
--- a/solenv/doc/gbuild/solenv/gbuild/types.mk
+++ b/solenv/doc/gbuild/solenv/gbuild/types.mk
@@ -160,10 +160,6 @@ namespace gb { namespace types
             /// \$\$(INCLUDE) contains the current paths and can be used if
             /// just a few need to be modified.
             void set_include(List<Path> include);
-            /// Sets the stl include paths for C++ compilation.
-            /// \$\$(INCLUDE_STL) contains the current paths and can be used if
-            /// just a few need to be modified.
-            void set_include_stl(List<Path> include_stl);
     };
     /// A target using the resource compiler
     class UsesRsc
diff --git a/solenv/gbuild/PrecompiledHeaders.mk b/solenv/gbuild/PrecompiledHeaders.mk
index b8ad133..56acfd0 100644
--- a/solenv/gbuild/PrecompiledHeaders.mk
+++ b/solenv/gbuild/PrecompiledHeaders.mk
@@ -51,10 +51,10 @@ $(call gb_NoexPrecompiledHeader_get_dep_target,%) :
 		echo '$(call gb_NoexPrecompiledHeader_get_target,$*) : $$(gb_Helper_PHONY)' > $@)
 
 $(call gb_PrecompiledHeader_get_target,%) :
-	$(call gb_PrecompiledHeader__command,$@,$*,$<,$(PCH_DEFS),$(PCH_CXXFLAGS) $(gb_PrecompiledHeader_EXCEPTIONFLAGS),$(INCLUDE_STL) $(INCLUDE))
+	$(call gb_PrecompiledHeader__command,$@,$*,$<,$(PCH_DEFS),$(PCH_CXXFLAGS) $(gb_PrecompiledHeader_EXCEPTIONFLAGS),$(INCLUDE))
 
 $(call gb_NoexPrecompiledHeader_get_target,%) :
-	$(call gb_NoexPrecompiledHeader__command,$@,$*,$<,$(PCH_DEFS),$(PCH_CXXFLAGS) $(gb_NoexPrecompiledHeader_NOEXCEPTIONFLAGS),$(INCLUDE_STL) $(INCLUDE))
+	$(call gb_NoexPrecompiledHeader__command,$@,$*,$<,$(PCH_DEFS),$(PCH_CXXFLAGS) $(gb_NoexPrecompiledHeader_NOEXCEPTIONFLAGS),$(INCLUDE))
 
 .PHONY : $(call gb_PrecompiledHeader_get_clean_target,%) $(call gb_NoExPrecompiledHeader_get_clean_target,%)
 $(call gb_PrecompiledHeader_get_clean_target,%) :
commit beec35375e60399044e6c07defe2703e976a30d7
Author: Lubos Lunak <l.lunak at suse.cz>
Date:   Wed Dec 26 12:37:52 2012 +0100

    fix typo

diff --git a/solenv/bin/update_pch.sh b/solenv/bin/update_pch.sh
index 1302df4..693aee6 100755
--- a/solenv/bin/update_pch.sh
+++ b/solenv/bin/update_pch.sh
@@ -93,7 +93,7 @@ function local_file()
 function filter_ignore()
 (
 # - filter out all files that are not normal headers
-# - gperffasttoken.hxx is not a problem header
+# - gperffasttoken.hxx is not a proper header
 # - sores.hxx provides BMP_PLUGIN, which is redefined
 # - some sources play ugly #define tricks with editeng/eeitemid.hxx
     grep -e '\.h[">]$' -e '\.hpp[">]$' -e '\.hdl[">]$' -e '\.hxx[">]$' -e '^[^\.]*>$' | \
commit 458b102b8105dccde35f306d5d1fbc7d21bef8f1
Author: Lubos Lunak <l.lunak at suse.cz>
Date:   Mon Dec 24 11:42:18 2012 +0100

    disable ccache too when running clang as rewritter

diff --git a/solenv/gbuild/platform/com_GCC_class.mk b/solenv/gbuild/platform/com_GCC_class.mk
index f88f0f1..80a168e 100644
--- a/solenv/gbuild/platform/com_GCC_class.mk
+++ b/solenv/gbuild/platform/com_GCC_class.mk
@@ -80,7 +80,7 @@ endef
 define gb_CObject__tool_command
 $(call gb_Output_announce,$(1).c,$(true),C  ,3)
 $(call gb_Helper_abbreviate_dirs,\
-        ICECC=no \
+        ICECC=no CCACHE_DISABLE=1 \
 	$(gb_CC) \
 		$(DEFS) \
 		$(T_CFLAGS) \
@@ -121,7 +121,7 @@ endef
 define gb_CxxObject__tool_command
 $(call gb_Output_announce,$(1).cxx,$(true),CXX,3)
 $(call gb_Helper_abbreviate_dirs,\
-        ICECC=no \
+        ICECC=no CCACHE_DISABLE=1 \
 	$(gb_CXX) \
 		$(DEFS) \
 		$(T_CXXFLAGS) \
commit 8b727538e84f1da8d04ed1f28b992e86d9c9199e
Author: Lubos Lunak <l.lunak at suse.cz>
Date:   Sun Dec 23 23:02:39 2012 +0100

    better error handling when writing modified source

diff --git a/compilerplugins/clang/plugin.cxx b/compilerplugins/clang/plugin.cxx
index 7138e88..696118c 100644
--- a/compilerplugins/clang/plugin.cxx
+++ b/compilerplugins/clang/plugin.cxx
@@ -16,6 +16,7 @@
 #include <clang/Frontend/CompilerInstance.h>
 #include <clang/Frontend/FrontendAction.h>
 #include <clang/Frontend/FrontendPluginRegistry.h>
+#include <stdio.h>
 
 #include "bodynotinblock.hxx"
 #include "lclstaticfix.hxx"
@@ -180,19 +181,25 @@ class PluginHandler
                  ++it )
                 {
                 const FileEntry* e = context.getSourceManager().getFileEntryForID( it->first );
-                string filename = std::string( e->getName()) + ".new";
+                char* filename = new char[ strlen( e->getName()) + 100 ];
+                sprintf( filename, "%s.new.%d", e->getName(), getpid());
                 string error;
-                // TODO If there will be actually plugins also modifying headers,
-                // race conditions should be avoided here.
-                raw_fd_ostream ostream( filename.c_str(), error );
+                bool ok = false;
+                raw_fd_ostream ostream( filename, error );
                 DiagnosticsEngine& diag = context.getDiagnostics();
-                if( !error.empty())
+                if( error.empty())
+                    {
+                    it->second.write( ostream );
+                    ostream.close();
+                    if( !ostream.has_error() && rename( filename, e->getName()) == 0 )
+                        ok = true;
+                    }
+                ostream.clear_error();
+                unlink( filename );
+                if( !ok )
                     diag.Report( diag.getCustomDiagID( DiagnosticsEngine::Error,
-                        "cannot write modified source to %0 (%1) [loplugin]" )) << filename << error;
-                else
-                    diag.Report( diag.getCustomDiagID( DiagnosticsEngine::Note,
-                        "modified source %0 [loplugin]" )) << filename;
-                it->second.write( ostream );
+                        "cannot write modified source to %0 (%1) [loplugin]" )) << e->getName() << error;
+                delete[] filename;
                 }
             }
     private:
commit e1b11cc461423f4b8f2709bd83cc7c7014c3de1c
Author: Lubos Lunak <l.lunak at suse.cz>
Date:   Sun Dec 23 22:38:34 2012 +0100

    config_clang.h

diff --git a/compilerplugins/Makefile-clang.mk b/compilerplugins/Makefile-clang.mk
index c87338c..6031fe1 100644
--- a/compilerplugins/Makefile-clang.mk
+++ b/compilerplugins/Makefile-clang.mk
@@ -52,7 +52,7 @@ CLANGOBJS=
 define clangbuildsrc
 $(3): $(2) $(SRCDIR)/compilerplugins/Makefile-clang.mk $(CLANGOUTDIR)/clang-timestamp
 	@echo [build CXX] $(subst $(SRCDIR)/,,$(2))
-	$(CXX) $(CLANGCXXFLAGS) $(CLANGDEFS) $(CLANGINCLUDES) -DSRCDIR=$(SRCDIR) $(2) -fPIC -c -o $(3) -MMD -MT $(3) -MP -MF $(CLANGOUTDIR)/$(1).d
+	$(CXX) $(CLANGCXXFLAGS) $(CLANGDEFS) $(CLANGINCLUDES) -I$(BUILDDIR)/config $(2) -fPIC -c -o $(3) -MMD -MT $(3) -MP -MF $(CLANGOUTDIR)/$(1).d
 
 -include $(CLANGOUTDIR)/$(1).d
 
diff --git a/compilerplugins/clang/sallogareas.cxx b/compilerplugins/clang/sallogareas.cxx
index 10630aa..4462413 100644
--- a/compilerplugins/clang/sallogareas.cxx
+++ b/compilerplugins/clang/sallogareas.cxx
@@ -16,6 +16,8 @@
 
 #include <fstream>
 
+#include <config_clang.h>
+
 namespace loplugin
 {
 
@@ -110,11 +112,7 @@ void SalLogAreas::checkArea( StringRef area, SourceLocation location )
 
 void SalLogAreas::readLogAreas()
     {
-#define STRINGIFY2( s ) #s
-#define STRINGIFY( s ) STRINGIFY2( s )
-    ifstream is( STRINGIFY( SRCDIR ) "/sal/inc/sal/log-areas.dox" );
-#undef STRINGIFY
-#undef STRINGIFY2
+    ifstream is( SRCDIR "/sal/inc/sal/log-areas.dox" );
     while( is.good())
         {
         string line;
diff --git a/config/config_clang.h.in b/config/config_clang.h.in
new file mode 100644
index 0000000..60ff5bf
--- /dev/null
+++ b/config/config_clang.h.in
@@ -0,0 +1,12 @@
+/*
+
+Settings related to Clang compiler plugins.
+
+*/
+
+#ifndef CONFIG_CLANG_H
+#define CONFIG_CLANG_H
+
+#undef SRCDIR
+
+#endif
diff --git a/configure.ac b/configure.ac
index 9de1aec..d5ce6af 100644
--- a/configure.ac
+++ b/configure.ac
@@ -106,6 +106,7 @@ AC_SUBST(SRC_ROOT)
 AC_SUBST(BUILDDIR)
 AC_SUBST(EXEEXT_FOR_BUILD)
 AC_SUBST(x_Cygwin)
+AC_DEFINE_UNQUOTED(SRCDIR,"$SRC_ROOT")
 
 if test "z$EUID" = "z0" -a "`uname -o 2>/dev/null`" = "Cygwin"; then
     AC_MSG_ERROR([You must build LibreOffice as a normal user - not using an administrative account])
@@ -4164,6 +4165,7 @@ if test "$cross_compiling" = "yes"; then
         config_host.mk.in \
         configure \
         Makefile.in \
+        config/config_clang.h.in \
         config/config_global.h.in \
         config/config_graphite.h.in \
         config/config_telepathy.h.in \
@@ -12353,6 +12355,7 @@ else
 fi
 
 AC_CONFIG_FILES([config_host.mk Makefile])
+AC_CONFIG_HEADERS([config/config_clang.h])
 AC_CONFIG_HEADERS([config/config_global.h])
 AC_CONFIG_HEADERS([config/config_graphite.h])
 AC_CONFIG_HEADERS([config/config_telepathy.h])
commit 8c0cb89a4f00704223101c8a380da1ceb33d706a
Author: Lubos Lunak <l.lunak at suse.cz>
Date:   Sun Dec 23 22:25:49 2012 +0100

    multiple include guard for config_global.h
    
    Strictly speaking not necessary, but it should prevent compilers
    from needlessly opening the file repeatedly.

diff --git a/config/config_global.h.in b/config/config_global.h.in
index 63effa9..7080a69 100644
--- a/config/config_global.h.in
+++ b/config/config_global.h.in
@@ -9,8 +9,13 @@ Any change in this header will cause a rebuild of almost everything.
 
 */
 
+#ifndef CONFIG_GLOBAL_H
+#define CONFIG_GLOBAL_H
+
 #undef HAVE_CXX11_DELETE
 #undef HAVE_GCC_BUILTIN_ATOMIC
 #undef HAVE_SFINAE_ANONYMOUS_BROKEN
 #undef HAVE_THREADSAFE_STATICS
 #undef HAVE_SYSLOG_H
+
+#endif


More information about the Libreoffice-commits mailing list