Skip to content

Commit

Permalink
tests models disabled thread_local for GCC
Browse files Browse the repository at this point in the history
  • Loading branch information
silverqx committed Aug 31, 2024
1 parent 252776a commit eb5e2aa
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,18 @@ add_test(NAME model_return_relation COMMAND model_return_relation)

include(TinyTestCommon)
tiny_configure_test(model_return_relation DEPENDS_ON_UNITTESTS INCLUDE_MODELS RUN_SERIAL)

# To avoid: error: redefinition of 'bool __tls_guard'
# Even the latest GCC v14.2.1 has still TLS wrapper related bugs if the class that
# defines the thread_local static is templated and polymorphic. 😞
# This is the only test case where this is happening and I didn't find any workaround
# after 8 hours of investigation.
# Only workaround I found is to #include the torrent_includeslist.hpp then it compiles,
# so I'm disabling the thread_local for this test case.
# See: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66944
# thread_local is already disabled on MSYS2 g++ so no need to target unix platform.
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
target_compile_definitions(model_return_relation
PRIVATE TINYORM_DISABLE_THREAD_LOCAL
)
endif()
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,15 @@ include($$TINYORM_SOURCE_TREE/tests/qmake/common.pri)
include($$TINYORM_SOURCE_TREE/tests/qmake/TinyUtils.pri)
include($$TINYORM_SOURCE_TREE/tests/models/models.pri)

# To avoid: error: redefinition of 'bool __tls_guard'
# Even the latest GCC v14.2.1 has still TLS wrapper related bugs if the class that
# defines the thread_local static is templated and polymorphic. 😞
# This is the only test case where this is happening and I didn't find any workaround
# after 8 hours of investigation.
# Only workaround I found is to #include the torrent_includeslist.hpp then it compiles,
# so I'm disabling the thread_local for this test case.
# See: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66944
# thread_local is already disabled on MSYS2 g++ so no need to target unix platform.
gcc:!clang: DEFINES *= TINYORM_DISABLE_THREAD_LOCAL

SOURCES += tst_model_return_relation.cpp

0 comments on commit eb5e2aa

Please sign in to comment.