From: H. P. A. <hp...@zy...> - 2016-10-08 04:39:25
|
On 10/07/16 21:35, H. Peter Anvin wrote: > > What happens if you do, given that it defined __GNUC__ and therefore > claims to be compatible with gcc? > +#if defined(__clang__) +# define never_null __attribute__((returns_nonnull)) +# define safe_alloc never_null __attribute__((malloc)) +# define safe_malloc(s) +# define safe_malloc2(s1,s2) +# define safe_realloc(s) The latter should be safe_alloc and never_null as appropriate, though, even if alloc_size() isn't defined. Alternatively, we could define allocsize() as a macro... but that's probably more trouble than it's worth. -hpa |