| 1 |
// { dg-do run } |
| 2 |
// { dg-skip-if "requires hosted libstdc++ for cstring" { ! hostedlib } } |
| 3 |
|
| 4 |
#include <cstring> |
| 5 |
|
| 6 |
const char *gfile; |
| 7 |
const char *gfn; |
| 8 |
int gline; |
| 9 |
|
| 10 |
void bar (const char *file = __builtin_FILE (), |
| 11 |
const char *function = __builtin_FUNCTION (), |
| 12 |
int line = __builtin_LINE ()) |
| 13 |
{ |
| 14 |
gfile = file; |
| 15 |
gfn = function; |
| 16 |
gline = line; |
| 17 |
} |
| 18 |
|
| 19 |
extern "C" void abort (void); |
| 20 |
|
| 21 |
int main() |
| 22 |
{ |
| 23 |
int here; |
| 24 |
bar (); here = __LINE__; |
| 25 |
if (std::strcmp (gfn, __FUNCTION__) != 0) |
| 26 |
abort (); |
| 27 |
if (std::strcmp (gfile, __FILE__) != 0) |
| 28 |
abort (); |
| 29 |
if (gline != here) |
| 30 |
abort (); |
| 31 |
return 0; |
| 32 |
} |