[Libreoffice-commits] core.git: config_host/config_global.h.in config_host.mk.in configure.ac include/rtl solenv/gbuild

Stephan Bergmann sbergman at redhat.com
Thu Jun 1 21:45:34 UTC 2017


 config_host.mk.in                      |    1 
 config_host/config_global.h.in         |    1 
 configure.ac                           |   78 ---------------------------------
 include/rtl/instance.hxx               |   10 +---
 solenv/gbuild/platform/com_GCC_defs.mk |    4 -
 5 files changed, 4 insertions(+), 90 deletions(-)

New commits:
commit 6517fd2107a5a71290afad8850da0eab51519bc6
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Thu Jun 1 23:42:24 2017 +0200

    HAVE_THREADSAFE_STATICS sould always be true
    
    ...(for LIBO_INTERNAL_ONLY), now that the status of Android has been clarified,
    see <https://lists.freedesktop.org/archives/libreoffice/2017-June/077827.html>
    "Re: Some baseline thoughts"
    
    Change-Id: Ie9d5444df84c23d48c24b68d9d2ab5322c619858

diff --git a/config_host.mk.in b/config_host.mk.in
index 9a1a0066200e..8b7c7cfbf5cb 100644
--- a/config_host.mk.in
+++ b/config_host.mk.in
@@ -246,7 +246,6 @@ export HAVE_GNUMAKE_FILE_FUNC=@HAVE_GNUMAKE_FILE_FUNC@
 export HAVE_LD_BSYMBOLIC_FUNCTIONS=@HAVE_LD_BSYMBOLIC_FUNCTIONS@
 export HAVE_LD_HASH_STYLE=@HAVE_LD_HASH_STYLE@
 export HAVE_POSIX_FALLOCATE=@HAVE_POSIX_FALLOCATE@
-export HAVE_THREADSAFE_STATICS=@HAVE_THREADSAFE_STATICS@
 export HELP_COMMON_ONLY=@HELP_COMMON_ONLY@
 export HOST_PLATFORM=@host@
 export HSQLDB_JAR=@HSQLDB_JAR@
diff --git a/config_host/config_global.h.in b/config_host/config_global.h.in
index e06f477fdd34..1becb71a5ba5 100644
--- a/config_host/config_global.h.in
+++ b/config_host/config_global.h.in
@@ -18,7 +18,6 @@ Any change in this header will cause a rebuild of almost everything.
 /* _Pragma */
 #define HAVE_GCC_PRAGMA_OPERATOR 0
 #define HAVE_GCC_DEPRECATED_MESSAGE 0
-#define HAVE_THREADSAFE_STATICS 0
 #define HAVE_BROKEN_CONST_ITERATORS 0
 #define HAVE_SYSLOG_H 0
 /* Compiler supports __attribute__((warn_unused)). */
diff --git a/configure.ac b/configure.ac
index 0fcab1169b13..05e370194d6e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5832,84 +5832,6 @@ fi
 AC_CONFIG_HEADERS([config_host/config_probes.h])
 
 dnl ===================================================================
-dnl thread-safe statics
-dnl ===================================================================
-AC_MSG_CHECKING([whether $CXX supports thread safe statics])
-unset HAVE_THREADSAFE_STATICS
-if test "$GCC" = "yes"; then
-    dnl -fthreadsafe-statics is available since GCC 4, so always available for
-    dnl us.  However, some C++ runtimes use a single lock for all static
-    dnl variables, which can cause deadlock in multi-threaded applications.
-    dnl This is not easily tested here; for POSIX-based systems, if executing
-    dnl the following C++ program does not terminate then the tool chain
-    dnl apparently has this problem:
-    dnl
-    dnl   #include <pthread.h>
-    dnl   int h() { return 0; }
-    dnl   void * g(void * unused) {
-    dnl     static int n = h();
-    dnl     return &n;
-    dnl   }
-    dnl   int f() {
-    dnl     pthread_t t;
-    dnl     pthread_create(&t, 0, g, 0);
-    dnl     pthread_join(t, 0);
-    dnl     return 0;
-    dnl   }
-    dnl   int main() {
-    dnl     static int n = f();
-    dnl     return n;
-    dnl   }
-    dnl
-    dnl Mac OS X up to at least 10.7.1 is known to have this problem, as is at
-    dnl least one instance of GCC 4.2.4 (used on a "Linux ooobuild1.osuosl.org
-    dnl 2.6.9-101.plus.c4smp #1 SMP Thu Jul 21 19:08:15 EDT 2011 i686 i686 i386
-    dnl GNU/Linux" machine); see the definition of __cxa_guard_acquire in GCC's
-    dnl libstdc++-v3/libsupc++/guard.cc for what #ifdefs actually make a
-    dnl difference there.  Conservative advice from Jakub Jelinek is to assume
-    dnl it working in GCC >= 4.3, so conservative way to check here is to use
-    dnl GCC_VERSION for GCC but resort to __GLIBCXX__ corresponding to libstdc++
-    dnl shipped with GCC 4.3.0 (cf. <http://gcc.gnu.org/onlinedocs/libstdc++/
-    dnl manual/abi.html#abi.versioning.history>; 4.3.0 is 20080306, 4.2.4 is
-    dnl 20080519, 4.3.1 is 20080606) for Clang (for which GCC_VERSION is notoriously
-    dnl "too old"):
-    if test "$_os" = Darwin; then
-        HAVE_THREADSAFE_STATICS=TRUE
-    elif test "$_os" != Android; then
-        if test "$COM_IS_CLANG" = TRUE; then
-            AC_LANG_PUSH([C++])
-            AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
-#include <list>
-#if defined __GLIBCXX__
-#if __GLIBCXX__ < 20080606 && __GLIBCXX__ != 20080306
-#error
-#endif
-#endif
-                ]])],[HAVE_THREADSAFE_STATICS=TRUE],[])
-            AC_LANG_POP([C++])
-        else # known to work in GCC since version 4.3
-            HAVE_THREADSAFE_STATICS=TRUE
-        fi
-    fi
-    if test "$HAVE_THREADSAFE_STATICS" = TRUE; then
-        AC_DEFINE(HAVE_THREADSAFE_STATICS)
-        AC_MSG_RESULT([yes])
-    else
-        AC_MSG_RESULT([broken (i.e., no)])
-    fi
-else
-    # MSVC has sprouted C++11 thread-safe statics in 2015
-    # http://blogs.msdn.com/b/vcblog/archive/2015/06/19/c-11-14-17-features-in-vs-2015-rtm.aspx
-    if test "$COM" = "MSC"; then
-        AC_DEFINE(HAVE_THREADSAFE_STATICS)
-        AC_MSG_RESULT([yes])
-    else
-        AC_MSG_RESULT([no])
-    fi
-fi
-AC_SUBST(HAVE_THREADSAFE_STATICS)
-
-dnl ===================================================================
 dnl GCC features
 dnl ===================================================================
 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
diff --git a/include/rtl/instance.hxx b/include/rtl/instance.hxx
index d1d8d9eaa44e..79d234308b96 100644
--- a/include/rtl/instance.hxx
+++ b/include/rtl/instance.hxx
@@ -25,9 +25,7 @@
 #include <cstddef>
 
 #include <osl/doublecheckedlocking.h>
-#if ! HAVE_THREADSAFE_STATICS
 #include <osl/getglobalmutex.hxx>
-#endif
 
 namespace {
 
@@ -383,7 +381,7 @@ namespace rtl {
               using the outer class
               (the one that derives from this base class)
 */
-#if HAVE_THREADSAFE_STATICS
+#if defined LIBO_INTERNAL_ONLY
 template<typename T, typename Unique>
 class Static {
 public:
@@ -443,7 +441,7 @@ private:
               using the outer class
               (the one that derives from this base class)
 */
-#if HAVE_THREADSAFE_STATICS
+#if defined LIBO_INTERNAL_ONLY
 template<typename T, typename Data, typename Unique>
 class StaticWithArg {
 public:
@@ -525,7 +523,7 @@ private:
     @tparam InitAggregate
               initializer functor class
 */
-#if HAVE_THREADSAFE_STATICS
+#if defined LIBO_INTERNAL_ONLY
 template<typename T, typename InitAggregate>
 class StaticAggregate {
 public:
@@ -590,7 +588,7 @@ public:
               Initializer functor's return type.
               Default is T (common practice).
 */
-#if HAVE_THREADSAFE_STATICS
+#if defined LIBO_INTERNAL_ONLY
 template<typename T, typename InitData,
          typename Unique = InitData, typename Data = T>
 class StaticWithInit {
diff --git a/solenv/gbuild/platform/com_GCC_defs.mk b/solenv/gbuild/platform/com_GCC_defs.mk
index 6b697fc9461c..19d44df64e39 100644
--- a/solenv/gbuild/platform/com_GCC_defs.mk
+++ b/solenv/gbuild/platform/com_GCC_defs.mk
@@ -73,10 +73,6 @@ gb_CXXFLAGS_COMMON := \
 
 gb_CXXFLAGS_Wundef = -Wno-undef
 
-ifneq ($(HAVE_THREADSAFE_STATICS),TRUE)
-gb_CXXFLAGS_COMMON += -fno-threadsafe-statics
-endif
-
 ifeq ($(strip $(gb_GCOV)),YES)
 gb_CFLAGS_COMMON += -fprofile-arcs -ftest-coverage
 gb_CXXFLAGS_COMMON += -fprofile-arcs -ftest-coverage


More information about the Libreoffice-commits mailing list