| 1 |
/* Test __attribute__((gnu_inline)). |
| 2 |
|
| 3 |
Check that __attribute__((gnu_inline)) has no effect, in the |
| 4 |
absence of extern and/or inline. |
| 5 |
|
| 6 |
Check that we don't get out-of-line definitions for extern inline |
| 7 |
gnu_inline functions, regardless of declarations or definitions. |
| 8 |
|
| 9 |
Check that such functions can be overridden by out-of-line |
| 10 |
definitions. |
| 11 |
|
| 12 |
*/ |
| 13 |
|
| 14 |
/* { dg-do compile } */ |
| 15 |
/* { dg-options "-O" } */ // such that static functions are optimized out |
| 16 |
/* { dg-final { scan-assembler "func1" } } */ |
| 17 |
/* { dg-final { scan-assembler "func2" } } */ |
| 18 |
/* { dg-final { scan-assembler-not "func3" } } */ |
| 19 |
/* { dg-final { scan-assembler "func4" } } */ |
| 20 |
/* { dg-final { scan-assembler-not "func5" } } */ |
| 21 |
|
| 22 |
#include "gnu-inline-common.h" |
| 23 |
|
| 24 |
#undef fn |
| 25 |
#define fn pfx(func1) // must be emitted out-of-line |
| 26 |
gnuindef(fn, 0) |
| 27 |
def(, fn, 2) |
| 28 |
|
| 29 |
#undef fn |
| 30 |
#define fn pfx(func2) // must be emitted out-of-line |
| 31 |
decl(extern, fn) |
| 32 |
gnuindef(fn, 0) |
| 33 |
def(, fn, 2) |
| 34 |
|
| 35 |
#undef fn |
| 36 |
#define fn pfx(func3) // must not be emitted |
| 37 |
decl(extern, fn) |
| 38 |
gnuindef(fn, 0) |
| 39 |
|
| 40 |
#undef fn |
| 41 |
#define fn pfx(func4) // must be emitted out-of-line |
| 42 |
decl(extern, fn) |
| 43 |
gnuindef(fn, 0) |
| 44 |
def(, fn, 1) |
| 45 |
|
| 46 |
#undef fn |
| 47 |
#define fn pfx(func5) // must NOT be emitted, because it's static and unused |
| 48 |
decl(static, fn) |
| 49 |
gnuindef(fn, 0) |
| 50 |
def(, fn, 1) |