From a060462ff615e24f0aa56f88639f003c7bcfe0df Mon Sep 17 00:00:00 2001 From: David CARLIER Date: Sun, 25 Sep 2022 07:26:59 +0100 Subject: [PATCH] annotate `alloc` on unixes. (#548) * annotate `alloc` on unixes. * changes from feedback --- src/snmalloc/mem/localalloc.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/snmalloc/mem/localalloc.h b/src/snmalloc/mem/localalloc.h index 973b4d9..82d75da 100644 --- a/src/snmalloc/mem/localalloc.h +++ b/src/snmalloc/mem/localalloc.h @@ -1,7 +1,9 @@ #pragma once -#ifdef _MSC_VER -# define ALLOCATOR __declspec(allocator) +#if defined(_MSC_VER) +# define ALLOCATOR __declspec(allocator) __declspec(restrict) +#elif __has_attribute(malloc) +# define ALLOCATOR __attribute__((malloc)) #else # define ALLOCATOR #endif