3 msgNeed help with optimization options
2 msgstrict aliasing rule and examples
4 msgAnother question. How can I dump gimple IR afte...
4 msgrunning library built in gcc 3.4 on another lin...
1 msgHow to instrument an initcall?
1 msgconst array warning question
3 msgg++ 4.2.x x86: code generation for __sync_lock_...
1 msgHow to traverse through all type declarations i...
2 msgdata base calls
11 msgmay be undefined operation warning
2 msgnon virtual dtor warning
3 msggcc-3.4.3 and libstdc++.so.(5|6)
1 msgMigrating from gcc 2.95.3 to 3.4.5 in vxWorks o...
5 msgTarget specific behaviour
4 msgFunction Lookup
6 msginlined functions and ABI guarantees
2 msgCannot compile GCC on Ubuntu 7.10 x86_64
3 msgC main 32/64 bit prologues differ

Force generation of an uncalled method?
\ stepleton (22 Feb 2008)
. \ Brian Dessent (22 Feb 2008)
. . \ stepleton (22 Feb 2008)
. \ Brian Dessent (22 Feb 2008)

5 msggcc 3.2
Subject:Force generation of an uncalled method?
Group:Gcc-help
From:stepleton
Date:22 Feb 2008


Greetings,

I hope this question isn't too elementary. I have a program that maintains
objects from a number of templated classes. When debugging, it is
particularly useful to print out information in one of these objects with
a method I've written---this method digests the information in the object
and prints it out in a useful way. So, if the program hits a snag, I'd
like to call this method within gdb, as in "p myobject.dumpInfo()".
Ordinarily the code will not use this method ever---it's only for me to
call in the debugger.

The problem is that I can't get g++ to generate code for this method
unless I actually call it in somewhere the code (in which case everything
works as intended). I've tried the "used" attribute in the declaration,
and optimization is already off. Is there any way to force this method to
be compiled?

Thanks,
--Tom
+-----------+----------------+ ____
| Stepleton | tss |>-------|\__/_/__
+-----------+----------------+ \________}


© 2004-2008 readlist.com