widl [3/9]: Silence GCC warnings in generated code using Wine SEH.
Dan Hipschman
dsh at linux.ucla.edu
Fri Nov 9 18:06:45 CST 2007
Apparently GCC can't tell that some variables won't be used
uninitialized with the Wine SEH, so this patches widl to initialize
them just to shut GCC up.
---
tools/widl/typegen.c | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/tools/widl/typegen.c b/tools/widl/typegen.c
index bb75a0a..f09d8aa 100644
--- a/tools/widl/typegen.c
+++ b/tools/widl/typegen.c
@@ -55,6 +55,7 @@ struct expr_eval_routine
const expr_t *expr;
};
+static inline int is_base_type(unsigned char type);
static size_t fields_memsize(const var_list_t *fields, unsigned int *align);
static size_t write_struct_tfs(FILE *file, type_t *type, const char *name, unsigned int *tfsoff);
static int write_embedded_types(FILE *file, const attr_list_t *attrs, type_t *type,
@@ -340,6 +341,12 @@ void write_parameters_init(FILE *file, int indent, const func_t *func)
print_file(file, indent, "MIDL_memset(&%s, 0, sizeof %s);\n", n, n);
else if (is_ptr(t) || is_array(t))
print_file(file, indent, "%s = 0;\n", n);
+ else
+ {
+ assert(is_base_type(t->type));
+ print_file(file, indent, "/* Initialize these to avoid GCC warnings. */\n");
+ print_file(file, indent, "%s = 0;\n", n);
+ }
}
fprintf(file, "\n");
More information about the wine-patches
mailing list