mirror of
https://github.com/gbdev/rgbds.git
synced 2026-09-22 21:57:07 +00:00
Enable our default ASan flags on macOS
Except for the leak detection (Clang complains it's not supported there), for which I have corrected the comment and its location.
This commit is contained in:
+4
-3
@@ -4,19 +4,20 @@
|
||||
|
||||
#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(NDEBUG) && defined(__SANITIZE_ADDRESS__) && !defined(__APPLE__)
|
||||
#if !defined(NDEBUG) && defined(__SANITIZE_ADDRESS__)
|
||||
extern "C" {
|
||||
char const *__asan_default_options(void) {
|
||||
return ":check_initialization_order=1"
|
||||
":detect_invalid_pointer_pairs=2"
|
||||
// `detect_leaks` is not supported on macOS.
|
||||
#ifndef __APPLE__
|
||||
":detect_leaks=1"
|
||||
#endif
|
||||
":detect_stack_use_after_return=1"
|
||||
// ":fast_unwind_on_malloc=0" // Enable this if ASan outputs bad backtraces
|
||||
":print_legend=0"
|
||||
|
||||
Reference in New Issue
Block a user