Rémi Bernon : widl: Generate typedefs for namespaced struct / enum types.
Alexandre Julliard
julliard at winehq.org
Tue Mar 23 16:54:32 CDT 2021
Module: wine
Branch: master
Commit: 2a7940c97d4e6cd2adace1acb0ca163f12a0da09
URL: https://source.winehq.org/git/wine.git/?a=commit;h=2a7940c97d4e6cd2adace1acb0ca163f12a0da09
Author: Rémi Bernon <rbernon at codeweavers.com>
Date: Tue Mar 23 18:20:47 2021 +0100
widl: Generate typedefs for namespaced struct / enum types.
Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
tools/widl/header.c | 24 +++++++++++++++++++-----
1 file changed, 19 insertions(+), 5 deletions(-)
diff --git a/tools/widl/header.c b/tools/widl/header.c
index a5e5d6c6fb3..1a69b298e7d 100644
--- a/tools/widl/header.c
+++ b/tools/widl/header.c
@@ -872,11 +872,25 @@ static void write_generic_handle_routines(FILE *header)
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)) return;
- fprintf(header, "typedef ");
- write_type_v(header, type_alias_get_aliasee(type), FALSE, declonly, type->name, NAME_DEFAULT);
- fprintf(header, ";\n");
+ 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, "typedef ");
+ write_type_v(header, type_alias_get_aliasee(type), FALSE, declonly, type->c_name, NAME_C);
+ fprintf(header, ";\n");
+ fprintf(header, "#endif /* __cplusplus */\n\n");
+ }
}
int is_const_decl(const var_t *var)
More information about the wine-cvs
mailing list