Skip to content

Commit

Permalink
Use ASAN_OPTIONS=detect_leaks=1 instead of -fsanitize=leak
Browse files Browse the repository at this point in the history
  • Loading branch information
Rangi42 committed Dec 30, 2024
1 parent 026ce71 commit b29daa6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ else()
add_compile_options(-Wno-gnu-zero-variadic-macro-arguments)
endif()
if(SANITIZERS)
set(SAN_FLAGS -fsanitize=address -fsanitize=leak -fsanitize=undefined)
set(SAN_FLAGS -fsanitize=address -fsanitize=undefined)
add_compile_options(${SAN_FLAGS})
add_link_options(${SAN_FLAGS})
add_definitions(-D_GLIBCXX_ASSERTIONS)
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ develop:
-Wno-format-nonliteral -Wno-strict-overflow -Wno-unused-but-set-variable \
-Wno-type-limits -Wno-tautological-constant-out-of-range-compare -Wvla \
-D_GLIBCXX_ASSERTIONS \
-fsanitize=address -fsanitize=leak -fsanitize=undefined" \
-fsanitize=address -fsanitize=undefined" \
CXXFLAGS="-ggdb3 -Og -fno-omit-frame-pointer -fno-optimize-sibling-calls"

# This target is used during development in order to more easily debug with gdb.
Expand Down
4 changes: 4 additions & 0 deletions test/run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ if [[ ! ( -x ../rgbasm && -x ../rgblink && -x ../rgbfix && -x ../rgbgfx ) ]]; th
false
fi

# We do not compile with `-fsanitize=leak` because macOS clang++ does not support it.
# Instead, enable ASan (`-fsanitize=address`) to check for memory leaks.
export ASAN_OPTIONS=detect_leaks=1

# Tests included with the repository

for dir in asm link fix gfx; do
Expand Down

0 comments on commit b29daa6

Please sign in to comment.