This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Creating a variable declaration of custom type.
- From: Revital1 Eres <ERES at il dot ibm dot com>
- To: "Ferad Zyulkyarov" <feradz at gmail dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Mon, 15 Jan 2007 14:35:33 +0200
- Subject: Re: Creating a variable declaration of custom type.
> tree type_id, type_node, var_decl;
>
> type_id = get_identifier("MyType");
> type_node = make_node(POINTER_TYPE);
> TYPE_NAME(type_node) = type_id;
> var_decl = build(VAR_DECL, get_identifier("t"), type_node);
>
> But, when I compile my source with the modified GCC (as above) I get
> an error: "t" has an incomplete type. I know that I miss something but
> I cannot figure out what is it.
I think that the type of type_node is missing. Try to add
TREE_TYPE (type_node); For example TREE_TYPE (type_node) =
integer_type_node. (if MyType is int).
Revital
>
> --
> Ferad Zyulkyarov
> Barcelona Supercomputing Center