| 1 |
/* { dg-options "-DCE_EXTRACT_FUNCTIONS=func_f,g,h -DCE_NO_EXTERNALIZATION" }*/ |
| 2 |
|
| 3 |
|
| 4 |
#define noinline SHOULD_NOT_BE_IN_THE_FINAL_OUTPUT |
| 5 |
|
| 6 |
#undef noinline |
| 7 |
#define noinline __attribute__((__noinline__)) |
| 8 |
|
| 9 |
/* Do this sort of blurry definition to confuse out clang-extract into dumping |
| 10 |
the AST of the function. */ |
| 11 |
#define DEFINE_FUNCTION(name) noinline int func_##name(void) { return 0; } |
| 12 |
#define DEFINE_VARIABLE(name) int var_##name; |
| 13 |
#define DEFINE(f) DEFINE_VARIABLE(f) DEFINE_FUNCTION(f) |
| 14 |
|
| 15 |
noinline int g() |
| 16 |
{ |
| 17 |
return 1; |
| 18 |
} |
| 19 |
|
| 20 |
DEFINE(f); |
| 21 |
|
| 22 |
noinline int h() |
| 23 |
{ |
| 24 |
return 2; |
| 25 |
} |
| 26 |
|
| 27 |
|
| 28 |
#undef noinline |
| 29 |
#define noinline SHOULD_NOT_BE_IN_THE_FINAL_OUTPUT |
| 30 |
|
| 31 |
/* { dg-final { scan-tree-dump "__attribute__\(\(noinline\)\) int func_f|int func_f\(void\) __attribute__\(\(noinline\)\)" } } */ |
| 32 |
/* { dg-final { scan-tree-dump "#undef noinline" } } */ |
| 33 |
/* { dg-final { scan-tree-dump-not "SHOULD_NOT_BE_IN_THE_FINAL_OUTPUT" } } */ |