From 61c0e17fd86388bcd6f7df96eb06026feaccc810 Mon Sep 17 00:00:00 2001 From: Camden Dixie O'Brien Date: Thu, 2 Jan 2025 17:13:39 +0000 Subject: [PATCH] Remove ASAN from sanitizers config SDL2 seems to use some unintialized memory in SDL_Init() so ASAN just kills the program right away if it's enabled (sad). UBSAN is still very useful in its own right, though, so makes sense to have an option to enable only that. --- CMakeLists.txt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 72027c2..2a48c44 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.10) project(epec-mcu-emulator LANGUAGES C) option(WERROR "Treat warnings as errors" OFF) -option(SANITIZERS "Enable memory and undefined behaviour sanitizers" OFF) +option(UBSAN "Enable undefined behaviour sanitizer" OFF) option(PERFMON "Monitor performance of game code" ON) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) @@ -12,12 +12,12 @@ macro(set_default_target_options target) set_property(TARGET ${target} PROPERTY C_STANDARD 11) set_property(TARGET ${target} PROPERTY C_EXTENSIONS OFF) target_compile_options(${target} PRIVATE -Wall -Wextra -pedantic) - if (${WERROR}) + if(${WERROR}) target_compile_options(${target} PRIVATE -Werror) endif() - if (${SANITIZERS}) - target_compile_options(${target} PRIVATE -fsanitize=memory,undefined) - target_link_options(${target} PRIVATE -fsanitize=memory,undefined) + if(${UBSAN}) + target_compile_options(${target} PRIVATE -fsanitize=undefined) + target_link_options(${target} PRIVATE -fsanitize=undefined) endif() endmacro()