Add definition to support alloc_align attribute.

gcc 4.9 added support for new alignment attribute alloc_align:

The alloc_align attribute is used to tell the compiler that the function
return value points to memory, where the returned pointer minimum
alignment is given by one of the functions parameters. GCC uses this
information to improve pointer alignment analysis.

This attribute is not (yet) available on clang.
This commit is contained in:
Pedro F. Giffuni 2015-04-24 18:07:34 +00:00
parent 382abd8c81
commit e8968b7eaf

View File

@ -395,6 +395,12 @@
#define __alloc_size(x)
#endif
#if __has_attribute(alloc_align) || __GNUC_PREREQ__(4, 9)
#define __alloc_align(x) __attribute__((__alloc_align__(x)))
#else
#define __alloc_align(x)
#endif
/* XXX: should use `#if __STDC_VERSION__ < 199901'. */
#if !__GNUC_PREREQ__(2, 7) && !defined(__INTEL_COMPILER)
#define __func__ NULL