From 9a99c78ffb7361f968853b5997f4f36ba6d5eaf5 Mon Sep 17 00:00:00 2001 From: Bruce Mitchener Date: Mon, 1 Aug 2022 23:01:49 +0700 Subject: [PATCH] Enable thread_local code more broadly. This was only being enabled on Windows, Linux, and FreeBSD. (FreeBSD only had it enabled in the legacy build system, not in cmake.) `thread_local` is part of C++11, so now that we require C++17 or later and more recent compilers, this should work everywhere that threading does, so only disable it within a `SINGLE_THREAD` build. --- CMakeLists.txt | 3 --- scripts/mk_util.py | 2 -- src/util/memory_manager.cpp | 2 +- 3 files changed, 1 insertion(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 607a851cfc9..514eebebb1a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -188,9 +188,6 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON) if (CMAKE_SYSTEM_NAME STREQUAL "Linux") message(STATUS "Platform: Linux") list(APPEND Z3_COMPONENT_CXX_DEFINES "-D_LINUX_") - if (TARGET_ARCHITECTURE STREQUAL "x86_64") - list(APPEND Z3_COMPONENT_CXX_DEFINES "-D_USE_THREAD_LOCAL") - endif() elseif (CMAKE_SYSTEM_NAME STREQUAL "Android") message(STATUS "Platform: Android") list(APPEND Z3_COMPONENT_CXX_DEFINES "-D_ANDROID_") diff --git a/scripts/mk_util.py b/scripts/mk_util.py index 54242dfe603..781961259ff 100644 --- a/scripts/mk_util.py +++ b/scripts/mk_util.py @@ -2640,8 +2640,6 @@ def mk_config(): if is64(): if not sysname.startswith('CYGWIN') and not sysname.startswith('MSYS') and not sysname.startswith('MINGW'): CXXFLAGS = '%s -fPIC' % CXXFLAGS - if sysname == 'Linux' or sysname == 'FreeBSD': - CPPFLAGS = '%s -D_USE_THREAD_LOCAL' % CPPFLAGS elif not LINUX_X64: CXXFLAGS = '%s -m32' % CXXFLAGS LDFLAGS = '%s -m32' % LDFLAGS diff --git a/src/util/memory_manager.cpp b/src/util/memory_manager.cpp index 15646f216b4..67f5b82b367 100644 --- a/src/util/memory_manager.cpp +++ b/src/util/memory_manager.cpp @@ -215,7 +215,7 @@ void * memory::allocate(char const* file, int line, char const* obj, size_t s) { } #endif -#if !defined(SINGLE_THREAD) && (defined(_WINDOWS) || defined(_USE_THREAD_LOCAL)) +#if !defined(SINGLE_THREAD) // ================================== // ================================== // THREAD LOCAL VERSION