Commit 8f87eddd authored by Rob Shearman's avatar Rob Shearman Committed by Alexandre Julliard

widl: Only duplicate a type if absolutely necessary.

Document how much of hack duplicating a type in order to change its pointer type is.
parent e054c52c
......@@ -1446,9 +1446,19 @@ static void set_type(var_t *v, decl_spec_t *decl_spec, const declarator_t *decl,
}
if (ptr && is_ptr(ptr) && (ptr_attr || top))
{
/* duplicate type to avoid changing original type */
*pt = duptype(*pt, 1);
(*pt)->type = ptr_attr ? ptr_attr : RPC_FC_RP;
if (!ptr_attr)
ptr_attr = RPC_FC_RP;
if (ptr_attr != (*pt)->type)
{
/* create new type to avoid changing original type */
/* FIXME: this is a horrible hack - we might be changing the pointer
* type of an alias here, so we also need corresponding hacks in
* get_pointer_fc to handle this. The type of pointer that the type
* ends up having is context sensitive and so we shouldn't be
* setting it here, but rather determining it when it is used. */
*pt = duptype(*pt, 1);
(*pt)->type = ptr_attr;
}
}
else if (ptr_attr)
error_loc("%s: pointer attribute applied to non-pointer type\n", v->name);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment