Merge "Restore attribute alloc_size for GCC."

This commit is contained in:
Treehugger Robot 2016-08-01 17:27:36 +00:00 committed by Gerrit Code Review
commit c5e79567e0
1 changed files with 10 additions and 4 deletions

View File

@ -23,12 +23,18 @@
__BEGIN_DECLS
void* malloc(size_t byte_count) __mallocfunc __wur;
void* calloc(size_t item_count, size_t item_size) __mallocfunc __wur;
void* realloc(void* p, size_t byte_count) __wur;
#if defined(__clang__)
#define __BIONIC_ALLOC_SIZE(...) /* clang doesn't support attribute alloc_size. */
#else
#define __BIONIC_ALLOC_SIZE(...) __attribute__((__alloc_size__(__VA_ARGS__)))
#endif
void* malloc(size_t byte_count) __mallocfunc __BIONIC_ALLOC_SIZE(1) __wur;
void* calloc(size_t item_count, size_t item_size) __mallocfunc __BIONIC_ALLOC_SIZE(1,2) __wur;
void* realloc(void* p, size_t byte_count) __BIONIC_ALLOC_SIZE(2) __wur;
void free(void* p);
void* memalign(size_t alignment, size_t byte_count) __mallocfunc __wur;
void* memalign(size_t alignment, size_t byte_count) __mallocfunc __BIONIC_ALLOC_SIZE(2) __wur;
size_t malloc_usable_size(const void* p) __INTRODUCED_IN(17);
#ifndef STRUCT_MALLINFO_DECLARED