include/LibreOfficeKit/LibreOfficeKitInit.h |   38 ++++++++++++++++------------
 1 file changed, 22 insertions(+), 16 deletions(-)

New commits:
commit 5dd9990a12509ec9326c061544b228652e495fe5
Author:     Stephan Bergmann <[email protected]>
AuthorDate: Tue Oct 12 11:40:05 2021 +0200
Commit:     Stephan Bergmann <[email protected]>
CommitDate: Tue Oct 12 13:37:02 2021 +0200

    Don't #include within extern "C"
    
    At least when building against trunk libstdc++ on Fedora 35 beta now, that
    caused failures like
    
    > In file included from ~/lo/core/libreofficekit/qa/unit/checkapi.cxx:18:
    > In file included from 
~/lo/core/workdir/UnpackedTarball/cppunit/include/cppunit/plugin/TestPlugIn.h:8:
    > In file included from 
~/lo/core/workdir/UnpackedTarball/cppunit/include/cppunit/plugin/PlugInParameters.h:8:
    > In file included from 
~/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/12.0.0/../../../../include/c++/12.0.0/deque:70:
    > In file included from 
~/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/12.0.0/../../../../include/c++/12.0.0/debug/deque:40:
    > In file included from 
~/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/12.0.0/../../../../include/c++/12.0.0/debug/safe_sequence.h:35:
    > In file included from 
~/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/12.0.0/../../../../include/c++/12.0.0/debug/safe_base.h:32:
    > In file included from 
~/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/12.0.0/../../../../include/c++/12.0.0/ext/concurrence.h:34:
    > 
~/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/12.0.0/../../../../include/c++/12.0.0/exception:83:8:
 error: declaration of 'terminate' has a different language linkage
    >   void terminate() _GLIBCXX_USE_NOEXCEPT __attribute__ ((__noreturn__));
    >        ^
    > 
~/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/12.0.0/../../../../include/c++/12.0.0/x86_64-pc-linux-gnu/bits/c++config.h:302:10:
 note: previous declaration is here
    >     void terminate() _GLIBCXX_USE_NOEXCEPT __attribute__ ((__noreturn__));
    >          ^
    
    Change-Id: I81cf87d13c16fd10ce3e2435509ab462852fce2f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123447
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <[email protected]>

diff --git a/include/LibreOfficeKit/LibreOfficeKitInit.h 
b/include/LibreOfficeKit/LibreOfficeKitInit.h
index 8a48bd8392be..ccd42863ba25 100644
--- a/include/LibreOfficeKit/LibreOfficeKitInit.h
+++ b/include/LibreOfficeKit/LibreOfficeKitInit.h
@@ -12,11 +12,6 @@
 
 #include <LibreOfficeKit/LibreOfficeKit.h>
 
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
 #if defined __GNUC__ || defined __clang__
 #  define LOK_TOLERATE_UNUSED __attribute__((used))
 #else
@@ -48,6 +43,26 @@ extern "C"
     #endif
     #define SEPARATOR         '/'
 
+#else
+
+    #if !defined WIN32_LEAN_AND_MEAN
+        #define WIN32_LEAN_AND_MEAN
+    #endif
+    #include  <windows.h>
+    #define TARGET_LIB        "sofficeapp" ".dll"
+    #define TARGET_MERGED_LIB "mergedlo" ".dll"
+    #define SEPARATOR         '\\'
+    #define UNOPATH           "\\..\\URE\\bin"
+
+#endif
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#ifndef _WIN32
+
 #if !defined(IOS)
         static void *lok_loadlib(const char *pFN)
     {
@@ -88,15 +103,6 @@ extern "C"
 
 
 #else
-    #if !defined WIN32_LEAN_AND_MEAN
-        #define WIN32_LEAN_AND_MEAN
-    #endif
-    #include  <windows.h>
-    #define TARGET_LIB        "sofficeapp" ".dll"
-    #define TARGET_MERGED_LIB "mergedlo" ".dll"
-    #define SEPARATOR         '\\'
-    #define UNOPATH           "\\..\\URE\\bin"
-
     static void *lok_loadlib(const char *pFN)
     {
         return (void *) LoadLibraryA(pFN);
@@ -345,12 +351,12 @@ int lok_preinit( const char *install_path,  const char 
*user_profile_url )
 
 #undef SEPARATOR // It is used at least in enum class MenuItemType
 
-#endif // defined(__linux__) || defined (__FreeBSD__) || defined(_AIX) || 
defined(_WIN32) || defined(__APPLE__)
-
 #ifdef __cplusplus
 }
 #endif
 
+#endif // defined(__linux__) || defined (__FreeBSD__) || defined(_AIX) || 
defined(_WIN32) || defined(__APPLE__)
+
 #endif // INCLUDED_LIBREOFFICEKIT_LIBREOFFICEKITINIT_H
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Reply via email to