| 1 |
/* It seems there is no way to avoid the other source of mulitple |
| 2 |
source testcase from being compiled independently. Just avoid |
| 3 |
error. */ |
| 4 |
#ifdef DOJOB |
| 5 |
extern int a; |
| 6 |
void abort (void); |
| 7 |
|
| 8 |
#ifdef _PROFILE_USE |
| 9 |
__attribute__ ((externally_visible)) |
| 10 |
int constval=1,constval2=2; |
| 11 |
#else |
| 12 |
__attribute__ ((externally_visible)) |
| 13 |
int constval=3,constval2=2; |
| 14 |
#endif |
| 15 |
|
| 16 |
|
| 17 |
void |
| 18 |
add(int i) |
| 19 |
{ |
| 20 |
/* Verify that inlining happens for first case. */ |
| 21 |
if (i==constval && !__builtin_constant_p (i)) |
| 22 |
abort (); |
| 23 |
/* Second case has no dominating target; it should not inline. */ |
| 24 |
if (i==constval2 && __builtin_constant_p (i)) |
| 25 |
abort (); |
| 26 |
a += i; |
| 27 |
} |
| 28 |
void |
| 29 |
sub(int i) |
| 30 |
{ |
| 31 |
a -= i; |
| 32 |
} |
| 33 |
void |
| 34 |
add2(int i) |
| 35 |
{ |
| 36 |
a -= 2*i; |
| 37 |
} |
| 38 |
void |
| 39 |
sub2(int i) |
| 40 |
{ |
| 41 |
a -= 2*i; |
| 42 |
} |
| 43 |
void |
| 44 |
nothing(int i) |
| 45 |
{ |
| 46 |
a -= i; |
| 47 |
} |
| 48 |
__attribute__ ((externally_visible)) |
| 49 |
void (*p[5])(int)={add, sub, add2, sub2, nothing}; |
| 50 |
#else |
| 51 |
int |
| 52 |
main() |
| 53 |
{ |
| 54 |
return 0; |
| 55 |
} |
| 56 |
#endif |