Thursday, March 28, 2002

I was thinking how to handle forward declarations of types.

There seems to be a macro DECL_EXTERNAL mentioned in the file :
http://gcc.gnu.org/ml/gcc-patches/2001-01/msg02251.html
/* Language-specific decl information. */
#define DECL_LANG_SPECIFIC(NODE) (DECL_CHECK (NODE)->decl.lang_specific)
In a VAR_DECL, nonzero means external reference:
do not allocate storage, and refer to a definition elsewhere.
In a FUNCTION_DECL, zero means that the function is declared auto
inside a function body.
These are externals.

Here is an example of the creation of a forward, it has to be looked into.
decl_specs = tree_cons (NULL_TREE, type, sc_spec); -- the declaration specifiers
decl = start_decl (synth_id_with_class_suffix (name, implementation_context), decl_specs, 1, NULL_TREE, NULL_TREE);
DECL_CONTEXT (decl) = NULL_TREE;
finish_decl (decl, expr, NULL_TREE);
I think that a forward is just a declaration, but without too much information.

mike

0 Comments:

Post a Comment

<< Home