diff --git a/tools/widl/parser.y b/tools/widl/parser.y index df3d78f567c..f35d671716b 100644 --- a/tools/widl/parser.y +++ b/tools/widl/parser.y @@ -1622,11 +1622,11 @@ static var_t *declare_var(attr_list_t *attrs, decl_spec_t *decl_spec, const decl error_loc("%s: cannot specify size_is for an already sized array\n", v->name); else *ptype = type_new_array((*ptype)->name, - type_array_get_element_type(*ptype), FALSE, + type_array_get_element(*ptype), FALSE, 0, dim, NULL, FC_RP); } else if (is_ptr(*ptype)) - *ptype = type_new_array((*ptype)->name, type_pointer_get_ref_type(*ptype), TRUE, + *ptype = type_new_array((*ptype)->name, type_pointer_get_ref(*ptype), TRUE, 0, dim, NULL, pointer_default); else error_loc("%s: size_is attribute applied to illegal type\n", v->name); @@ -1648,7 +1648,7 @@ static var_t *declare_var(attr_list_t *attrs, decl_spec_t *decl_spec, const decl if (is_array(*ptype)) { *ptype = type_new_array((*ptype)->name, - type_array_get_element_type(*ptype), + type_array_get_element(*ptype), type_array_is_decl_as_ptr(*ptype), type_array_get_dim(*ptype), type_array_get_conformance(*ptype), @@ -1802,8 +1802,8 @@ static declarator_t *make_declarator(var_t *var) static type_t *make_safearray(type_t *type) { - return type_new_array(NULL, type_new_alias(type, "SAFEARRAY"), TRUE, 0, - NULL, NULL, FC_RP); + const decl_spec_t ds = {.type = type_new_alias(type, "SAFEARRAY")}; + return type_new_array(NULL, &ds, TRUE, 0, NULL, NULL, FC_RP); } static typelib_t *make_library(const char *name, const attr_list_t *attrs) diff --git a/tools/widl/typetree.c b/tools/widl/typetree.c index ae3f3754502..3e9ac89ad9b 100644 --- a/tools/widl/typetree.c +++ b/tools/widl/typetree.c @@ -217,7 +217,7 @@ type_t *type_new_coclass(char *name) } -type_t *type_new_array(const char *name, type_t *element, int declptr, +type_t *type_new_array(const char *name, const decl_spec_t *element, int declptr, unsigned int dim, expr_t *size_is, expr_t *length_is, unsigned char ptr_default_fc) { @@ -229,7 +229,8 @@ type_t *type_new_array(const char *name, type_t *element, int declptr, t->details.array.size_is = size_is; else t->details.array.dim = dim; - t->details.array.elem.type = element; + if (element) + t->details.array.elem = *element; t->details.array.ptr_def_fc = ptr_default_fc; return t; } diff --git a/tools/widl/typetree.h b/tools/widl/typetree.h index d5f28fe5906..9453e9d1611 100644 --- a/tools/widl/typetree.h +++ b/tools/widl/typetree.h @@ -33,7 +33,7 @@ type_t *type_new_function(var_list_t *args); type_t *type_new_pointer(unsigned char pointer_default, type_t *ref, attr_list_t *attrs); type_t *type_new_alias(type_t *t, const char *name); type_t *type_new_module(char *name); -type_t *type_new_array(const char *name, type_t *element, int declptr, +type_t *type_new_array(const char *name, const decl_spec_t *element, int declptr, unsigned int dim, expr_t *size_is, expr_t *length_is, unsigned char ptr_default_fc); type_t *type_new_basic(enum type_basic_type basic_type);