Make use of GCC alloc_align attribute
This lets the compiler know about the alignment of pointers returned by aligned_alloc(3), posix_memalign(3). and contigmalloc(9) Currently this is only supported in recent gcc but we are ready to use it if clang implements it. Relnotes: yes
This commit is contained in:
parent
77ac67e29d
commit
ee90489bc4
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=282988
@ -156,7 +156,8 @@ _Noreturn void _Exit(int);
|
|||||||
* If we're in a mode greater than C99, expose C11 functions.
|
* If we're in a mode greater than C99, expose C11 functions.
|
||||||
*/
|
*/
|
||||||
#if __ISO_C_VISIBLE >= 2011 || __cplusplus >= 201103L
|
#if __ISO_C_VISIBLE >= 2011 || __cplusplus >= 201103L
|
||||||
void * aligned_alloc(size_t, size_t) __malloc_like __alloc_size(2);
|
void * aligned_alloc(size_t, size_t) __malloc_like __alloc_align(1)
|
||||||
|
__alloc_size(2);
|
||||||
int at_quick_exit(void (*)(void));
|
int at_quick_exit(void (*)(void));
|
||||||
_Noreturn void
|
_Noreturn void
|
||||||
quick_exit(int);
|
quick_exit(int);
|
||||||
@ -171,7 +172,7 @@ char *realpath(const char * __restrict, char * __restrict);
|
|||||||
int rand_r(unsigned *); /* (TSF) */
|
int rand_r(unsigned *); /* (TSF) */
|
||||||
#endif
|
#endif
|
||||||
#if __POSIX_VISIBLE >= 200112
|
#if __POSIX_VISIBLE >= 200112
|
||||||
int posix_memalign(void **, size_t, size_t) __nonnull(1)
|
int posix_memalign(void **, size_t, size_t) __nonnull(1) __alloc_align(2)
|
||||||
__alloc_size(3); /* (ADV) */
|
__alloc_size(3); /* (ADV) */
|
||||||
int setenv(const char *, const char *, int);
|
int setenv(const char *, const char *, int);
|
||||||
int unsetenv(const char *);
|
int unsetenv(const char *);
|
||||||
|
@ -174,7 +174,7 @@ void contigfree(void *addr, unsigned long size, struct malloc_type *type);
|
|||||||
void *contigmalloc(unsigned long size, struct malloc_type *type, int flags,
|
void *contigmalloc(unsigned long size, struct malloc_type *type, int flags,
|
||||||
vm_paddr_t low, vm_paddr_t high, unsigned long alignment,
|
vm_paddr_t low, vm_paddr_t high, unsigned long alignment,
|
||||||
vm_paddr_t boundary) __malloc_like __result_use_check
|
vm_paddr_t boundary) __malloc_like __result_use_check
|
||||||
__alloc_size(1);
|
__alloc_size(1) __alloc_align(6);
|
||||||
void free(void *addr, struct malloc_type *type);
|
void free(void *addr, struct malloc_type *type);
|
||||||
void *malloc(unsigned long size, struct malloc_type *type, int flags)
|
void *malloc(unsigned long size, struct malloc_type *type, int flags)
|
||||||
__malloc_like __result_use_check __alloc_size(1);
|
__malloc_like __result_use_check __alloc_size(1);
|
||||||
|
Loading…
Reference in New Issue
Block a user