widl: Remove checks for typedefs that always fail.
diff --git a/tools/widl/parser.y b/tools/widl/parser.y
index 8cbddcd..4ceb6a2 100644
--- a/tools/widl/parser.y
+++ b/tools/widl/parser.y
@@ -1291,7 +1291,7 @@
int t;
if (is_attr( type->attrs, ATTR_STRING ))
{
- switch( ref_type( type ) )
+ switch( type->ref->type )
{
case RPC_FC_CHAR:
return RPC_FC_C_CSTRING;
@@ -1419,10 +1419,6 @@
{
type_t *t = field->type;
- /* get the base type */
- while( (t->type == 0) && t->ref )
- t = t->ref;
-
if (field->ptr_level > 0)
{
has_pointer = 1;
diff --git a/tools/widl/proxy.c b/tools/widl/proxy.c
index cb2b2a9..2022663 100644
--- a/tools/widl/proxy.c
+++ b/tools/widl/proxy.c
@@ -65,15 +65,6 @@
return r;
}
-
-static type_t *get_base_type( var_t *arg )
-{
- type_t *t = arg->type;
- while( (t->type == 0) && t->ref )
- t = t->ref;
- return t;
-}
-
static void write_stubdescproto(void)
{
print_proxy( "extern const MIDL_STUB_DESC Object_StubDesc;\n");
@@ -212,7 +203,7 @@
static void marshall_size_arg( var_t *arg )
{
int index = 0;
- const type_t *type = get_base_type(arg);
+ const type_t *type = arg->type;
expr_t *expr;
expr = get_attrp( arg->attrs, ATTR_SIZEIS );
@@ -311,7 +302,7 @@
static void marshall_copy_arg( var_t *arg )
{
int index = 0;
- type_t *type = get_base_type(arg);
+ type_t *type = arg->type;
expr_t *expr;
expr = get_attrp( arg->attrs, ATTR_SIZEIS );
@@ -420,7 +411,7 @@
static void unmarshall_copy_arg( var_t *arg )
{
int index = 0;
- type_t *type = get_base_type(arg);
+ type_t *type = arg->type;
expr_t *expr;
expr = get_attrp( arg->attrs, ATTR_SIZEIS );
@@ -529,7 +520,7 @@
return;
}
- type = get_base_type(arg);
+ type = arg->type;
switch( type->type )
{
case RPC_FC_BYTE:
@@ -703,7 +694,7 @@
fprintf(proxy,"\n");
}
else if (is_attr(arg->attrs, ATTR_OUT)) {
- type_t *type = get_base_type(arg);
+ type_t *type = arg->type;
switch( type->type )
{
case RPC_FC_STRUCT:
diff --git a/tools/widl/server.c b/tools/widl/server.c
index 9f6c5ac..630e414 100644
--- a/tools/widl/server.c
+++ b/tools/widl/server.c
@@ -157,8 +157,6 @@
{
unsigned int size;
type_t *type = var->type;
- while (type->type == 0 && type->ref)
- type = type->ref;
fprintf(server, " = NdrAllocate(&_StubMsg, ");
write_expr(server, size_is, 1);
diff --git a/tools/widl/typegen.c b/tools/widl/typegen.c
index 523556f..b46f0b1 100644
--- a/tools/widl/typegen.c
+++ b/tools/widl/typegen.c
@@ -159,11 +159,6 @@
print_file(f, indent, "\n");
}
-static inline int type_has_ref(const type_t *type)
-{
- return (type->type == 0 && type->ref);
-}
-
static inline int is_base_type(unsigned char type)
{
switch (type)
@@ -192,14 +187,6 @@
}
}
-unsigned char ref_type(const type_t *type)
-{
- while (type_has_ref(type))
- type = type->ref;
-
- return type->type;
-}
-
static size_t write_procformatstring_var(FILE *file, int indent,
const var_t *var, int is_return, unsigned int *type_offset)
{
@@ -212,9 +199,6 @@
if (!is_in && !is_out) is_in = TRUE;
- if (ptr_level == 0 && type_has_ref(type))
- type = type->ref;
-
if (ptr_level == 0 && !var->array && is_base_type(type->type))
{
if (is_return)
@@ -454,7 +438,7 @@
correlation_type = RPC_FC_TOP_LEVEL_CONFORMANCE;
}
- correlation_variable_type = ref_type(correlation_variable);
+ correlation_variable_type = correlation_variable->type;
switch (correlation_variable_type)
{
@@ -570,9 +554,6 @@
if (ptr_level)
return sizeof(void *);
- if (type_has_ref(t))
- return type_memsize(t->ref, 0 /* FIXME */, NULL);
-
switch (t->type)
{
case RPC_FC_BYTE:
@@ -651,10 +632,6 @@
return 1;
}
- /* FIXME: search through all refs for pointers too */
- while(type_has_ref(type))
- type = type->ref;
-
switch (type->type)
{
/* note: don't descend into complex structures or unions since these
@@ -753,7 +730,7 @@
if (!get_attrp(attrs, ATTR_SIZEIS))
flags |= RPC_FC_P_SIMPLEPOINTER;
- rtype = ref_type(type);
+ rtype = type->type;
if ((rtype != RPC_FC_BYTE) && (rtype != RPC_FC_CHAR) && (rtype != RPC_FC_WCHAR))
{
@@ -1040,7 +1017,7 @@
while (NEXT_LINK(field)) field = NEXT_LINK(field);
for (; field; field = PREV_LINK(field))
{
- unsigned char rtype = ref_type(field->type);
+ unsigned char rtype = field->type->type;
if (is_base_type(rtype))
{
@@ -1324,14 +1301,6 @@
if (ptr_level == 0)
{
- /* follow reference if the type has one */
- if (type_has_ref(type))
- {
- type = type->ref;
- /* FIXME: get new ptr_level from type */
- continue;
- }
-
/* basic types don't need a type format string */
if (is_base_type(type->type))
return 0;
@@ -1356,7 +1325,7 @@
error("write_typeformatstring_var: Unsupported type 0x%x for variable %s\n", type->type, var->name);
}
}
- else if (ptr_level == 1 && !type_has_ref(type))
+ else if (ptr_level == 1)
{
size_t start_offset = *typeformat_offset;
int in_attr = is_attr(var->attrs, ATTR_IN);
@@ -1473,7 +1442,7 @@
const char *name, unsigned int *alignment)
{
*alignment = 0;
- if (ptr_level == 0 && !array && !type_has_ref(type))
+ if (ptr_level == 0 && !array)
{
switch (type->type)
{
@@ -1525,8 +1494,6 @@
return 0;
}
}
- if (ptr_level == 0 && type_has_ref(type))
- return get_required_buffer_size_type(type->ref, 0 /* FIXME */, array, name, alignment);
return 0;
}
@@ -1547,8 +1514,6 @@
if (out_attr && var->ptr_level > 0)
{
type_t *type = var->type;
- while (type->type == 0 && type->ref)
- type = type->ref;
if (type->type == RPC_FC_STRUCT)
{
@@ -1570,11 +1535,9 @@
{
if ((!out_attr || in_attr) && !has_size && !is_attr(var->attrs, ATTR_STRING) && !var->array)
{
- if (var->ptr_level > 0 || (var->ptr_level == 0 && type_has_ref(var->type)))
+ if (var->ptr_level > 0)
{
type_t *type = var->type;
- while (type->type == 0 && type->ref)
- type = type->ref;
if (is_base_type(type->type))
{
@@ -1650,7 +1613,7 @@
if (phase != PHASE_MARSHAL && phase != PHASE_UNMARSHAL)
return;
- rtype = ref_type(type);
+ rtype = type->type;
switch (rtype)
{
@@ -1781,7 +1744,7 @@
break;
}
- rtype = ref_type(type);
+ rtype = type->type;
if (is_string_type(var->attrs, var->ptr_level, var->array))
{
diff --git a/tools/widl/widltypes.h b/tools/widl/widltypes.h
index 54c67e2..6d51b51 100644
--- a/tools/widl/widltypes.h
+++ b/tools/widl/widltypes.h
@@ -295,8 +295,6 @@
type_t *duptype(type_t *t, int dupname);
type_t *alias(type_t *t, const char *name);
-/* Get the actual type field for a type (chase down typedef references). */
-unsigned char ref_type(const type_t *type);
int is_ptr(type_t *t);
int is_var_ptr(var_t *v);
int cant_be_null(var_t *v);