This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
cc1plus emits __FUNCTION__ etc even if unreferenced
- To: gcc-bugs at gcc dot gnu dot org
- Subject: cc1plus emits __FUNCTION__ etc even if unreferenced
- From: Zack Weinberg <zack at wolery dot cumb dot org>
- Date: Mon, 19 Jun 2000 13:47:59 -0700
$ ./cc1plus -quiet -fno-ident </dev/null
.file "stdin"
.version "01.01"
gcc2_compiled.:
.section .rodata
.type __FUNCTION__,@object
.size __FUNCTION__,1
__FUNCTION__:
.string ""
.type __PRETTY_FUNCTION__,@object
.size __PRETTY_FUNCTION__,10
__PRETTY_FUNCTION__:
.string "top level"
.type __func__,@object
.size __func__,1
__func__:
.string ""
$
Compare what you get from cc1:
$ ./cc1 -quiet -fno-ident </dev/null
.file "stdin"
.version "01.01"
gcc2_compiled.:
$
If you run them through the assembler, the C++ object file is ~200
bytes bigger (x86, ELF).
There's some code in cp/decl.c that wants to prevent this:
/* Pretend we've output an unused static variable. This ensures
that the toplevel __FUNCTION__ etc won't be emitted, unless
needed. */
(in wrapup_globals_for_namespace) but it apparently doesn't work.
zw