2 // Copyright (C) 2000 Free Software Foundation, Inc.
3 // Contributed by Nathan Sidwell 3 Mar 2000 <nathan@codesourcery.com>
5 // __PRETTY_FUNCTION__, __FUNCTION__ and __function__ should have the
6 // type char const [X], where X is the right value for that particular function
8 static void const *strings[4];
9 static void const *tpls[4];
10 static unsigned pos = 0;
12 static void const *ptr = 0;
14 void unover (char const (*)[5]) {}
15 void foo (char const (*)[5]) {}
16 void foo (void *) {fail = 1;}
17 void foo (void const *) {fail = 1;}
18 void baz (char const (&)[5]) {}
20 template<unsigned I> void PV (char const (&objRef)[I])
22 strings[pos] = objRef;
23 tpls[pos] = __PRETTY_FUNCTION__;
31 PV (__PRETTY_FUNCTION__);
38 // there should be no string const merging
41 // but all uses should be the same.
42 if (ptr != __FUNCTION__)
47 return ptr == __FUNCTION__;
52 // make sure we actually emit the VAR_DECL when needed, and things have the
56 unover (&__FUNCTION__);
60 // __FUNCTION__ should be unique across functions with the same base name
61 // (it's a local static, _not_ a string).
69 // Check the names of fn. They should all be distinct strings (though two
70 // will have the same value).
71 if (strings[0] == strings[1])
73 if (strings[0] == strings[2])
75 if (strings[1] == strings[2])
78 // check the names of the template functions so invoked
79 if (tpls[0] != tpls[1])
81 if (tpls[0] == tpls[2])