llvm doesn't care about your size
They apparently removed alloc_size at some point (it was a no-op beforehand), causing the attribute to throw an error when clang compiles anything including allocator.h.
This commit is contained in:
parent
9faa4cf675
commit
b1078c3d88
1 changed files with 14 additions and 3 deletions
|
|
@ -33,11 +33,22 @@ typedef struct HAllocator_ {
|
||||||
typedef struct HArena_ HArena ; // hidden implementation
|
typedef struct HArena_ HArena ; // hidden implementation
|
||||||
|
|
||||||
HArena *h_new_arena(HAllocator* allocator, size_t block_size); // pass 0 for default...
|
HArena *h_new_arena(HAllocator* allocator, size_t block_size); // pass 0 for default...
|
||||||
#ifndef SWIG
|
|
||||||
void* h_arena_malloc(HArena *arena, size_t count) __attribute__(( malloc, alloc_size(2) ));
|
#if defined __llvm__
|
||||||
|
# if __has_attribute(malloc)
|
||||||
|
# define ATTR_MALLOC(n) __attribute__((malloc))
|
||||||
|
# else
|
||||||
|
# define ATTR_MALLOC(n)
|
||||||
|
# endif
|
||||||
|
#elif defined SWIG
|
||||||
|
# define ATTR_MALLOC(n)
|
||||||
|
#elif defined __GNUC__
|
||||||
|
# define ATTR_MALLOC(n) __attribute__((malloc, alloc_size(2)))
|
||||||
#else
|
#else
|
||||||
void* h_arena_malloc(HArena *arena, size_t count);
|
# define ATTR_MALLOC(n)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
void* h_arena_malloc(HArena *arena, size_t count) ATTR_MALLOC(2);
|
||||||
void h_arena_free(HArena *arena, void* ptr); // For future expansion, with alternate memory managers.
|
void h_arena_free(HArena *arena, void* ptr); // For future expansion, with alternate memory managers.
|
||||||
void h_delete_arena(HArena *arena);
|
void h_delete_arena(HArena *arena);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue