widl: Detect interfaces that inherit from another interface as objects.
This commit is contained in:
parent
ed26bb09c5
commit
6ed98b16a1
|
@ -691,10 +691,12 @@ int has_out_arg_or_return(const var_t *func)
|
|||
|
||||
/********** INTERFACES **********/
|
||||
|
||||
int is_object(const attr_list_t *list)
|
||||
int is_object(const type_t *iface)
|
||||
{
|
||||
const attr_t *attr;
|
||||
if (list) LIST_FOR_EACH_ENTRY( attr, list, const attr_t, entry )
|
||||
if (type_is_defined(iface) && type_iface_get_inherit(iface))
|
||||
return 1;
|
||||
if (iface->attrs) LIST_FOR_EACH_ENTRY( attr, iface->attrs, const attr_t, entry )
|
||||
if (attr->type == ATTR_OBJECT || attr->type == ATTR_ODL) return 1;
|
||||
return 0;
|
||||
}
|
||||
|
@ -866,7 +868,7 @@ static void write_locals(FILE *fp, const type_t *iface, int body)
|
|||
= "/* WIDL-generated stub. You must provide an implementation for this. */";
|
||||
const statement_t *stmt;
|
||||
|
||||
if (!is_object(iface->attrs))
|
||||
if (!is_object(iface))
|
||||
return;
|
||||
|
||||
STATEMENTS_FOR_EACH_FUNC(stmt, type_iface_get_stmts(iface)) {
|
||||
|
@ -1180,7 +1182,7 @@ static void write_forward_decls(FILE *header, const statement_list_t *stmts)
|
|||
case STMT_TYPE:
|
||||
if (type_get_type(stmt->u.type) == TYPE_INTERFACE)
|
||||
{
|
||||
if (is_object(stmt->u.type->attrs) || is_attr(stmt->u.type->attrs, ATTR_DISPINTERFACE))
|
||||
if (is_object(stmt->u.type) || is_attr(stmt->u.type->attrs, ATTR_DISPINTERFACE))
|
||||
write_forward(header, stmt->u.type);
|
||||
}
|
||||
else if (type_get_type(stmt->u.type) == TYPE_COCLASS)
|
||||
|
@ -1215,7 +1217,7 @@ static void write_header_stmts(FILE *header, const statement_list_t *stmts, cons
|
|||
if (type_get_type(stmt->u.type) == TYPE_INTERFACE)
|
||||
{
|
||||
type_t *iface = stmt->u.type;
|
||||
if (is_attr(stmt->u.type->attrs, ATTR_DISPINTERFACE) || is_object(stmt->u.type->attrs))
|
||||
if (is_attr(stmt->u.type->attrs, ATTR_DISPINTERFACE) || is_object(stmt->u.type))
|
||||
{
|
||||
write_com_interface_start(header, iface);
|
||||
write_header_stmts(header, type_iface_get_stmts(iface), stmt->u.type, TRUE);
|
||||
|
|
|
@ -38,7 +38,7 @@ extern void write_type_def_or_decl(FILE *h, type_t *t, int is_field, const char
|
|||
extern void write_type_decl(FILE *f, type_t *t, const char *name);
|
||||
extern void write_type_decl_left(FILE *f, type_t *t);
|
||||
extern int needs_space_after(type_t *t);
|
||||
extern int is_object(const attr_list_t *list);
|
||||
extern int is_object(const type_t *iface);
|
||||
extern int is_local(const attr_list_t *list);
|
||||
extern int need_stub(const type_t *iface);
|
||||
extern int need_proxy(const type_t *iface);
|
||||
|
|
|
@ -841,7 +841,7 @@ dispinterfacedef: dispinterfacehdr '{'
|
|||
;
|
||||
|
||||
inherit: { $$ = NULL; }
|
||||
| ':' aKNOWNTYPE { $$ = find_type_or_error2($2, 0); }
|
||||
| ':' aKNOWNTYPE { $$ = find_type_or_error2($2, 0); is_object_interface = 1; }
|
||||
;
|
||||
|
||||
interface: tINTERFACE aIDENTIFIER { $$ = get_type(TYPE_INTERFACE, $2, 0); }
|
||||
|
@ -852,9 +852,9 @@ interfacehdr: attributes interface { $$.interface = $2;
|
|||
$$.old_pointer_default = pointer_default;
|
||||
if (is_attr($1, ATTR_POINTERDEFAULT))
|
||||
pointer_default = get_attrv($1, ATTR_POINTERDEFAULT);
|
||||
is_object_interface = is_object($1);
|
||||
check_def($2);
|
||||
$2->attrs = check_iface_attrs($2->name, $1);
|
||||
is_object_interface = is_object($2);
|
||||
$2->defined = TRUE;
|
||||
}
|
||||
;
|
||||
|
|
|
@ -698,12 +698,12 @@ static int does_any_iface(const statement_list_t *stmts, type_pred_t pred)
|
|||
|
||||
int need_proxy(const type_t *iface)
|
||||
{
|
||||
return is_object(iface->attrs) && !is_local(iface->attrs);
|
||||
return is_object(iface) && !is_local(iface->attrs);
|
||||
}
|
||||
|
||||
int need_stub(const type_t *iface)
|
||||
{
|
||||
return !is_object(iface->attrs) && !is_local(iface->attrs);
|
||||
return !is_object(iface) && !is_local(iface->attrs);
|
||||
}
|
||||
|
||||
int need_proxy_file(const statement_list_t *stmts)
|
||||
|
|
|
@ -431,7 +431,7 @@ static void write_id_data_stmts(const statement_list_t *stmts)
|
|||
if (type_get_type(type) == TYPE_INTERFACE)
|
||||
{
|
||||
const UUID *uuid;
|
||||
if (!is_object(type->attrs) && !is_attr(type->attrs, ATTR_DISPINTERFACE))
|
||||
if (!is_object(type) && !is_attr(type->attrs, ATTR_DISPINTERFACE))
|
||||
continue;
|
||||
uuid = get_attrp(type->attrs, ATTR_UUID);
|
||||
write_guid(idfile, is_attr(type->attrs, ATTR_DISPINTERFACE) ? "DIID" : "IID",
|
||||
|
|
Loading…
Reference in New Issue