Signed-off-by: Rémi Bernon rbernon@codeweavers.com ---
v3: I got caught by the change to the parameterized_arg rule that was actually prepending types instead of appending types them, as the helper name suggests, reversing the list order.
So I decided to clean all this type_list_t single linked list mess first, to use the usual double linked list structure and helpers. As there was already a ifref_list_t / ifref_t that is mostly a type list, I just renamed it and used it everywhere type_list_t was used.
Then this also:
* Fix memmove off-by-one error in format_parameterized_type_c_name.
* Fix incorrect usage of u.type_list for STMT_TYPE and STMT_TYPEREF,
* Use STMT_TYPE with a partially specialized parameterized type for the delayed definitions, instead of trying to force use of type_list.
* Removes development code leftovers.
* Add loc_info_t to replace_type_parameters_in_statement(_list).
* Print proper error message in unsupported cases.
* Delay the delegate patches to a later batch.
Thanks Jacek for the review!
tools/widl/parser.y | 4 ++-- tools/widl/typetree.c | 8 ++++---- tools/widl/typetree.h | 2 +- tools/widl/widltypes.h | 2 +- tools/widl/write_msft.c | 6 +++--- 5 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/tools/widl/parser.y b/tools/widl/parser.y index 6ab4f83a0ad..54006529ba9 100644 --- a/tools/widl/parser.y +++ b/tools/widl/parser.y @@ -1821,10 +1821,10 @@ static ifref_list_t *append_ifref(ifref_list_t *list, ifref_t *iface) return list; }
-static ifref_t *make_ifref(type_t *iface) +static ifref_t *make_ifref(type_t *type) { ifref_t *l = xmalloc(sizeof(ifref_t)); - l->iface = iface; + l->type = type; l->attrs = NULL; return l; } diff --git a/tools/widl/typetree.c b/tools/widl/typetree.c index 203fffcdee6..2f49a92511a 100644 --- a/tools/widl/typetree.c +++ b/tools/widl/typetree.c @@ -565,19 +565,19 @@ type_t *type_runtimeclass_define(type_t *runtimeclass, attr_list_t *attrs, ifref /* FIXME: this should probably not be allowed, here or in coclass, */ /* but for now there's too many places in Wine IDL where it is to */ /* even print a warning. */ - if (!(ifref->iface->defined)) continue; - if (!(requires = type_iface_get_requires(ifref->iface))) continue; + if (!(ifref->type->defined)) continue; + if (!(requires = type_iface_get_requires(ifref->type))) continue; LIST_FOR_EACH_ENTRY(required, requires, ifref_t, entry) { int found = 0;
LIST_FOR_EACH_ENTRY(tmp, ifaces, ifref_t, entry) - if ((found = type_is_equal(tmp->iface, required->iface))) break; + if ((found = type_is_equal(tmp->type, required->type))) break;
if (!found) error_loc("interface '%s' also requires interface '%s', " "but runtimeclass '%s' does not implement it.\n", - ifref->iface->name, required->iface->name, runtimeclass->name); + ifref->type->name, required->type->name, runtimeclass->name); } }
diff --git a/tools/widl/typetree.h b/tools/widl/typetree.h index 96b681e0379..186f42307f4 100644 --- a/tools/widl/typetree.h +++ b/tools/widl/typetree.h @@ -363,7 +363,7 @@ static inline type_t *type_runtimeclass_get_default_iface(const type_t *type) if (!ifaces) return NULL; LIST_FOR_EACH_ENTRY(entry, ifaces, ifref_t, entry) if (is_attr(entry->attrs, ATTR_DEFAULT)) - return entry->iface; + return entry->type;
return NULL; } diff --git a/tools/widl/widltypes.h b/tools/widl/widltypes.h index 7596577493d..f31d40cad91 100644 --- a/tools/widl/widltypes.h +++ b/tools/widl/widltypes.h @@ -538,7 +538,7 @@ struct _declarator_t { };
struct _ifref_t { - type_t *iface; + type_t *type; attr_list_t *attrs;
/* parser-internal */ diff --git a/tools/widl/write_msft.c b/tools/widl/write_msft.c index 5728f041f6f..63635cec011 100644 --- a/tools/widl/write_msft.c +++ b/tools/widl/write_msft.c @@ -2352,10 +2352,10 @@ static void add_coclass_typeinfo(msft_typelib_t *typelib, type_t *cls)
i = 0; if (ifaces) LIST_FOR_EACH_ENTRY( iref, ifaces, ifref_t, entry ) { - if(iref->iface->typelib_idx == -1) - add_interface_typeinfo(typelib, iref->iface); + if(iref->type->typelib_idx == -1) + add_interface_typeinfo(typelib, iref->type); ref = (MSFT_RefRecord*) (typelib->typelib_segment_data[MSFT_SEG_REFERENCES] + offset + i * sizeof(*ref)); - ref->reftype = typelib->typelib_typeinfo_offsets[iref->iface->typelib_idx]; + ref->reftype = typelib->typelib_typeinfo_offsets[iref->type->typelib_idx]; ref->flags = 0; ref->oCustData = -1; ref->onext = -1;