widl: Check function return values for additional prototype types.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2019-01-29 15:46:30 +01:00 committed by Alexandre Julliard
parent c68b5eb850
commit 759a3bf34d
3 changed files with 73 additions and 74 deletions

View File

@ -637,15 +637,9 @@ unsigned int get_generic_handle_offset( const type_t *type )
/* check for types which require additional prototypes to be generated in the /* check for types which require additional prototypes to be generated in the
* header */ * header */
void check_for_additional_prototype_types(const var_list_t *list) void check_for_additional_prototype_types(type_t *type)
{ {
const var_t *v; if (!type) return;
if (!list) return;
LIST_FOR_EACH_ENTRY( v, list, const var_t, entry )
{
type_t *type = v->type;
if (!type) continue;
for (;;) { for (;;) {
const char *name = type->name; const char *name = type->name;
if (type->user_types_registered) break; if (type->user_types_registered) break;
@ -686,6 +680,7 @@ void check_for_additional_prototype_types(const var_list_t *list)
else if (type_is_complete(type)) else if (type_is_complete(type))
{ {
var_list_t *vars; var_list_t *vars;
const var_t *v;
switch (type_get_type_detect_alias(type)) switch (type_get_type_detect_alias(type))
{ {
case TYPE_ENUM: case TYPE_ENUM:
@ -701,7 +696,8 @@ void check_for_additional_prototype_types(const var_list_t *list)
vars = NULL; vars = NULL;
break; break;
} }
check_for_additional_prototype_types(vars); if (vars) LIST_FOR_EACH_ENTRY( v, vars, const var_t, entry )
check_for_additional_prototype_types(v->type);
} }
if (type_is_alias(type)) if (type_is_alias(type))
@ -714,7 +710,6 @@ void check_for_additional_prototype_types(const var_list_t *list)
break; break;
} }
} }
}
static int write_serialize_function_decl(FILE *header, const type_t *type) static int write_serialize_function_decl(FILE *header, const type_t *type)
{ {

View File

@ -2911,6 +2911,7 @@ static void check_statements(const statement_list_t *stmts, int is_inside_librar
static void check_all_user_types(const statement_list_t *stmts) static void check_all_user_types(const statement_list_t *stmts)
{ {
const statement_t *stmt; const statement_t *stmt;
const var_t *v;
if (stmts) LIST_FOR_EACH_ENTRY(stmt, stmts, const statement_t, entry) if (stmts) LIST_FOR_EACH_ENTRY(stmt, stmts, const statement_t, entry)
{ {
@ -2922,7 +2923,10 @@ static void check_all_user_types(const statement_list_t *stmts)
const statement_t *stmt_func; const statement_t *stmt_func;
STATEMENTS_FOR_EACH_FUNC(stmt_func, type_iface_get_stmts(stmt->u.type)) { STATEMENTS_FOR_EACH_FUNC(stmt_func, type_iface_get_stmts(stmt->u.type)) {
const var_t *func = stmt_func->u.var; const var_t *func = stmt_func->u.var;
check_for_additional_prototype_types(func->type->details.function->args); if (func->type->details.function->args)
LIST_FOR_EACH_ENTRY( v, func->type->details.function->args, const var_t, entry )
check_for_additional_prototype_types(v->type);
check_for_additional_prototype_types(type_function_get_rettype(func->type));
} }
} }
} }

View File

@ -556,7 +556,7 @@ typedef enum {
extern user_type_list_t user_type_list; extern user_type_list_t user_type_list;
extern context_handle_list_t context_handle_list; extern context_handle_list_t context_handle_list;
extern generic_handle_list_t generic_handle_list; extern generic_handle_list_t generic_handle_list;
void check_for_additional_prototype_types(const var_list_t *list); void check_for_additional_prototype_types(type_t *type);
void init_types(void); void init_types(void);
type_t *alloc_type(void); type_t *alloc_type(void);