From owner-svn-src-head@FreeBSD.ORG Fri May 15 19:51:06 2015 Return-Path: <owner-svn-src-head@FreeBSD.ORG> Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id DA81AE57; Fri, 15 May 2015 19:51:06 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B09301BB9; Fri, 15 May 2015 19:51:06 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4FJp6bk043074; Fri, 15 May 2015 19:51:06 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4FJp6Gj043073; Fri, 15 May 2015 19:51:06 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201505151951.t4FJp6Gj043073@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" <pfg@FreeBSD.org> Date: Fri, 15 May 2015 19:51:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r282987 - head/sys/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current <svn-src-head.freebsd.org> List-Unsubscribe: <http://lists.freebsd.org/mailman/options/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/> List-Post: <mailto:svn-src-head@freebsd.org> List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help> List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>, <mailto:svn-src-head-request@freebsd.org?subject=subscribe> X-List-Received-Date: Fri, 15 May 2015 19:51:07 -0000 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__)) +#else +#define __gnu_inline +#endif + /* Compiler-dependent macros that rely on FreeBSD-specific extensions. */ #if defined(__FreeBSD_cc_version) && __FreeBSD_cc_version >= 300001 && \ defined(__GNUC__) && !defined(__INTEL_COMPILER)