Skip to content

Commit 9230769

Browse files
committed
Improve sanitizer detection
__has_feature(leak_sanitizer) cannot be used to detect the existence of LSan.
1 parent 9a9c055 commit 9230769

File tree

1 file changed

+2
-2
lines changed
  • system/include/emscripten

1 file changed

+2
-2
lines changed

system/include/emscripten/bind.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
#include <emscripten/val.h>
2727
#include <emscripten/wire.h>
2828

29-
#if __has_feature(leak_sanitizer) || __has_feature(address_sanitizer)
29+
#if defined(HAS_LSAN) || __has_feature(address_sanitizer)
3030
#include <sanitizer/lsan_interface.h>
3131
#endif
3232

@@ -716,7 +716,7 @@ template<typename T>
716716
inline T* getContext(const T& t) {
717717
// not a leak because this is called once per binding
718718
auto* ret = new T(t);
719-
#if __has_feature(leak_sanitizer) || __has_feature(address_sanitizer)
719+
#if defined(HAS_LSAN) || __has_feature(address_sanitizer)
720720
__lsan_ignore_object(ret);
721721
#endif
722722
return ret;

0 commit comments

Comments
 (0)