# > only necessary for options set for build types
cvc4_option(ENABLE_ASAN "Enable ASAN build")
cvc4_option(ENABLE_UBSAN "Enable UBSan build")
+cvc4_option(ENABLE_TSAN "Enable TSan build")
cvc4_option(ENABLE_ASSERTIONS "Enable assertions")
cvc4_option(ENABLE_COMP_INC_TRACK
"Enable optimizations for incremental SMT-COMP tracks")
# to cmake standards (first letter uppercase).
set(BUILD_TYPES Production Debug Testing Competition)
-if(ENABLE_ASAN OR ENABLE_UBSAN)
+if(ENABLE_ASAN OR ENABLE_UBSAN OR ENABLE_TSAN)
set(CMAKE_BUILD_TYPE Debug)
endif()
add_definitions(-DCVC4_USE_UBSAN)
endif()
+if(ENABLE_TSAN)
+ # -fsanitize=thread requires CMAKE_REQUIRED_FLAGS to be explicitely set,
+ # otherwise the -fsanitize=thread check will fail while linking.
+ set(CMAKE_REQUIRED_FLAGS -fsanitize=thread)
+ add_required_c_cxx_flag("-fsanitize=thread")
+ unset(CMAKE_REQUIRED_FLAGS)
+endif()
+
if(ENABLE_ASSERTIONS)
add_definitions(-DCVC4_ASSERTIONS)
else()
print_config("Statistics :" ENABLE_STATISTICS)
print_config("Tracing :" ENABLE_TRACING)
message("")
-print_config("Asan :" ENABLE_ASAN)
+print_config("ASan :" ENABLE_ASAN)
+print_config("UBSan :" ENABLE_UBSAN)
+print_config("TSan :" ENABLE_TSAN)
print_config("Coverage (gcov) :" ENABLE_COVERAGE)
print_config("Profiling (gprof) :" ENABLE_PROFILING)
print_config("Unit tests :" ENABLE_UNIT_TESTING)
--python3 prefer using Python 3 (also for Python bindings)
--asan build with ASan instrumentation
--ubsan build with UBSan instrumentation
+ --tsan build with TSan instrumentation
The following options configure parameterized features.
abc=default
asan=default
ubsan=default
+tsan=default
assertions=default
best=default
cadical=default
--ubsan) ubsan=ON;;
--no-ubsan) ubsan=OFF;;
+ --tsan) tsan=ON;;
+ --no-tsan) tsan=OFF;;
+
--assertions) assertions=ON;;
--no-assertions) assertions=OFF;;
&& cmake_opts="$cmake_opts -DENABLE_ASAN=$asan"
[ $ubsan != default ] \
&& cmake_opts="$cmake_opts -DENABLE_UBSAN=$ubsan"
+[ $tsan != default ] \
+ && cmake_opts="$cmake_opts -DENABLE_TSAN=$tsan"
[ $assertions != default ] \
&& cmake_opts="$cmake_opts -DENABLE_ASSERTIONS=$assertions"
[ $best != default ] \
bool Configuration::isUbsanBuild() { return IS_UBSAN_BUILD; }
+bool Configuration::isTsanBuild() { return IS_TSAN_BUILD; }
+
bool Configuration::isCompetitionBuild() {
return IS_COMPETITION_BUILD;
}
static bool isUbsanBuild();
+ static bool isTsanBuild();
+
static bool isCompetitionBuild();
static std::string getPackageName();
#define IS_UBSAN_BUILD false
#endif /* CVC4_USE_UBSAN */
+#define IS_TSAN_BUILD false
+
+// GCC test
+#if defined(__SANITIZE_THREAD__)
+#undef IS_TSAN_BUILD
+#define IS_TSAN_BUILD true
+#endif /* defined(__SANITIZE_THREAD__) */
+
+// Clang test
+#if defined(__has_feature)
+#if __has_feature(thread_sanitizer)
+#undef IS_TSAN_BUILD
+#define IS_TSAN_BUILD true
+#endif /* __has_feature(thread_sanitizer) */
+#endif /* defined(__has_feature) */
+
}/* CVC4 namespace */
#endif /* CVC4__CONFIGURATION_PRIVATE_H */
print_config_cond("profiling", Configuration::isProfilingBuild());
print_config_cond("asan", Configuration::isAsanBuild());
print_config_cond("ubsan", Configuration::isUbsanBuild());
+ print_config_cond("tsan", Configuration::isTsanBuild());
print_config_cond("competition", Configuration::isCompetitionBuild());
std::cout << std::endl;