mirror of
https://github.com/dart-lang/sdk
synced 2024-10-14 09:01:42 +00:00
1eae028526
Unfortunately we cannot enable -Wzero-as-null-pointer-constant because of zlib and icu headers we include. TEST=build Change-Id: I9ffd7d7e26f2b3dd616ce54d164b92e60a2366dc Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/293882 Commit-Queue: Ryan Macnak <rmacnak@google.com> Reviewed-by: Alexander Aprelev <aam@google.com>
33 lines
1.4 KiB
C
33 lines
1.4 KiB
C
// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
|
|
// for details. All rights reserved. Use of this source code is governed by a
|
|
// BSD-style license that can be found in the LICENSE file.
|
|
|
|
#ifndef RUNTIME_PLATFORM_LEAK_SANITIZER_H_
|
|
#define RUNTIME_PLATFORM_LEAK_SANITIZER_H_
|
|
|
|
#include "platform/globals.h"
|
|
|
|
#if defined(__has_feature)
|
|
#if __has_feature(leak_sanitizer) || __has_feature(address_sanitizer)
|
|
#define USING_LEAK_SANITIZER
|
|
#endif
|
|
#endif
|
|
|
|
#if defined(USING_LEAK_SANITIZER)
|
|
extern "C" void __lsan_register_root_region(const void* p, size_t size);
|
|
extern "C" void __lsan_unregister_root_region(const void* p, size_t size);
|
|
#define LSAN_REGISTER_ROOT_REGION(ptr, len) \
|
|
__lsan_register_root_region(ptr, len)
|
|
#define LSAN_UNREGISTER_ROOT_REGION(ptr, len) \
|
|
__lsan_unregister_root_region(ptr, len)
|
|
#else // defined(USING_LEAK_SANITIZER)
|
|
#define LSAN_REGISTER_ROOT_REGION(ptr, len) \
|
|
do { \
|
|
} while (false && (ptr) == nullptr && (len) == 0)
|
|
#define LSAN_UNREGISTER_ROOT_REGION(ptr, len) \
|
|
do { \
|
|
} while (false && (ptr) == nullptr && (len) == 0)
|
|
#endif // defined(USING_LEAK_SANITIZER)
|
|
|
|
#endif // RUNTIME_PLATFORM_LEAK_SANITIZER_H_
|