mirror of
https://github.com/thunderbrewhq/thunderbrew
synced 2025-07-06 01:27:59 +03:00
fix(build): correctly disable sanitizers in zig build script when WHOA_UB_SAN is false or release mode is not debug
This commit is contained in:
parent
1b4f1dba86
commit
b93c615368
@ -67,6 +67,8 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "GNU
|
|||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=undefined")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=undefined")
|
||||||
# Allow strange alignments
|
# Allow strange alignments
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-sanitize=alignment")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-sanitize=alignment")
|
||||||
|
# Make encountering UB an unrecoverable error
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-sanitize-recover=all")
|
||||||
else()
|
else()
|
||||||
# Disable UBsan completely
|
# Disable UBsan completely
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-sanitize=undefined")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-sanitize=undefined")
|
||||||
|
@ -111,9 +111,11 @@ pub fn build(b: *std.Build) void {
|
|||||||
if (ub_san) {
|
if (ub_san) {
|
||||||
// Disable UBsan alignment checks only
|
// Disable UBsan alignment checks only
|
||||||
whoa_compiler_flags_list.append("-fno-sanitize=alignment") catch {};
|
whoa_compiler_flags_list.append("-fno-sanitize=alignment") catch {};
|
||||||
|
whoa_compiler_flags_list.append("-fno-sanitize=float-cast-overflow") catch {};
|
||||||
|
whoa_compiler_flags_list.append("-fno-sanitize=signed-integer-overflow") catch {};
|
||||||
} else {
|
} else {
|
||||||
// Disable UBsan
|
// Disable UBsan
|
||||||
whoa_compiler_flags_list.append("-fsanitize=undefined") catch {};
|
whoa_compiler_flags_list.append("-fno-sanitize=all") catch {};
|
||||||
}
|
}
|
||||||
|
|
||||||
var build_gll = false;
|
var build_gll = false;
|
||||||
|
Loading…
Reference in New Issue
Block a user