mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 18:22:07 +00:00
Enable more sanitizers in make develop (#1588)
- `-fsanitize=undefined` encompasses multiple checks we were specifying - "detect_leaks=1" for `__asan_default_options` checks for memory leaks (except for with macOS clang++, which does not support LSan) - `-fsanitize=float-divide-by-zero` is an extra UBSan check (and reveals a UB bug to fix with fixed-point `DIV` and `LOG`)
This commit is contained in:
@@ -6,6 +6,21 @@
|
||||
|
||||
#include "helpers.hpp"
|
||||
|
||||
// We do not build `make develop` with `-fsanitize=leak` because macOS clang++ does not support it.
|
||||
// Instead, we enable ASan (`-fsanitize=address`) to check for memory leaks in all four programs.
|
||||
#ifdef __clang__
|
||||
#if __has_feature(address_sanitizer) && !defined(__SANITIZE_ADDRESS__)
|
||||
#define __SANITIZE_ADDRESS__
|
||||
#endif
|
||||
#endif
|
||||
#if defined(__SANITIZE_ADDRESS__) && !defined(__APPLE__)
|
||||
extern "C" {
|
||||
char const *__asan_default_options(void) {
|
||||
return "detect_leaks=1";
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// This variable is passed via `-D` from the Makefile, but not from CMake
|
||||
// (in which `configure_file()` is used on this file to replace some syntax)
|
||||
#ifndef BUILD_VERSION_STRING
|
||||
|
||||
Reference in New Issue
Block a user