Rémi Bernon : widl: Do not generate C++ enum typedefs in WinRT mode.
Alexandre Julliard
julliard at winehq.org
Tue Jan 25 15:41:19 CST 2022
Module: wine
Branch: master
Commit: 86c565cf0e49eed6909ff0dcda78edae31559593
URL: https://source.winehq.org/git/wine.git/?a=commit;h=86c565cf0e49eed6909ff0dcda78edae31559593
Author: Rémi Bernon <rbernon at codeweavers.com>
Date: Tue Jan 25 10:13:35 2022 +0100
widl: Do not generate C++ enum typedefs in WinRT mode.
MIDL generates enum typedefs without a prior type declaration, as well
as using explicit enum underlying type specifier. None of this is
supported in MinGW.
Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
tools/widl/header.c | 28 +++++++++++++++++-----------
1 file changed, 17 insertions(+), 11 deletions(-)
diff --git a/tools/widl/header.c b/tools/widl/header.c
index ce2f9064c38..dfe5b42bcb9 100644
--- a/tools/widl/header.c
+++ b/tools/widl/header.c
@@ -872,22 +872,28 @@ static void write_typedef(FILE *header, type_t *type, int declonly)
type_t *t = type_alias_get_aliasee_type(type);
if (winrt_mode && t->namespace && !is_global_namespace(t->namespace))
{
- fprintf(header, "#ifdef __cplusplus\n");
- write_namespace_start(header, t->namespace);
- indent(header, 0);
- }
- fprintf(header, "typedef ");
- write_type_v(header, type_alias_get_aliasee(type), FALSE, declonly, type->name, NAME_DEFAULT);
- fprintf(header, ";\n");
- if (winrt_mode && t->namespace && !is_global_namespace(t->namespace))
- {
- write_namespace_end(header, t->namespace);
- fprintf(header, "#else /* __cplusplus */\n");
+ fprintf(header, "#ifndef __cplusplus\n");
fprintf(header, "typedef ");
write_type_v(header, type_alias_get_aliasee(type), FALSE, declonly, type->c_name, NAME_C);
fprintf(header, ";\n");
+ if (type_get_type_detect_alias(t) != TYPE_ENUM)
+ {
+ fprintf(header, "#else /* __cplusplus */\n");
+ write_namespace_start(header, t->namespace);
+ indent(header, 0);
+ fprintf(header, "typedef ");
+ write_type_v(header, type_alias_get_aliasee(type), FALSE, declonly, type->name, NAME_DEFAULT);
+ fprintf(header, ";\n");
+ write_namespace_end(header, t->namespace);
+ }
fprintf(header, "#endif /* __cplusplus */\n\n");
}
+ else
+ {
+ fprintf(header, "typedef ");
+ write_type_v(header, type_alias_get_aliasee(type), FALSE, declonly, type->name, NAME_DEFAULT);
+ fprintf(header, ";\n");
+ }
}
int is_const_decl(const var_t *var)
More information about the wine-cvs
mailing list