Skip to content

Commit

Permalink
add alloc_size to xmalloc
Browse files Browse the repository at this point in the history
  • Loading branch information
uecker committed Sep 2, 2024
1 parent 97d69a1 commit 3d84cd8
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/misc/misc.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,15 @@

#include "misc/cppwrap.h"

extern void* xmalloc(size_t s);
#ifndef alloc_size
#ifndef __clang__
#define alloc_size(x) [[gnu::alloc_size(x)]]
#else
#define alloc_size(x)
#endif
#endif

extern void* xmalloc(size_t s) alloc_size(1);
extern void xfree(const void*);
extern void warn_nonnull_ptr(void*);

Expand Down

0 comments on commit 3d84cd8

Please sign in to comment.