[EMAIL PROTECTED] wrote on 16/01/2007 17:45:59:
> I succeeded to do it as follows:
>
> tree type_decl = lookup_name(get_identifier("MyType"));
> tree type_ptr = build_pointer_type(TREE_TYPE(type_decl));
> tree var_decl = build(VAR_DECL, get_identifier("t"), type_ptr);
> pushdecl(var_decl);
>
> I
I succeeded to do it as follows:
tree type_decl = lookup_name(get_identifier("MyType"));
tree type_ptr = build_pointer_type(TREE_TYPE(type_decl));
tree var_decl = build(VAR_DECL, get_identifier("t"), type_ptr);
pushdecl(var_decl);
It may not be a perfect solution but for now it works.
On 1/16/0
Hi,
Best way to figure this out is to write a simple 5 line testcase that
defines a structure type and also defines a pointer to that type, and
then step through gcc to see what it does. Try putting breakpoints in
finish_struct and build_pointer_type.
I tried with the advised test case but ag
Ferad Zyulkyarov wrote:
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);
Best way to figure this out is to write a simple 5 line testcase that
defines a structure type and also d
Hi again,
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).
"MyType" is a struct (of other again coumpound types) and will not
work with already existing type nodes like integer_type_node
> 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:
Hi,
When the code is being parsed in c-parser.c I try to transparently
create a variable declaration of custom type within the code being
compiled. The name of the custom type is "MyType" (defined in some
header file by typedef).
In my source file I have a function:
void foo()
{
...;
}
At the