This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

cc1plus emits __FUNCTION__ etc even if unreferenced


$ ./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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]