macros: add G_GNUC_NO_INLINE function attribute

https://bugzilla.gnome.org/show_bug.cgi?id=795180
This commit is contained in:
Christian Hergert 2018-04-13 18:34:30 -07:00 committed by Philip Withnall
parent 2fd0627326
commit ede5c3f8d9
3 changed files with 22 additions and 0 deletions

View File

@ -445,6 +445,7 @@ G_GNUC_NULL_TERMINATED
G_GNUC_WARN_UNUSED_RESULT
G_GNUC_FUNCTION
G_GNUC_PRETTY_FUNCTION
G_GNUC_NO_INLINE
G_GNUC_NO_INSTRUMENT
G_HAVE_GNUC_VISIBILITY
G_GNUC_INTERNAL

View File

@ -2048,6 +2048,25 @@
* See the GNU C documentation for more details.
*/
/**
* G_GNUC_NO_INLINE:
*
* Expands to the GNU C `noinline` function attribute if the compiler is gcc.
* If the compiler is not gcc, this macro expands to nothing.
*
* Declaring a function as `noinline` prevents the function from being
* considered for inlining.
*
* The attribute may be placed before the declaration, right before the
* `static` keyword.
*
* See the
* [GNU C documentation](https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-noinline-function-attribute)
* for more details.
*
* Since: 2.58
*/
/**
* G_GNUC_MALLOC:
*

View File

@ -97,9 +97,11 @@
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
#define G_GNUC_PURE __attribute__((__pure__))
#define G_GNUC_MALLOC __attribute__((__malloc__))
#define G_GNUC_NO_INLINE __attribute__((noinline))
#else
#define G_GNUC_PURE
#define G_GNUC_MALLOC
#define G_GNUC_NO_INLINE
#endif
#if __GNUC__ >= 4