glib-private: Fix MSVC build with AddressSanitizer

MSVC supports AddressSanitizer as well via "/fsanitize=address" option,
but __lsan_ignore_object() equivalent feature is not supported.
Note that there's __declspec(no_sanitize_address) specifier which
provides a similar feature but that's not runtime behavior
so it's not directly applicable to g_ignore_leak() family.

See also https://docs.microsoft.com/en-us/cpp/sanitizers/asan-building?view=msvc-160
This commit is contained in:
Seungha Yang 2021-10-13 17:28:48 +09:00
parent 32b4c53295
commit a2f2745035

View File

@ -23,8 +23,14 @@
#include "gstdioprivate.h"
/* gcc defines __SANITIZE_ADDRESS__, clang sets the address_sanitizer
* feature flag */
#if defined(__SANITIZE_ADDRESS__) || g_macro__has_feature(address_sanitizer)
* feature flag.
*
* MSVC defines __SANITIZE_ADDRESS__ as well when AddressSanitizer
* is enabled but __lsan_ignore_object() equivalent method is not supported
* See also
* https://docs.microsoft.com/en-us/cpp/sanitizers/asan-building?view=msvc-160
*/
#if !defined(_MSC_VER) && (defined(__SANITIZE_ADDRESS__) || g_macro__has_feature(address_sanitizer))
/*
* %_GLIB_ADDRESS_SANITIZER: