FreeBSD compat. __alloc_size(), __alloc_align()

Restore FreeBSD compatibility for __alloc_size() and __alloc_align().

This is a follow-up to commit e494b56035.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
This commit is contained in:
Sebastian Huber 2018-07-26 10:36:06 +02:00
parent 271e856a49
commit a31a7bad6a
2 changed files with 5 additions and 5 deletions

View File

@ -140,7 +140,7 @@ void qsort (void *__base, size_t __nmemb, size_t __size, __compar_fn_t _compar);
int rand (void); int rand (void);
void * realloc (void *__r, size_t __size) _NOTHROW; void * realloc (void *__r, size_t __size) _NOTHROW;
#if __BSD_VISIBLE #if __BSD_VISIBLE
void *reallocarray(void *, size_t, size_t) __result_use_check __alloc_size((2,3)); void *reallocarray(void *, size_t, size_t) __result_use_check __alloc_size2(2, 3);
void * reallocf (void *__r, size_t __size); void * reallocf (void *__r, size_t __size);
#endif #endif
#if __BSD_VISIBLE || __XSI_VISIBLE >= 4 #if __BSD_VISIBLE || __XSI_VISIBLE >= 4
@ -324,8 +324,8 @@ extern long double strtold (const char *__restrict, char **__restrict);
* 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 #if __ISO_C_VISIBLE >= 2011
void * aligned_alloc(size_t, size_t) __malloc_like __alloc_align((1)) void * aligned_alloc(size_t, size_t) __malloc_like __alloc_align(1)
__alloc_size((2)); __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);

View File

@ -249,14 +249,14 @@
#define __section(x) __attribute__((__section__(x))) #define __section(x) __attribute__((__section__(x)))
#endif #endif
#if __GNUC_PREREQ__(4, 3) || __has_attribute(__alloc_size__) #if __GNUC_PREREQ__(4, 3) || __has_attribute(__alloc_size__)
#define __alloc_size(x) __attribute__((__alloc_size__ x)) #define __alloc_size(x) __attribute__((__alloc_size__(x)))
#define __alloc_size2(n, x) __attribute__((__alloc_size__(n, x))) #define __alloc_size2(n, x) __attribute__((__alloc_size__(n, x)))
#else #else
#define __alloc_size(x) #define __alloc_size(x)
#define __alloc_size2(n, x) #define __alloc_size2(n, x)
#endif #endif
#if __GNUC_PREREQ__(4, 9) || __has_attribute(__alloc_align__) #if __GNUC_PREREQ__(4, 9) || __has_attribute(__alloc_align__)
#define __alloc_align(x) __attribute__((__alloc_align__ x)) #define __alloc_align(x) __attribute__((__alloc_align__(x)))
#else #else
#define __alloc_align(x) #define __alloc_align(x)
#endif #endif