Date: Fri, 15 May 2015 16:35:04 -0400 From: John Baldwin <jhb@freebsd.org> To: "Pedro F. Giffuni" <pfg@freebsd.org> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r282987 - head/sys/sys Message-ID: <2535986.nxztlW3efp@ralph.baldwin.cx> In-Reply-To: <201505151951.t4FJp6Gj043073@svn.freebsd.org> References: <201505151951.t4FJp6Gj043073@svn.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Friday, May 15, 2015 07:51:06 PM Pedro F. Giffuni wrote: > Author: pfg > Date: Fri May 15 19:51:05 2015 > New Revision: 282987 > URL: https://svnweb.freebsd.org/changeset/base/282987 > > Log: > Break apart the gnu_inline attribute and use "artificial" if available. > > In general it is bad practice to use the gnu_inline attribute but we > will need it in special cases like FORTIFY_SOURCE. In this specific > case it is also useful to have the "artificial" attribute: > > "This attribute is useful for small inline wrappers which if possible > should appear during debugging as a unit, depending on the debug info > format it will either mean marking the function as artificial or using the > caller location for all instructions within the inlined body." > > This attribute appears to be currently implemented only in GCC. Use it > only in conjuntion with gnu_inline in the cases where it is available, > which is similar in spirit in how it's used in glibc. > > Modified: > head/sys/sys/cdefs.h > > Modified: head/sys/sys/cdefs.h > ============================================================================== > --- head/sys/sys/cdefs.h Fri May 15 19:37:17 2015 (r282986) > +++ head/sys/sys/cdefs.h Fri May 15 19:51:05 2015 (r282987) > @@ -375,10 +375,8 @@ > #endif > > #if __GNUC_PREREQ__(4, 1) > -#define __gnu_inline __attribute__((__gnu_inline__)) > #define __returns_twice __attribute__((__returns_twice__)) > #else > -#define __gnu_inline > #define __returns_twice > #endif > > @@ -538,6 +536,21 @@ > __attribute__((__format__ (__strftime__, fmtarg, firstvararg))) > #endif > > +/* > + * FORTIFY_SOURCE, and perhaps other compiler-specific features, require > + * the use of non-standard inlining. In general we should try to avoid > + * using these but GCC-compatible compilers tend to support the extensions > + * well enough to use them in limited cases. > + */ > +#if __GNUC_PREREQ__(4, 1) > +#if __has_attribute(artificial) || __GNUC_PREREQ__(4, 3) > +#define __gnu_inline __attribute__((__gnu_inline__, __artificial__)) > +#else > +#define __gnu_inline __attribute__((__gnu_inline__)) ^^^^ missing an #endif here? I'm getting this error from buildworld: /usr/obj/usr/src/tmp/usr/include/sys/cdefs.h:550:2: error: #else after #else #else ^ /usr/obj/usr/src/tmp/usr/include/sys/cdefs.h:36:2: error: unterminated conditional directive #ifndef _SYS_CDEFS_H_ ^ 14 errors generated. mkdep: compile failed -- John Baldwin
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?2535986.nxztlW3efp>