Use a shorter/simpler license convention, stops the header taking so much space. Follow the SPDX license specification: https://spdx.org/licenses - C/C++/objc/objc++ - Python - Shell Scripts - CMake, GNUmakefile While most of the source tree has been included - `./extern/` was left out. - `./intern/cycles` & `./intern/atomic` are also excluded because they use different header conventions. doc/license/SPDX-license-identifiers.txt has been added to list SPDX all used identifiers. See P2788 for the script that automated these edits. Reviewed By: brecht, mont29, sergey Ref D14069
29 lines
1017 B
C++
29 lines
1017 B
C++
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
|
|
#pragma once
|
|
|
|
/* Clang defines this. */
|
|
#ifndef __has_feature
|
|
# define __has_feature(x) 0
|
|
#endif
|
|
|
|
#if (defined(__SANITIZE_ADDRESS__) || __has_feature(address_sanitizer)) && !defined(_MSC_VER)
|
|
# include "sanitizer/asan_interface.h"
|
|
#else
|
|
/* Ensure return value is used. Just using UNUSED_VARS results in a warning. */
|
|
# define ASAN_POISON_MEMORY_REGION(addr, size) (void)(0 && ((size) != 0 && (addr) != NULL))
|
|
# define ASAN_UNPOISON_MEMORY_REGION(addr, size) (void)(0 && ((size) != 0 && (addr) != NULL))
|
|
#endif
|
|
|
|
/**
|
|
* Mark a region of memory as "freed". When using address sanitizer, accessing the given memory
|
|
* region will cause an use-after-poison error. This can be used to find errors when dealing with
|
|
* uninitialized memory in custom containers.
|
|
*/
|
|
#define BLI_asan_poison(addr, size) ASAN_POISON_MEMORY_REGION(addr, size)
|
|
|
|
/**
|
|
* Mark a region of memory as usable again.
|
|
*/
|
|
#define BLI_asan_unpoison(addr, size) ASAN_UNPOISON_MEMORY_REGION(addr, size)
|