diff options
author | pfg <pfg@FreeBSD.org> | 2015-05-15 20:43:37 +0000 |
---|---|---|
committer | pfg <pfg@FreeBSD.org> | 2015-05-15 20:43:37 +0000 |
commit | db5663c1319f9643adb1c81b78267d40d6e6ca06 (patch) | |
tree | 78736b63f6e1d139a25cf03249341ccbdbdf406c /include | |
parent | db0c7e7759b9b9c72247c978eee6b8d94c8bca42 (diff) | |
download | FreeBSD-src-db5663c1319f9643adb1c81b78267d40d6e6ca06.zip FreeBSD-src-db5663c1319f9643adb1c81b78267d40d6e6ca06.tar.gz |
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
Diffstat (limited to 'include')
-rw-r--r-- | include/stdlib.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/include/stdlib.h b/include/stdlib.h index a5ef0e7..d5506ff 100644 --- a/include/stdlib.h +++ b/include/stdlib.h @@ -156,7 +156,8 @@ _Noreturn void _Exit(int); * If we're in a mode greater than C99, expose C11 functions. */ #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)); _Noreturn void quick_exit(int); @@ -171,7 +172,7 @@ char *realpath(const char * __restrict, char * __restrict); int rand_r(unsigned *); /* (TSF) */ #endif #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) */ int setenv(const char *, const char *, int); int unsetenv(const char *); |