Allow gcc to know result is aligned

Someone on the internet found out gcc only understand posix_memalign.

The alloc_align attribute may be applied to a function that returns
a pointer and takes at least one argument of an integer or enumerated
type. It indicates that the returned pointer is aligned on a boundary
given by the function argument at position.

Change-Id: I4b0af6ef3020da1fb460652117286193d5d72f1e
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4514
Reviewed-by: Fredrik Holmqvist <[email protected]>
Reviewed-by: Adrien Destugues <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
Tested-by: Commit checker robot <[email protected]>
This commit is contained in:
Fredrik Holmqvist
2021-10-14 16:19:18 +00:00
committed by waddlesplash
parent 4a850ca730
commit 48eb7d981d
4 changed files with 9 additions and 7 deletions
+2 -2
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 Haiku, Inc. All Rights Reserved.
* Copyright 2002-2021 Haiku, Inc. All Rights Reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _STDLIB_H_
@@ -50,7 +50,7 @@ extern void free(void *pointer);
extern void *malloc(size_t size);
extern int posix_memalign(void **_pointer, size_t alignment, size_t size);
#ifdef _ISOC11_SOURCE
extern void *aligned_alloc(size_t alignment, size_t size);
extern void *aligned_alloc(size_t alignment, size_t size) _ALIGNED_BY_ARG(1);
#endif
extern void *realloc(void *oldPointer, size_t newSize);