Module: wine Branch: master Commit: 88820263c6ed440a0dcadefb6b1dd2316c20404a URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=88820263c6ed440a0dcadefb...
Author: Dan Hipschman dsh@linux.ucla.edu Date: Tue Aug 29 17:19:21 2006 -0700
widl: Remove checks for typedefs that always fail.
---
tools/widl/parser.y | 6 +---- tools/widl/proxy.c | 19 +++++------------ tools/widl/server.c | 2 -- tools/widl/typegen.c | 53 +++++++----------------------------------------- tools/widl/widltypes.h | 2 -- 5 files changed, 14 insertions(+), 68 deletions(-)
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 @@ static unsigned char get_pointer_type( t 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 @@ static int get_struct_type(var_t *field) { 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 @@ static int print_proxy( const char *form 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 proxy_check_pointers( var_t 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 proxy_gen_marshall_size( var 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 gen_marshall( var_t *arg ) 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 @@ static void free_variable( var_t *arg ) return; }
- type = get_base_type(arg); + type = arg->type; switch( type->type ) { case RPC_FC_BYTE: @@ -703,7 +694,7 @@ static void stub_unmarshall( var_t *arg 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 @@ static void assign_out_args(const func_t { 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 @@ void write_formatstringsdecl(FILE *f, in 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 @@ static inline int is_base_type(unsigned } }
-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 @@ static size_t write_procformatstring_var
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 @@ static size_t write_conf_or_var_desc(FIL 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 @@ static size_t type_memsize(const type_t 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 @@ static int write_pointers(FILE *file, co 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 @@ static size_t write_string_tfs(FILE *fil 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 @@ static size_t write_struct_members(FILE 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 @@ static size_t write_typeformatstring_var
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 @@ static size_t write_typeformatstring_var 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 @@ static unsigned int get_required_buffer_ 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 @@ static unsigned int get_required_buffer_ 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 @@ unsigned int get_required_buffer_size(co 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 @@ unsigned int get_required_buffer_size(co { 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 @@ void print_phase_basetype(FILE *file, in if (phase != PHASE_MARSHAL && phase != PHASE_UNMARSHAL) return;
- rtype = ref_type(type); + rtype = type->type;
switch (rtype) { @@ -1781,7 +1744,7 @@ void write_remoting_arguments(FILE *file 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 @@ void init_types(void); 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);