diff options
author | Mattias Andrée <maandree@operamail.com> | 2015-10-18 01:42:14 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2015-10-18 01:42:14 +0200 |
commit | 7c32232fa187a24520b957edeeb829fe8ab1a5be (patch) | |
tree | 724891b74cce94b8e68de77bfd1ba221cde8cc4f | |
parent | m (diff) | |
download | slibc-7c32232fa187a24520b957edeeb829fe8ab1a5be.tar.gz slibc-7c32232fa187a24520b957edeeb829fe8ab1a5be.tar.bz2 slibc-7c32232fa187a24520b957edeeb829fe8ab1a5be.tar.xz |
feature-test macros
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rw-r--r-- | include/malloc.h | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/include/malloc.h b/include/malloc.h index c2a340b..9ef95a0 100644 --- a/include/malloc.h +++ b/include/malloc.h @@ -21,7 +21,11 @@ #include <slibc/features.h> #ifndef _STDLIB_H -# warning "Do not directly include <malloc.h>, include <stdlib.h> instead." +# if defined(__PORTABLE) +# error "Do not directly include <malloc.h>, include <stdlib.h> instead." +# else +# warning "Do not directly include <malloc.h>, include <stdlib.h> instead." +# endif #endif @@ -145,7 +149,7 @@ void cfree(void*, ...) #endif -#if !defined(__PORTABLE) +#if defined(__GNU_SOURCE) || defined(__SLIBC_SOURCE) /** * Variant of `malloc` that returns an address with a * specified alignment. @@ -176,6 +180,7 @@ void* memalign(size_t, size_t) __GCC_ONLY(__attribute__((__malloc__, __warn_unused_result__))); #endif +#if (_POSIX_C_SOURCE >= 200112L) || (_XOPEN_SOURCE >= 600) /** * `posix_memalign(p, b, n)` is equivalent to * `(*p = memalign(b, n), *p ? 0 : errno)`, except @@ -195,8 +200,9 @@ void* memalign(size_t, size_t) */ int posix_memalign(void**, size_t, size_t) __GCC_ONLY(__attribute__((__nonnull__))); +#endif -#if !defined(__PORTABLE) +#if defined(_BSD_SOURCE) || defined(_XOPEN_SOURCE_EXTENDED) || defined(__SLIBC_SOURCE) /** * `valloc(n)` is equivalent to `memalign(sysconf(_SC_PAGESIZE), n)`. * |