2 // Test whether __PRETTY_FUNCTION__ works in templates, functions and
3 // in initializers at global scope
7 extern "C" void __assert_fail (const char *, const char *,
8 unsigned int, const char *)
9 throw() __attribute__((noreturn));
10 extern "C" void abort (void);
11 extern "C" void exit (int);
13 #define str(expr) #expr
14 #define assert(expr) \
15 ((expr) ? 0 : (__assert_fail (str(expr), __FILE__, __LINE__, \
16 __PRETTY_FUNCTION__), 0))
18 int __attribute__((noinline))
27 return (assert (foo ()), 1);
33 return (assert (foo ()), 2);
36 int a = (assert (foo ()), 1);
37 int b = (assert (foo ()), 2);
44 int e = (assert (foo ()), 3);
53 int f = (assert (foo ()), 4);
56 void __attribute__((noinline))
57 __assert_fail (const char *cond, const char *file, unsigned int line,
58 const char *pretty) throw ()