Skip to content

24.08.1 - August 2024

Latest
Compare
Choose a tag to compare
@StableCoder StableCoder released this 25 Aug 05:10
95f2126

Full Changelog: 24.04.1...24.08

Sanitizer Scripts Rework

How sanitizers work has been completely changed internally.

Sanitizers and their options are now declared via calling the set_sanitizer_options() function, and applying sanitizers to be used is via the new add_sanitizer_support() call.

Whether sanitizers are available/supported is no longer a function of the script inferring via the compiler/platform, but instead by checking whether the flags are available on the compiler no matter the platform.

DEPRECATED

The ability to use sanitizers via the global USE_SANITIZER variable is now deprecated and will be removed in a future release.

To maintain the same behaviour after removal, add this to CMake scripts file after including the sanitizers file:

if(NOT MSVC)
    set(SANITIZER_LEGACY_DEFAULT_COMMON_OPTIONS -fno-omit-frame-pointer)
endif()

set_sanitizer_options(address DEFAULT ${SANITIZER_LEGACY_DEFAULT_COMMON_OPTIONS})
set_sanitizer_options(leak DEFAULT ${SANITIZER_LEGACY_DEFAULT_COMMON_OPTIONS})
set_sanitizer_options(memory DEFAULT ${SANITIZER_LEGACY_DEFAULT_COMMON_OPTIONS})
set_sanitizer_options(memorywithorigins DEFAULT SANITIZER memory
    -fsanitize-memory-track-origins ${SANITIZER_LEGACY_DEFAULT_COMMON_OPTIONS})
set_sanitizer_options(undefined DEFAULT ${SANITIZER_LEGACY_DEFAULT_COMMON_OPTIONS})
set_sanitizer_options(thread DEFAULT ${SANITIZER_LEGACY_DEFAULT_COMMON_OPTIONS})
set_sanitizer_options(cfi DEFAULT ${SANITIZER_LEGACY_DEFAULT_COMMON_OPTIONS})

set(USE_SANITIZER
      ""
      CACHE
        STRING
        "Compile with sanitizers. Available sanitizers are: ${SANITIZERS_AVAILABLE_LIST}"
)

if(USE_SANITIZER)
  add_sanitizer_support(${USE_SANITIZER})
endif()