This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
DWARF question/inlining/local classes
- From: Mark Mitchell <mark at codesourcery dot com>
- To: gcc at gcc dot gnu dot org
- Date: Wed, 30 Oct 2002 16:10:54 -0800
- Subject: DWARF question/inlining/local classes
- Reply-to: mark at codesourcery dot com
PR 8391 contains this code:
inline void h(const Outer &o)
{
struct Local : public Outer::Inner {
virtual bool f() {};
};
Local l;
o.g(l);
}
When we try to emit the body of Local::f (the function in the struct
inside h), we don't actually emit assembly code because of this code
in rest_of_compilation:
/* If this is nested inside an inlined external function, pretend
it was only declared. Since we cannot inline such functions,
generating code for this one is not only not necessary but will
confuse some debugging output writers. */
for (parent = DECL_CONTEXT (current_function_decl);
parent != NULL_TREE;
parent = get_containing_scope (parent))
if (TREE_CODE (parent) == FUNCTION_DECL
&& DECL_INLINE (parent) && DECL_EXTERNAL (parent))
{
DECL_INITIAL (decl) = 0;
goto exit_rest_of_compilation;
}
This logic is wrong for C++; we need to emit Local::f. The basic
problem is that this code is making a language-dependent assumption in
language-independent code. I can work around that.
What has me worried is the comment; is it true that the debugging
machinery will be unhappy if we emit Local::f but do not emit an
out-of-line definition of h?
--
Mark Mitchell mark@codesourcery.com
CodeSourcery, LLC http://www.codesourcery.com