Daily bump.
[gcc.git] / gcc / testsuite / g++.dg / torture / builtin-location.C
blob6dd94b25deeb1f9236ccdd01f612e20aa1d7bb1a
1 // { dg-do run }
2 // { dg-skip-if "requires hosted libstdc++ for cstring" { ! hostedlib } }
4 #include <cstring>
6 const char *gfile;
7 const char *gfn;
8 int gline;
10 void bar (const char *file = __builtin_FILE (),
11           const char *function = __builtin_FUNCTION (),
12           int line = __builtin_LINE ())
14   gfile = file;
15   gfn = function;
16   gline = line;
19 extern "C" void abort (void);
21 int main()
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;