2008/6/24 Dan Hipschman dsh@linux.ucla.edu:
On Mon, Jun 23, 2008 at 10:29:11PM +0100, Rob Shearman wrote:
diff --git a/tools/widl/typegen.c b/tools/widl/typegen.c index 1f8695a..84115fd 100644 --- a/tools/widl/typegen.c +++ b/tools/widl/typegen.c @@ -809,7 +809,9 @@ size_t type_memsize(const type_t *t, unsigned int *align) { size_t size = 0;
- if (t->declarray && is_conformant_array(t))
- if (t->kind == TKIND_ALIAS)
size = type_memsize(t->orig, align);
- else if (t->declarray && is_conformant_array(t)) { type_memsize(t->ref, align); size = 0;
What type of thing is this needed for? A typedef'd type should have all the same fields as the original except for the attributes, so for most cases in type_memsize it shouldn't be necessary to check whether the type is an alias. For anything that needs to check attributes, I would think it would be better to fix the predicates (such as is_conformant_array, etc.) if they do not detect that correctly 100% of the time.
Sorry, I hadn't considered the order in which I sent these patches and didn't send the subsequent patches that show why it is needed. The direction I'm going with this is this patch: http://repo.or.cz/w/wine/dcerpc.git?a=commit;h=df37407c4a67a536950d1b8fbcbd8... In this series: http://repo.or.cz/w/wine/dcerpc.git?a=log;h=refs/heads/idl-parser
The idea is that in order to switch to generating a parse tree and generating a header file from that we need to differentiate between a type being defined and a type being used and that cannot be done by using the same type pointer for both instances.
The idea, therefore, is to move the definition-specific data to a separate details object which is pointed to by both the type being used and the defined type. The code then needs to fix the former when the latter is created.
Thoughts?