Skip to content

Commit

Permalink
Suppress Sanitization Warning on Linux When Memory Leak Detection is …
Browse files Browse the repository at this point in the history
…Disabled

There is a warning in the `CppUTestConfig.h` on Linux platforms when building
with ASAN. The warning says to disable memory leak detection in order to get
rid of the warning with `-DCPPUTEST_MEM_LEAK_DETECTION_DISABLED`. However,
providing said define does not get rid of the warning. This prevents
compilation on Linux with ASAN + `-Werror`.
  • Loading branch information
hkpeprah committed Apr 4, 2024
1 parent 689b955 commit 8eed5b2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion include/CppUTest/CppUTestConfig.h
Expand Up @@ -146,7 +146,7 @@
#endif

#if CPPUTEST_SANITIZE_ADDRESS
#if defined(__linux__) && defined(__clang__) && CPPUTEST_USE_STD_CPP_LIB
#if defined(__linux__) && defined(__clang__) && CPPUTEST_USE_STD_CPP_LIB && CPPUTEST_USE_MEM_LEAK_DETECTION
#warning Compiling with Address Sanitizer with clang on linux may cause duplicate symbols for operator new. Turning off memory leak detection. Compile with -DCPPUTEST_MEM_LEAK_DETECTION_DISABLED to get rid of this warning.
#endif
#define CPPUTEST_DO_NOT_SANITIZE_ADDRESS __attribute__((no_sanitize_address))
Expand Down

0 comments on commit 8eed5b2

Please sign in to comment.