Module: wine
Branch: master
Commit: 8f87eddd399127192bed252c182c5fda02ce8328
URL: http://source.winehq.org/git/wine.git/?a=commit;h=8f87eddd399127192bed252c1…
Author: Rob Shearman <robertshearman(a)gmail.com>
Date: Sat Feb 14 18:11:26 2009 +0000
widl: Only duplicate a type if absolutely necessary.
Document how much of hack duplicating a type in order to change its
pointer type is.
---
tools/widl/parser.y | 16 +++++++++++++---
1 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/tools/widl/parser.y b/tools/widl/parser.y
index d5260c1..168f555 100644
--- a/tools/widl/parser.y
+++ b/tools/widl/parser.y
@@ -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);