This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: C++ PATCH: PR 15815
Mark Mitchell wrote:
> This patch deprecates "#pragma interface" and "#pragma implementation"
> as per PR 15815. I'll remove these before 3.5.0.
Hang on - what's the alternative that does the same
thing? That is, inline wherever possible and emit a
backup copy once. (The "once" bit is not necessary
with GNU ld but the "backup" bit is.)
Consider:
--------------------------- 8< ---------------------------
~/src/test/inline > cat x.h
#pragma interface
class X
{
public:
void junk( void) { }
};
~/src/test/inline > cat x.cpp
#pragma implementation
#include "x.h"
~/src/test/inline > ~/gcc/bin/g++ -O2 -c x.cpp
~/src/test/inline > nm x.o
00000000 W _ZN1X4junkEv
--------------------------- 8< ---------------------------
If I remove the two "#pragma"-s, the definition
for "junk()" is not emitted at all, even if I
specify "-fkeep-inline-functions".
"-fno-default-inline" would unnecessarily pessimise
things.
So what's the practical alternative?
Thanks,
Ranjit.
--
Ranjit Mathew Email: rmathew AT gmail DOT com
Bangalore, INDIA. Web: http://ranjitmathew.tripod.com/