From 0e672fed21251e2eb8238dee64d3366f02b81b5a Mon Sep 17 00:00:00 2001 From: Guillaume Munch Date: Thu, 4 Aug 2016 13:30:47 +0100 Subject: [PATCH] Partially revert "Replace static with thread_local when used for caching" As noticed by Stephan, clang on Mac is nowhere near to support thread_local for some reason: http://stackoverflow.com/questions/28094794/why-does-apple-clang-disallow-c11-thread-local-when-official-clang-supports It does not look realistic to me to provide a configure-based alternative. The solution is to not use thread_local until it is reasonably supported on Mac. According to sources, this means requiring Xcode >= 8. This reverts commit 82d4f1a446260333ef1590f3622196e7c76e414d partially. --- src/frontends/qt4/GuiFontLoader.cpp | 10 +++------- src/frontends/qt4/GuiPainter.cpp | 5 +---- src/frontends/qt4/GuiSymbols.cpp | 5 +---- 3 files changed, 5 insertions(+), 15 deletions(-) diff --git a/src/frontends/qt4/GuiFontLoader.cpp b/src/frontends/qt4/GuiFontLoader.cpp index 2dacc42d02..cc092f5f72 100644 --- a/src/frontends/qt4/GuiFontLoader.cpp +++ b/src/frontends/qt4/GuiFontLoader.cpp @@ -373,13 +373,9 @@ GuiFontInfo::GuiFontInfo(FontInfo const & f) bool FontLoader::available(FontInfo const & f) { -#if defined(__GNUC__) && (__GNUC__ == 4) && (__GNUC_MINOR__ == 6) - static vector cache_set(NUM_FAMILIES, false); - static vector cache(NUM_FAMILIES, false); -#else - thread_local vector cache_set(NUM_FAMILIES, false); - thread_local vector cache(NUM_FAMILIES, false); -#endif + // FIXME THREAD + static vector cache_set(NUM_FAMILIES, false); + static vector cache(NUM_FAMILIES, false); FontFamily family = f.family(); #ifdef Q_OS_MAC diff --git a/src/frontends/qt4/GuiPainter.cpp b/src/frontends/qt4/GuiPainter.cpp index 5156dc0411..e613f3ff72 100644 --- a/src/frontends/qt4/GuiPainter.cpp +++ b/src/frontends/qt4/GuiPainter.cpp @@ -208,11 +208,8 @@ void GuiPainter::lines(int const * xp, int const * yp, int np, return; // double the size if needed -#if defined(__GNUC__) && (__GNUC__ == 4) && (__GNUC_MINOR__ == 6) + // FIXME THREAD static QVector points(32); -#else - thread_local QVector points(32); -#endif if (np > points.size()) points.resize(2 * np); diff --git a/src/frontends/qt4/GuiSymbols.cpp b/src/frontends/qt4/GuiSymbols.cpp index f4a547e61e..a08d7e578a 100644 --- a/src/frontends/qt4/GuiSymbols.cpp +++ b/src/frontends/qt4/GuiSymbols.cpp @@ -152,11 +152,8 @@ const int no_blocks = sizeof(unicode_blocks) / sizeof(UnicodeBlocks); QString getBlock(char_type c) { // store an educated guess for the next search -#if defined(__GNUC__) && (__GNUC__ == 4) && (__GNUC_MINOR__ == 6) + // FIXME THREAD static int lastBlock = 0; -#else - thread_local int lastBlock = 0; -#endif // "clever reset" if (c < 0x7f) -- 2.39.2