From: Bernhard Kölbl bkoelbl@codeweavers.com
--- tools/widl/attribute.c | 2 +- tools/widl/header.c | 18 ++++++++++++++++-- 2 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/tools/widl/attribute.c b/tools/widl/attribute.c index 9af4e7b51de..5ea13a01175 100644 --- a/tools/widl/attribute.c +++ b/tools/widl/attribute.c @@ -157,7 +157,7 @@ struct allowed_attr allowed_attr[] = /* ATTR_DEFAULTCOLLELEM */ { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "defaultcollelem" }, /* ATTR_DEFAULTVALUE */ { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "defaultvalue" }, /* ATTR_DEFAULTVTABLE */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, "defaultvtable" }, - /* ATTR_DEPRECATED */ { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "deprecated" }, + /* ATTR_DEPRECATED */ { 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, "deprecated" }, /* ATTR_DISABLECONSISTENCYCHECK */{ 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "disable_consistency_check" }, /* ATTR_DISPINTERFACE */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, NULL }, /* ATTR_DISPLAYBIND */ { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "displaybind" }, diff --git a/tools/widl/header.c b/tools/widl/header.c index a5d43241a35..2b617c3ace1 100644 --- a/tools/widl/header.c +++ b/tools/widl/header.c @@ -171,7 +171,7 @@ static void write_deprecated(FILE *h, const expr_t *deprecated_attr) write_apicontract_guard_end( h, contract_req ); } else - warning( "Deprecated attributes without explicit contract declaration are not supported, yet.\n" ); + warning( "Deprecation attributes without explicit contract declaration are not supported, yet.\n" ); }
static void write_fields(FILE *h, var_list_t *fields, enum name_type name_type) @@ -1679,6 +1679,7 @@ static void write_widl_using_macros(FILE *header, type_t *iface)
static void write_com_interface_end(FILE *header, type_t *iface) { + const expr_t *deprecated = get_attrp(iface->attrs, ATTR_DEPRECATED); int dispinterface = is_attr(iface->attrs, ATTR_DISPINTERFACE); const struct uuid *uuid = get_attrp(iface->attrs, ATTR_UUID); expr_t *contract = get_attrp(iface->attrs, ATTR_CONTRACT); @@ -1696,6 +1697,7 @@ static void write_com_interface_end(FILE *header, type_t *iface) if (uuid) { if (strchr(iface->name, '<')) write_line(header, 0, "template<>"); write_line(header, 0, "MIDL_INTERFACE("%s")", uuid_string(uuid)); + if (deprecated) write_deprecated(header, deprecated); indent(header, 0); }else { indent(header, 0); @@ -1734,7 +1736,16 @@ static void write_com_interface_end(FILE *header, type_t *iface) write_uuid_decl(header, iface, uuid); fprintf(header, "#else\n"); /* C interface */ - write_line(header, 1, "typedef struct %sVtbl {", iface->c_name); + indent(header, 1); + fprintf(header, "typedef struct"); + if (deprecated) + { + fprintf(header, "\n"); + write_deprecated(header, deprecated); + } + else + fprintf(header, " "); + fprintf(header, "%sVtbl {\n", iface->c_name); write_line(header, 0, "BEGIN_INTERFACE\n"); if (dispinterface) write_c_disp_method_def(header, iface); @@ -1858,7 +1869,9 @@ static void write_apicontract(FILE *header, type_t *apicontract)
static void write_runtimeclass(FILE *header, type_t *runtimeclass) { + const expr_t *deprecated = get_attrp(runtimeclass->attrs, ATTR_DEPRECATED); expr_t *contract = get_attrp(runtimeclass->attrs, ATTR_CONTRACT); + char *name, *c_name; size_t i, len; name = format_namespace(runtimeclass->namespace, "", ".", runtimeclass->name, NULL); @@ -1874,6 +1887,7 @@ static void write_runtimeclass(FILE *header, type_t *runtimeclass) for (i = 0, len = strlen(name); i < len; ++i) fprintf(header, "'%c',", name[i]); fprintf(header, "0};\n"); fprintf(header, "#elif defined(__GNUC__) && !defined(__cplusplus)\n"); + if (deprecated) write_deprecated(header, deprecated); /* FIXME: MIDL generates extern const here but GCC warns if extern is initialized */ fprintf(header, "const DECLSPEC_SELECTANY WCHAR RuntimeClass_%s[] = L"%s";\n", c_name, name); fprintf(header, "#else\n");