mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-10 12:30:11 +01:00
util: add DECLARE_LINEAR_ZALLOC with no sanitize
This specific macro allow to create a new() operator version with a sanitizer flag disabled. Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com> Reviewed-by: Yonggang Luo <luoyonggang@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36884>
This commit is contained in:
parent
1c2aa6f5c3
commit
fa25e2de48
1 changed files with 10 additions and 3 deletions
|
|
@ -566,8 +566,9 @@ public: \
|
|||
DECLARE_RALLOC_CXX_OPERATORS_TEMPLATE(type, rzalloc_size)
|
||||
|
||||
|
||||
#define DECLARE_LINEAR_ALLOC_CXX_OPERATORS_TEMPLATE(TYPE, ALLOC_FUNC, new_cmd, new_array_cmd) \
|
||||
#define DECLARE_LINEAR_ALLOC_CXX_OPERATORS_TEMPLATE(TYPE, ALLOC_FUNC, new_cmd, new_array_cmd, ATTRIBUTE) \
|
||||
public: \
|
||||
ATTRIBUTE \
|
||||
static void* operator new(size_t size, linear_ctx *ctx) \
|
||||
{ \
|
||||
void *p = ALLOC_FUNC(ctx, size); \
|
||||
|
|
@ -575,6 +576,7 @@ public: \
|
|||
new_cmd \
|
||||
return p; \
|
||||
} \
|
||||
ATTRIBUTE \
|
||||
static void* operator new[](size_t size, linear_ctx *ctx) \
|
||||
{ \
|
||||
void *p = ALLOC_FUNC(ctx, size); \
|
||||
|
|
@ -585,11 +587,16 @@ public: \
|
|||
|
||||
#define DECLARE_LINEAR_ALLOC_CXX_OPERATORS(type, new_cmd, new_array_cmd) \
|
||||
DECLARE_LINEAR_ALLOC_CXX_OPERATORS_TEMPLATE(type, linear_alloc_child, \
|
||||
new_cmd, new_array_cmd)
|
||||
new_cmd, new_array_cmd,)
|
||||
|
||||
#define DECLARE_LINEAR_ZALLOC_CXX_OPERATORS(type, new_cmd, new_array_cmd) \
|
||||
DECLARE_LINEAR_ALLOC_CXX_OPERATORS_TEMPLATE(type, linear_zalloc_child, \
|
||||
new_cmd, new_array_cmd)
|
||||
new_cmd, new_array_cmd,)
|
||||
|
||||
#define DECLARE_LINEAR_ZALLOC_CXX_OPERATORS_NO_SANITIZE(type, new_cmd, new_array_cmd, FLAG) \
|
||||
DECLARE_LINEAR_ALLOC_CXX_OPERATORS_TEMPLATE(type, linear_zalloc_child, \
|
||||
new_cmd, new_array_cmd, \
|
||||
ATTRIBUTE_NO_SANITIZE_##FLAG)
|
||||
|
||||
typedef struct linear_ctx linear_ctx;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue