diff options
author | Matt Austern <austern@apple.com> | 2003-09-04 21:32:48 +0000 |
---|---|---|
committer | Matt Austern <austern@gcc.gnu.org> | 2003-09-04 21:32:48 +0000 |
commit | 47ab33b2208b4fc4a043f8e337a0cf70fa23e3eb (patch) | |
tree | eca3e9ad4309c329d418909982ba204fe37e9b70 /gcc/c-common.c | |
parent | be6acd4b3a2c3a23baa80c11899a3cbb0969662b (diff) | |
download | gcc-47ab33b2208b4fc4a043f8e337a0cf70fa23e3eb.zip gcc-47ab33b2208b4fc4a043f8e337a0cf70fa23e3eb.tar.gz gcc-47ab33b2208b4fc4a043f8e337a0cf70fa23e3eb.tar.bz2 |
Correct the behavior of __func__ for C++ special member functions.
* c-common.c (fname_as_string): Use lang_hooks.decl_printable_name
with verbosity 0, instead of DECL_NAME, for human-readable string.
* g++.dg/ext/fnname1.C: New test. (__func__ for C++.)
* g++.dg/ext/fnname2.C: Likewise.
* g++.dg/ext/fnname3.C: Likewise.
From-SVN: r71088
Diffstat (limited to 'gcc/c-common.c')
-rw-r--r-- | gcc/c-common.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/gcc/c-common.c b/gcc/c-common.c index 9dd1826..69dd0811 100644 --- a/gcc/c-common.c +++ b/gcc/c-common.c @@ -1071,16 +1071,18 @@ finish_fname_decls (void) const char * fname_as_string (int pretty_p) { - const char *name = NULL; - - if (pretty_p) - name = (current_function_decl - ? (*lang_hooks.decl_printable_name) (current_function_decl, 2) - : "top level"); - else if (current_function_decl && DECL_NAME (current_function_decl)) - name = IDENTIFIER_POINTER (DECL_NAME (current_function_decl)); - else - name = ""; + const char *name = "top level"; + int vrb = 2; + + if (! pretty_p) + { + name = ""; + vrb = 0; + } + + if (current_function_decl) + name = (*lang_hooks.decl_printable_name) (current_function_decl, vrb); + return name; } |