Skip to content

Commit

Permalink
Enable thread_local code more broadly.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
waywardmonkeys authored and NikolajBjorner committed Aug 2, 2022
1 parent 82d853e commit 9a99c78
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 6 deletions.
3 changes: 0 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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_")
Expand Down
2 changes: 0 additions & 2 deletions scripts/mk_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/util/memory_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9a99c78

Please sign in to comment.