svn commit: r281945 - head/sys/sys

Pedro F. Giffuni pfg at FreeBSD.org
Fri Apr 24 18:07:35 UTC 2015


Author: pfg
Date: Fri Apr 24 18:07:34 2015
New Revision: 281945
URL: https://svnweb.freebsd.org/changeset/base/281945

Log:
  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.

Modified:
  head/sys/sys/cdefs.h

Modified: head/sys/sys/cdefs.h
==============================================================================
--- head/sys/sys/cdefs.h	Fri Apr 24 17:36:26 2015	(r281944)
+++ head/sys/sys/cdefs.h	Fri Apr 24 18:07:34 2015	(r281945)
@@ -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


More information about the svn-src-head mailing list