diff --git a/tools/widl/client.c b/tools/widl/client.c index ba4962495de..d9338c0a68f 100644 --- a/tools/widl/client.c +++ b/tools/widl/client.c @@ -113,7 +113,7 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset, unsig } } - write_type(client, def->type, def, def->tname); + write_type(client, def->type, def); fprintf(client, " "); write_prefix_name(client, prefix_client, def); fprintf(client, "(\n"); @@ -133,7 +133,7 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset, unsig if (!is_void(def->type, NULL)) { print_client(""); - write_type(client, def->type, def, def->tname); + write_type(client, def->type, def); fprintf(client, " _RetVal;\n"); } diff --git a/tools/widl/header.c b/tools/widl/header.c index faeadfb6b3c..24ce8a07259 100644 --- a/tools/widl/header.c +++ b/tools/widl/header.c @@ -159,7 +159,7 @@ static void write_field(FILE *h, var_t *v) if (!v) return; if (v->type) { indent(h, 0); - write_type(h, v->type, NULL, v->tname); + write_type(h, v->type, NULL); if (get_name(v)) { fprintf(h, " "); write_pident(h, v); @@ -220,14 +220,13 @@ static int needs_space_after(type_t *t) return t->kind == TKIND_ALIAS || ! is_ptr(t); } -void write_type(FILE *h, type_t *t, const var_t *v, const char *n) +void write_type(FILE *h, type_t *t, const var_t *v) { int c; if (t->is_const) fprintf(h, "const "); - if (n) fprintf(h, "%s", n); - else if (t->kind == TKIND_ALIAS) fprintf(h, "%s", t->name); + if (t->kind == TKIND_ALIAS) fprintf(h, "%s", t->name); else { if (t->sign > 0) fprintf(h, "signed "); else if (t->sign < 0) fprintf(h, "unsigned "); @@ -279,7 +278,7 @@ void write_type(FILE *h, type_t *t, const var_t *v, const char *n) case RPC_FC_UP: case RPC_FC_FP: case RPC_FC_OP: - if (t->ref) write_type(h, t->ref, NULL, t->name); + if (t->ref) write_type(h, t->ref, NULL); fprintf(h, "%s*", needs_space_after(t->ref) ? " " : ""); break; default: @@ -359,7 +358,7 @@ void write_user_types(void) void write_typedef(type_t *type) { fprintf(header, "typedef "); - write_type(header, type->orig, NULL, NULL); + write_type(header, type->orig, NULL); fprintf(header, "%s%s;\n", needs_space_after(type->orig) ? " " : "", type->name); } @@ -397,13 +396,13 @@ void write_expr(FILE *h, const expr_t *e, int brackets) break; case EXPR_CAST: fprintf(h, "("); - write_type(h, e->u.tref, NULL, e->u.tref->name); + write_type(h, e->u.tref, NULL); fprintf(h, ")"); write_expr(h, e->ref, 1); break; case EXPR_SIZEOF: fprintf(h, "sizeof("); - write_type(h, e->u.tref, NULL, e->u.tref->name); + write_type(h, e->u.tref, NULL); fprintf(h, ")"); break; case EXPR_SHL: @@ -452,7 +451,7 @@ void write_constdef(const var_t *v) void write_externdef(const var_t *v) { fprintf(header, "extern const "); - write_type(header, v->type, NULL, v->tname); + write_type(header, v->type, NULL); if (get_name(v)) { fprintf(header, " "); write_pident(header, v); @@ -580,7 +579,7 @@ void write_args(FILE *h, const var_list_t *args, const char *name, int method, i } else fprintf(h, ","); } - write_type(h, arg->type, arg, arg->tname); + write_type(h, arg->type, arg); if (arg->args) { fprintf(h, " (STDMETHODCALLTYPE *"); @@ -613,7 +612,7 @@ static void write_cpp_method_def(const type_t *iface) if (!is_callas(def->attrs)) { indent(header, 0); fprintf(header, "virtual "); - write_type(header, def->type, def, def->tname); + write_type(header, def->type, def); fprintf(header, " STDMETHODCALLTYPE "); write_name(header, def); fprintf(header, "(\n"); @@ -638,7 +637,7 @@ static void do_write_c_method_def(const type_t *iface, const char *name) const var_t *def = cur->def; if (!is_callas(def->attrs)) { indent(header, 0); - write_type(header, def->type, def, def->tname); + write_type(header, def->type, def); fprintf(header, " (STDMETHODCALLTYPE *"); write_name(header, def); fprintf(header, ")(\n"); @@ -671,7 +670,7 @@ static void write_method_proto(const type_t *iface) if (!is_local(def->attrs)) { /* proxy prototype */ - write_type(header, def->type, def, def->tname); + write_type(header, def->type, def); fprintf(header, " CALLBACK %s_", iface->name); write_name(header, def); fprintf(header, "_Proxy(\n"); @@ -694,14 +693,14 @@ static void write_method_proto(const type_t *iface) if (&m->entry != iface->funcs) { const var_t *mdef = m->def; /* proxy prototype - use local prototype */ - write_type(header, mdef->type, mdef, mdef->tname); + write_type(header, mdef->type, mdef); fprintf(header, " CALLBACK %s_", iface->name); write_name(header, mdef); fprintf(header, "_Proxy(\n"); write_args(header, m->args, iface->name, 1, TRUE); fprintf(header, ");\n"); /* stub prototype - use remotable prototype */ - write_type(header, def->type, def, def->tname); + write_type(header, def->type, def); fprintf(header, " __RPC_STUB %s_", iface->name); write_name(header, mdef); fprintf(header, "_Stub(\n"); @@ -720,7 +719,7 @@ static void write_function_proto(const type_t *iface, const func_t *fun, const c var_t *def = fun->def; /* FIXME: do we need to handle call_as? */ - write_type(header, def->type, def, def->tname); + write_type(header, def->type, def); fprintf(header, " "); write_prefix_name(header, prefix, def); fprintf(header, "(\n"); diff --git a/tools/widl/header.h b/tools/widl/header.h index ebf79175d01..4de10262c40 100644 --- a/tools/widl/header.h +++ b/tools/widl/header.h @@ -30,7 +30,7 @@ extern int is_non_void(const expr_list_t *list); extern void write_name(FILE *h, const var_t *v); extern void write_prefix_name(FILE *h, const char *prefix, const var_t *v); extern const char* get_name(const var_t *v); -extern void write_type(FILE *h, type_t *t, const var_t *v, const char *n); +extern void write_type(FILE *h, type_t *t, const var_t *v); extern int is_object(const attr_list_t *list); extern int is_local(const attr_list_t *list); extern const var_t *is_callas(const attr_list_t *list); diff --git a/tools/widl/parser.y b/tools/widl/parser.y index fc916d435c5..8c85565719c 100644 --- a/tools/widl/parser.y +++ b/tools/widl/parser.y @@ -297,12 +297,12 @@ int_statements: { $$ = NULL; } statement: ';' {} | constdef ';' { if (!parse_only && do_header) { write_constdef($1); } } | cppquote {} - | enumdef ';' { if (!parse_only && do_header) { write_type(header, $1, NULL, NULL); fprintf(header, ";\n\n"); } } + | enumdef ';' { if (!parse_only && do_header) { write_type(header, $1, NULL); fprintf(header, ";\n\n"); } } | externdef ';' { if (!parse_only && do_header) { write_externdef($1); } } | import {} - | structdef ';' { if (!parse_only && do_header) { write_type(header, $1, NULL, NULL); fprintf(header, ";\n\n"); } } + | structdef ';' { if (!parse_only && do_header) { write_type(header, $1, NULL); fprintf(header, ";\n\n"); } } | typedef ';' {} - | uniondef ';' { if (!parse_only && do_header) { write_type(header, $1, NULL, NULL); fprintf(header, ";\n\n"); } } + | uniondef ';' { if (!parse_only && do_header) { write_type(header, $1, NULL); fprintf(header, ";\n\n"); } } ; cppquote: tCPPQUOTE '(' aSTRING ')' { if (!parse_only && do_header) fprintf(header, "%s\n", $3); } @@ -1240,7 +1240,6 @@ static var_t *make_var(char *name) v->ptr_level = 0; v->type = NULL; v->args = NULL; - v->tname = NULL; v->attrs = NULL; v->array = NULL; v->eval = NULL; diff --git a/tools/widl/proxy.c b/tools/widl/proxy.c index 2d6b75bb70f..6e0817a0687 100644 --- a/tools/widl/proxy.c +++ b/tools/widl/proxy.c @@ -264,7 +264,7 @@ static void gen_proxy(type_t *iface, const func_t *cur, int idx, unsigned int offset; indent = 0; - write_type(proxy, def->type, def, def->tname); + write_type(proxy, def->type, def); print_proxy( " STDMETHODCALLTYPE %s_", iface->name); write_name(proxy, def); print_proxy( "_Proxy(\n"); @@ -275,7 +275,7 @@ static void gen_proxy(type_t *iface, const func_t *cur, int idx, /* local variables */ if (has_ret) { print_proxy( "" ); - write_type(proxy, def->type, def, def->tname); + write_type(proxy, def->type, def); print_proxy( " _RetVal;\n"); } print_proxy( "RPC_MESSAGE _RpcMessage;\n" ); diff --git a/tools/widl/typegen.c b/tools/widl/typegen.c index b35a7d5c2d6..400cb0249e9 100644 --- a/tools/widl/typegen.c +++ b/tools/widl/typegen.c @@ -1842,7 +1842,7 @@ void print_phase_basetype(FILE *file, int indent, enum remoting_phase phase, if (phase == PHASE_MARSHAL) { print_file(file, indent, "*("); - write_type(file, var->type, NULL, var->tname); + write_type(file, var->type, NULL); if (var->ptr_level) fprintf(file, " *)_StubMsg.Buffer = *"); else @@ -1861,12 +1861,12 @@ void print_phase_basetype(FILE *file, int indent, enum remoting_phase phase, fprintf(file, " = ("); else fprintf(file, " = *("); - write_type(file, var->type, NULL, var->tname); + write_type(file, var->type, NULL); fprintf(file, " *)_StubMsg.Buffer;\n"); } print_file(file, indent, "_StubMsg.Buffer += sizeof("); - write_type(file, var->type, NULL, var->tname); + write_type(file, var->type, NULL); fprintf(file, ");\n"); } @@ -2214,13 +2214,13 @@ static void write_struct_expr(FILE *h, const expr_t *e, int brackets, break; case EXPR_CAST: fprintf(h, "("); - write_type(h, e->u.tref, NULL, e->u.tref->name); + write_type(h, e->u.tref, NULL); fprintf(h, ")"); write_struct_expr(h, e->ref, 1, fields, structvar); break; case EXPR_SIZEOF: fprintf(h, "sizeof("); - write_type(h, e->u.tref, NULL, e->u.tref->name); + write_type(h, e->u.tref, NULL); fprintf(h, ")"); break; case EXPR_SHL: @@ -2271,7 +2271,7 @@ void declare_stub_args( FILE *file, int indent, const func_t *func ) if (!is_void(def->type, NULL)) { print_file(file, indent, ""); - write_type(file, def->type, def, def->tname); + write_type(file, def->type, def); fprintf(file, " _RetVal;\n"); } @@ -2293,14 +2293,14 @@ void declare_stub_args( FILE *file, int indent, const func_t *func ) { int indirection; print_file(file, indent, ""); - write_type(file, var->type, NULL, var->tname); + write_type(file, var->type, NULL); for (indirection = 0; indirection < var->ptr_level - 1; indirection++) fprintf(file, "*"); fprintf(file, " _W%u;\n", i++); } print_file(file, indent, ""); - write_type(file, var->type, var, var->tname); + write_type(file, var->type, var); fprintf(file, " "); if (var->array) { fprintf(file, "( *"); diff --git a/tools/widl/typelib.c b/tools/widl/typelib.c index 2f8708b973b..1e63e96bf8e 100644 --- a/tools/widl/typelib.c +++ b/tools/widl/typelib.c @@ -215,10 +215,11 @@ unsigned short get_type_vt(type_t *t) unsigned short get_var_vt(var_t *v) { unsigned short vt; + const char *tname = v->type->name; - chat("get_var_vt: %p tname %s\n", v, v->tname); - if (v->tname) { - vt = builtin_vt(v->tname); + chat("get_var_vt: var %p type->name %s\n", v, tname ? tname : "NULL"); + if (tname) { + vt = builtin_vt(tname); if (vt) return vt; } diff --git a/tools/widl/widltypes.h b/tools/widl/widltypes.h index 8cb132087bc..15c5c1a717a 100644 --- a/tools/widl/widltypes.h +++ b/tools/widl/widltypes.h @@ -216,7 +216,6 @@ struct _var_t { array_dims_t *array; type_t *type; var_list_t *args; /* for function pointers */ - const char *tname; attr_list_t *attrs; expr_t *eval; diff --git a/tools/widl/write_msft.c b/tools/widl/write_msft.c index d3a5bf4a14c..6916128fd43 100644 --- a/tools/widl/write_msft.c +++ b/tools/widl/write_msft.c @@ -1068,7 +1068,8 @@ static int encode_var( if (!decoded_size) decoded_size = &scratch; *decoded_size = 0; - chat("encode_var: var %p var->tname %s var->type %p var->ptr_level %d var->type->ref %p\n", var, var->tname, var->type, var->ptr_level, var->type->ref); + chat("encode_var: var %p var->type %p var->type->name %s var->ptr_level %d var->type->ref %p\n", + var, var->type, var->type->name ? var->type->name : "NULL", var->ptr_level, var->type->ref); if(var->ptr_level) { int skip_ptr; var->ptr_level--;