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
View File
@@ -84,9 +84,11 @@
__attribute__((format(__printf__, _format_, _args_)))
#if __GNUC__ >= 4
# define _ALIGNED_BY_ARG(_no_) __attribute__((alloc_align(_no_)))
# define _EXPORT __attribute__((visibility("default")))
# define B_ALWAYS_INLINE __attribute__((always_inline)) inline
#else
# define _ALIGNED_BY_ARG(_no_)
# define _EXPORT
#endif
#define _IMPORT