[Libreoffice-commits] core.git: 3 commits - compilerplugins/clang desktop/source include/LibreOfficeKit libreofficekit/qa

Stephan Bergmann sbergman at redhat.com
Wed Mar 11 02:56:39 PDT 2015


 compilerplugins/clang/checkconfigmacros.cxx |   13 +++++++++----
 desktop/source/lib/init.cxx                 |   11 ++++++-----
 include/LibreOfficeKit/LibreOfficeKitInit.h |    9 ++++++++-
 libreofficekit/qa/unit/tiledrendering.cxx   |    2 ++
 4 files changed, 25 insertions(+), 10 deletions(-)

New commits:
commit 62b124b2704adf11a63681164d05a8eb49dfb105
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Wed Mar 11 10:47:14 2015 +0100

    Ensure RTTI symbol visibility for Linux Clang -fsanitize=function,vptr
    
    The problem being that any lib later loaded via osl_loadModule (e.g.,
    libgcc3_uno.so) would not bind to the same global (RTTI-related) symbols as
    libsofficeapp.so and its dependencies (so, e.g., -fsanitize=function would
    erroneously assume that bridges/source/cpp_uno/shared/component.cxx's
    uno_initEnvironment is called with a different, non-matching uno_Environment
    type).
    
    Change-Id: I08b0cbc1f9eb74641eb617c46587a0a528a56c31

diff --git a/compilerplugins/clang/checkconfigmacros.cxx b/compilerplugins/clang/checkconfigmacros.cxx
index 74a45db..6dea3ce 100644
--- a/compilerplugins/clang/checkconfigmacros.cxx
+++ b/compilerplugins/clang/checkconfigmacros.cxx
@@ -129,9 +129,14 @@ void CheckConfigMacros::checkMacro( const Token& macroToken, SourceLocation loca
     {
     if( configMacros.find( macroToken.getIdentifierInfo()->getName()) != configMacros.end())
         {
-        report( DiagnosticsEngine::Error, "checking whether a config macro %0 is defined",
-            location ) << macroToken.getIdentifierInfo()->getName();
-        report( DiagnosticsEngine::Note, "use #if instead of #ifdef/#ifndef/defined", location );
+        const char* filename = compiler.getSourceManager().getPresumedLoc( location ).getFilename();
+        if( filename == NULL
+            || strncmp( filename, SRCDIR "/include/LibreOfficeKit/", strlen( SRCDIR "/include/LibreOfficeKit/" )) != 0 )
+            {
+            report( DiagnosticsEngine::Error, "checking whether a config macro %0 is defined",
+                location ) << macroToken.getIdentifierInfo()->getName();
+            report( DiagnosticsEngine::Note, "use #if instead of #ifdef/#ifndef/defined", location );
+            }
         }
     }
 
diff --git a/include/LibreOfficeKit/LibreOfficeKitInit.h b/include/LibreOfficeKit/LibreOfficeKitInit.h
index 18731b7..6f56c72 100644
--- a/include/LibreOfficeKit/LibreOfficeKitInit.h
+++ b/include/LibreOfficeKit/LibreOfficeKitInit.h
@@ -39,7 +39,14 @@ extern "C"
 
     void *_dlopen(const char *pFN)
     {
-        return dlopen(pFN, RTLD_LAZY);
+        return dlopen(pFN, RTLD_LAZY
+#if defined __clang__ && defined __linux__ \
+    && defined ENABLE_RUNTIME_OPTIMIZATIONS
+#if !ENABLE_RUNTIME_OPTIMIZATIONS
+                      | RTLD_GLOBAL
+#endif
+#endif
+                      );
     }
 
     void *_dlsym(void *Hnd, const char *pName)
diff --git a/libreofficekit/qa/unit/tiledrendering.cxx b/libreofficekit/qa/unit/tiledrendering.cxx
index 4e13f08..7c956e6 100644
--- a/libreofficekit/qa/unit/tiledrendering.cxx
+++ b/libreofficekit/qa/unit/tiledrendering.cxx
@@ -19,6 +19,8 @@
 #include <osl/file.hxx>
 #include <rtl/bootstrap.hxx>
 
+#include <config_options.h>
+    // see use of ENABLE_RUNTIME_OPTIMIZATIONS in LibreOfficeKintInit.h
 #define LOK_USE_UNSTABLE_API
 #include <LibreOfficeKit/LibreOfficeKitInit.h>
 #include <LibreOfficeKit/LibreOfficeKit.hxx>
commit b162753eadd963fdbad691e30005182e2d9d538a
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Wed Mar 11 10:31:14 2015 +0100

    Use osl/thread.h abstraction
    
    ...which already takes care of things like increasing stack size under ASan
    
    Change-Id: I89f9a25a660aacd41e1125766b23f7be395e7af8

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 0c2f4a9..922ec88 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -23,6 +23,7 @@
 #include <tools/errinf.hxx>
 #include <osl/file.hxx>
 #include <osl/process.h>
+#include <osl/thread.h>
 #include <rtl/strbuf.hxx>
 #include <rtl/bootstrap.hxx>
 #include <cppuhelper/bootstrap.hxx>
@@ -277,7 +278,7 @@ struct LibLibreOffice_Impl : public _LibreOfficeKit
 {
     OUString maLastExceptionMsg;
     shared_ptr< LibreOfficeKitClass > m_pOfficeClass;
-    pthread_t maThread;
+    oslThread maThread;
 
     LibLibreOffice_Impl()
         : maThread(0)
@@ -813,10 +814,9 @@ static bool initialize_uno(const OUString& aAppProgramURL)
     return true;
 }
 
-static void* lo_startmain(void*)
+static void lo_startmain(void*)
 {
     soffice_main();
-    return 0;
 }
 
 static bool bInitialized = false;
@@ -885,7 +885,7 @@ static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath)
         SAL_INFO("lok", "Enabling OfficeIPCThread");
         OfficeIPCThread::EnableOfficeIPCThread();
         SAL_INFO("lok", "Starting soffice_main");
-        pthread_create(&(pLib->maThread), 0, lo_startmain, NULL);
+        pLib->maThread = osl_createThread(lo_startmain, NULL);
         SAL_INFO("lok", "Waiting for OfficeIPCThread");
         OfficeIPCThread::WaitForReady();
         SAL_INFO("lok", "OfficeIPCThread ready -- continuing");
@@ -948,7 +948,8 @@ static void lo_destroy(LibreOfficeKit* pThis)
     SAL_INFO("lok", "LO Destroy");
 
     Application::Quit();
-    pthread_join(pLib->maThread, NULL);
+    osl_joinWithThread(pLib->maThread);
+    osl_destroyThread(pLib->maThread);
 
     delete pLib;
     bInitialized = false;
commit 5035225803b6d0fba4b36321f1c18db0fbb31f19
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Wed Mar 11 08:55:37 2015 +0100

    Fix copy/paste error
    
    Change-Id: I3fd9d6447adfa365a823ca6e87f0939670bcb39b

diff --git a/compilerplugins/clang/checkconfigmacros.cxx b/compilerplugins/clang/checkconfigmacros.cxx
index fff7967..74a45db 100644
--- a/compilerplugins/clang/checkconfigmacros.cxx
+++ b/compilerplugins/clang/checkconfigmacros.cxx
@@ -135,7 +135,7 @@ void CheckConfigMacros::checkMacro( const Token& macroToken, SourceLocation loca
         }
     }
 
-static Plugin::Registration< CheckConfigMacros > X( "bodynotinblock" );
+static Plugin::Registration< CheckConfigMacros > X( "checkconfigmacros" );
 
 } // namespace
 


More information about the Libreoffice-commits mailing list