From: Elizabeth Figura zfigura@codeweavers.com
--- tools/widl/typegen.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/widl/typegen.c b/tools/widl/typegen.c index 0777de77bf0..4401767c9f3 100644 --- a/tools/widl/typegen.c +++ b/tools/widl/typegen.c @@ -2382,7 +2382,7 @@ static unsigned int write_nonsimple_pointer(FILE *file, const attr_list_t *attrs
if (!is_interpreted_func(current_iface, current_func)) { - if (out_attr && !in_attr && pointer_type == FC_RP) + if (context == TYPE_CONTEXT_TOPLEVELPARAM && out_attr && !in_attr && pointer_type == FC_RP) flags |= FC_ALLOCED_ON_STACK; } else @@ -2466,7 +2466,7 @@ static unsigned int write_simple_pointer(FILE *file, const attr_list_t *attrs,
if (!is_interpreted_func(current_iface, current_func)) { - if (out_attr && !in_attr && pointer_fc == FC_RP) + if (context == TYPE_CONTEXT_TOPLEVELPARAM && out_attr && !in_attr && pointer_fc == FC_RP) flags |= FC_ALLOCED_ON_STACK; } else
From: Elizabeth Figura zfigura@codeweavers.com
It's barely doing anything anymore after 06e7eb5c98d473cf1edc828c67f6a6586a94e2f7. --- tools/widl/typegen.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-)
diff --git a/tools/widl/typegen.c b/tools/widl/typegen.c index 4401767c9f3..9f2a78d74f7 100644 --- a/tools/widl/typegen.c +++ b/tools/widl/typegen.c @@ -91,12 +91,14 @@ static unsigned int fields_memsize(const var_list_t *fields, unsigned int *align static unsigned int write_array_tfs(FILE *file, const attr_list_t *attrs, type_t *type, const char *name, unsigned int *typestring_offset); static unsigned int 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, - const char *name, int write_ptr, unsigned int *tfsoff); static const var_t *find_array_or_string_in_struct(const type_t *type); static unsigned int write_string_tfs(FILE *file, const attr_list_t *attrs, type_t *type, enum type_context context, const char *name, unsigned int *typestring_offset); +static unsigned int write_type_tfs(FILE *file, const attr_list_t *attrs, + type_t *type, const char *name, + enum type_context context, + unsigned int *typeformat_offset); static unsigned int get_required_buffer_size_type( const type_t *type, const char *name, const attr_list_t *attrs, int toplevel_param, unsigned int *alignment ); @@ -2578,7 +2580,7 @@ static unsigned int write_user_tfs(FILE *file, type_t *type, unsigned int *tfsof else { if (!processed(utype)) - write_embedded_types(file, NULL, utype, utype->name, TRUE, tfsoff); + write_type_tfs(file, NULL, utype, utype->name, TYPE_CONTEXT_CONTAINER, tfsoff); absoff = utype->typestring_offset; }
@@ -3238,7 +3240,8 @@ static unsigned int write_array_tfs(FILE *file, const attr_list_t *attrs, type_t : 0;
if (!is_string_type(attrs, type_array_get_element_type(type))) - write_embedded_types(file, attrs, type_array_get_element_type(type), name, FALSE, typestring_offset); + write_type_tfs(file, attrs, type_array_get_element_type(type), + name, TYPE_CONTEXT_CONTAINER_NO_POINTERS, typestring_offset);
size = type_memsize(is_conformant_array(type) ? type_array_get_element_type(type) : type); align = type_buffer_alignment(is_conformant_array(type) ? type_array_get_element_type(type) : type); @@ -3415,7 +3418,7 @@ static unsigned int write_struct_tfs(FILE *file, type_t *type, name, USHRT_MAX, total_size - USHRT_MAX);
if (fields) LIST_FOR_EACH_ENTRY(f, fields, var_t, entry) - write_embedded_types(file, f->attrs, f->declspec.type, f->name, FALSE, tfsoff); + write_type_tfs(file, f->attrs, f->declspec.type, f->name, TYPE_CONTEXT_CONTAINER_NO_POINTERS, tfsoff);
array = find_array_or_string_in_struct(type); if (array && !processed(array->declspec.type)) @@ -3582,7 +3585,7 @@ static unsigned int write_union_tfs(FILE *file, const attr_list_t *attrs, if (cases) nbranch += list_count(cases); if (f->declspec.type) - write_embedded_types(file, f->attrs, f->declspec.type, f->name, TRUE, tfsoff); + write_type_tfs(file, f->attrs, f->declspec.type, f->name, TYPE_CONTEXT_CONTAINER, tfsoff); }
start_offset = *tfsoff; @@ -3929,12 +3932,6 @@ static unsigned int write_type_tfs(FILE *file, const attr_list_t *attrs, return 0; }
-static int write_embedded_types(FILE *file, const attr_list_t *attrs, type_t *type, - const char *name, int write_ptr, unsigned int *tfsoff) -{ - return write_type_tfs(file, attrs, type, name, write_ptr ? TYPE_CONTEXT_CONTAINER : TYPE_CONTEXT_CONTAINER_NO_POINTERS, tfsoff); -} - static void process_tfs_iface(type_t *iface, FILE *file, int indent, unsigned int *offset) { const statement_list_t *stmts = type_iface_get_stmts(iface);
From: Elizabeth Figura zfigura@codeweavers.com
Some attributes, namely [iid_is], [string], [switch_is], and [switch_type], apply to the innermost type. That is, when specified on a top-level parameter like
int func(..., [iid_is(...)] void ****arg);
the innermost pointee ***arg must have an iid type.
At the same time, the pointer type attributes [ref], [unique], [ptr] must *only* apply to the top-level pointer. Inner pointers have the default pointer type.
In order to implement this, we always pass "attrs" to inner array and pointer types, and we also pass around an extra parameter "toplevel_attrs" which signifies whether the passed-in attributes should be applied directly to this type (having come from a parameter, field, or typedef), or whether they were inherited from a higher-level pointer. --- tools/widl/typegen.c | 247 ++++++++++++++++++++++--------------------- tools/widl/typegen.h | 1 - 2 files changed, 125 insertions(+), 123 deletions(-)
diff --git a/tools/widl/typegen.c b/tools/widl/typegen.c index 9f2a78d74f7..a4b8ac0abca 100644 --- a/tools/widl/typegen.c +++ b/tools/widl/typegen.c @@ -88,20 +88,18 @@ static const unsigned short RobustIsIIdIs = 0x0004;
static unsigned int field_memsize(const type_t *type, unsigned int *offset); static unsigned int fields_memsize(const var_list_t *fields, unsigned int *align); -static unsigned int write_array_tfs(FILE *file, const attr_list_t *attrs, type_t *type, +static unsigned int write_array_tfs(FILE *file, const attr_list_t *attrs, int toplevel_attrs, type_t *type, const char *name, unsigned int *typestring_offset); -static unsigned int write_struct_tfs(FILE *file, type_t *type, const char *name, unsigned int *tfsoff); static const var_t *find_array_or_string_in_struct(const type_t *type); -static unsigned int write_string_tfs(FILE *file, const attr_list_t *attrs, +static unsigned int write_string_tfs(FILE *file, const attr_list_t *attrs, int toplevel_attrs, type_t *type, enum type_context context, const char *name, unsigned int *typestring_offset); -static unsigned int write_type_tfs(FILE *file, const attr_list_t *attrs, +static unsigned int write_type_tfs(FILE *file, const attr_list_t *attrs, int toplevel_attrs, type_t *type, const char *name, enum type_context context, unsigned int *typeformat_offset); static unsigned int get_required_buffer_size_type( const type_t *type, const char *name, - const attr_list_t *attrs, int toplevel_param, - unsigned int *alignment ); + const attr_list_t *attrs, int toplevel_attrs, int toplevel_param, unsigned int *alignment ); static unsigned int get_function_buffer_size( const var_t *func, enum pass pass );
static const char *string_of_type(unsigned char type) @@ -247,16 +245,20 @@ static inline unsigned int clamp_align(unsigned int align) return align; }
-unsigned char get_pointer_fc(const type_t *type, const attr_list_t *attrs, int toplevel_param) +static unsigned char get_pointer_fc(const type_t *type, const attr_list_t *attrs, + int toplevel_attrs, int toplevel_param) { const type_t *t; int pointer_type;
assert(is_ptr(type) || is_array(type));
- pointer_type = get_attrv(attrs, ATTR_POINTERTYPE); - if (pointer_type) - return pointer_type; + if (toplevel_attrs) + { + pointer_type = get_attrv(attrs, ATTR_POINTERTYPE); + if (pointer_type) + return pointer_type; + }
for (t = type; type_is_alias(t); t = type_alias_get_aliasee_type(t)) { @@ -275,9 +277,9 @@ unsigned char get_pointer_fc(const type_t *type, const attr_list_t *attrs, int t }
static unsigned char get_pointer_fc_context( const type_t *type, const attr_list_t *attrs, - enum type_context context ) + int toplevel_attrs, enum type_context context ) { - int pointer_fc = get_pointer_fc(type, attrs, context == TYPE_CONTEXT_TOPLEVELPARAM); + int pointer_fc = get_pointer_fc(type, attrs, toplevel_attrs, context == TYPE_CONTEXT_TOPLEVELPARAM);
if (pointer_fc == FC_UP && is_attr( attrs, ATTR_OUT ) && (context == TYPE_CONTEXT_PARAM || context == TYPE_CONTEXT_RETVAL) && is_object( current_iface )) @@ -387,7 +389,7 @@ static int cant_be_null(const var_t *v) if (!type_array_is_decl_as_ptr( v->declspec.type )) return 0; /* fall through */ case TGT_POINTER: - return (get_pointer_fc(v->declspec.type, v->attrs, TRUE) == FC_RP); + return (get_pointer_fc(v->declspec.type, v->attrs, TRUE, TRUE) == FC_RP); case TGT_CTXT_HANDLE_POINTER: return TRUE; default: @@ -577,7 +579,7 @@ unsigned char get_struct_fc(const type_t *type) break; case TGT_POINTER: case TGT_ARRAY: - if (get_pointer_fc(t, field->attrs, FALSE) == FC_RP || pointer_size != 4) + if (get_pointer_fc(t, field->attrs, TRUE, FALSE) == FC_RP || pointer_size != 4) return FC_BOGUS_STRUCT; has_pointer = 1; break; @@ -654,7 +656,7 @@ unsigned char get_struct_fc(const type_t *type) return FC_STRUCT; }
-static unsigned char get_array_fc(const type_t *type) +static unsigned char get_array_fc(const type_t *type, const attr_list_t *attrs) { unsigned char fc; const expr_t *size_is; @@ -684,7 +686,7 @@ static unsigned char get_array_fc(const type_t *type) fc = FC_CVARRAY; }
- switch (typegen_detect_type(elem_type, NULL, TDT_IGNORE_STRINGS)) + switch (typegen_detect_type(elem_type, attrs, TDT_IGNORE_STRINGS)) { case TGT_USER_TYPE: fc = FC_BOGUS_ARRAY; @@ -716,7 +718,7 @@ static unsigned char get_array_fc(const type_t *type) /* ref pointers cannot just be block copied. unique pointers to * interfaces need special treatment. either case means the array is * complex */ - if (get_pointer_fc(elem_type, NULL, FALSE) == FC_RP || pointer_size != 4) + if (get_pointer_fc(elem_type, attrs, FALSE, FALSE) == FC_RP || pointer_size != 4) fc = FC_BOGUS_ARRAY; break; case TGT_RANGE: @@ -740,23 +742,23 @@ static int is_non_complex_struct(const type_t *type) get_struct_fc(type) != FC_BOGUS_STRUCT); }
-static int type_has_pointers(const type_t *type) +static int type_has_pointers(const type_t *type, const attr_list_t *attrs) { - switch (typegen_detect_type(type, NULL, TDT_IGNORE_STRINGS)) + switch (typegen_detect_type(type, attrs, TDT_IGNORE_STRINGS)) { case TGT_USER_TYPE: return FALSE; case TGT_POINTER: return TRUE; case TGT_ARRAY: - return type_array_is_decl_as_ptr(type) || type_has_pointers(type_array_get_element_type(type)); + return type_array_is_decl_as_ptr(type) || type_has_pointers(type_array_get_element_type(type), attrs); case TGT_STRUCT: { var_list_t *fields = type_struct_get_fields(type); const var_t *field; if (fields) LIST_FOR_EACH_ENTRY( field, fields, const var_t, entry ) { - if (type_has_pointers(field->declspec.type)) + if (type_has_pointers(field->declspec.type, attrs)) return TRUE; } break; @@ -768,7 +770,7 @@ static int type_has_pointers(const type_t *type) fields = type_union_get_cases(type); if (fields) LIST_FOR_EACH_ENTRY( field, fields, const var_t, entry ) { - if (field->declspec.type && type_has_pointers(field->declspec.type)) + if (field->declspec.type && type_has_pointers(field->declspec.type, attrs)) return TRUE; } break; @@ -820,23 +822,23 @@ static inline int array_reserve(void **elements, size_t *capacity, size_t count, return TRUE; }
-static int type_has_full_pointer_recurse(const type_t *type, const attr_list_t *attrs, +static int type_has_full_pointer_recurse(const type_t *type, const attr_list_t *attrs, int toplevel_attrs, int toplevel_param, struct visited_struct_array *visited_structs) { - switch (typegen_detect_type(type, NULL, TDT_IGNORE_STRINGS)) + switch (typegen_detect_type(type, attrs, TDT_IGNORE_STRINGS)) { case TGT_USER_TYPE: return FALSE; case TGT_POINTER: - if (get_pointer_fc(type, attrs, toplevel_param) == FC_FP) + if (get_pointer_fc(type, attrs, toplevel_attrs, toplevel_param) == FC_FP) return TRUE; else - return type_has_full_pointer_recurse(type_pointer_get_ref_type(type), NULL, FALSE, visited_structs); + return type_has_full_pointer_recurse(type_pointer_get_ref_type(type), attrs, FALSE, FALSE, visited_structs); case TGT_ARRAY: - if (get_pointer_fc(type, attrs, toplevel_param) == FC_FP) + if (get_pointer_fc(type, attrs, toplevel_attrs, toplevel_param) == FC_FP) return TRUE; else - return type_has_full_pointer_recurse(type_array_get_element_type(type), NULL, FALSE, visited_structs); + return type_has_full_pointer_recurse(type_array_get_element_type(type), attrs, FALSE, FALSE, visited_structs); case TGT_STRUCT: { unsigned int i; @@ -860,7 +862,7 @@ static int type_has_full_pointer_recurse(const type_t *type, const attr_list_t * visited_structs->count++; if (fields) LIST_FOR_EACH_ENTRY( field, fields, const var_t, entry ) { - if (type_has_full_pointer_recurse(field->declspec.type, field->attrs, FALSE, visited_structs)) + if (type_has_full_pointer_recurse(field->declspec.type, field->attrs, TRUE, FALSE, visited_structs)) { ret = TRUE; break; @@ -876,7 +878,7 @@ static int type_has_full_pointer_recurse(const type_t *type, const attr_list_t * fields = type_union_get_cases(type); if (fields) LIST_FOR_EACH_ENTRY( field, fields, const var_t, entry ) { - if (field->declspec.type && type_has_full_pointer_recurse(field->declspec.type, field->attrs, FALSE, visited_structs)) + if (field->declspec.type && type_has_full_pointer_recurse(field->declspec.type, field->attrs, TRUE, FALSE, visited_structs)) return TRUE; } break; @@ -895,11 +897,11 @@ static int type_has_full_pointer_recurse(const type_t *type, const attr_list_t * return FALSE; }
-static int type_has_full_pointer(const type_t *type, const attr_list_t *attrs, int toplevel_param) +static int type_has_full_pointer(const type_t *type, const attr_list_t *attrs, int toplevel_attrs, int toplevel_param) { int ret; struct visited_struct_array visited_structs = {0}; - ret = type_has_full_pointer_recurse(type, attrs, toplevel_param, &visited_structs); + ret = type_has_full_pointer_recurse(type, attrs, toplevel_attrs, toplevel_param, &visited_structs); free(visited_structs.structs); return ret; } @@ -935,9 +937,9 @@ static void guard_rec(type_t *type) type->typestring_offset = 1; }
-static int is_embedded_complex(const type_t *type) +static int is_embedded_complex(const type_t *type, const attr_list_t *attrs) { - switch (typegen_detect_type(type, NULL, TDT_ALL_TYPES)) + switch (typegen_detect_type(type, attrs, TDT_ALL_TYPES)) { case TGT_USER_TYPE: case TGT_STRUCT: @@ -1080,7 +1082,7 @@ static unsigned char get_parameter_fc( const var_t *var, int is_return, unsigned if (is_return) *flags |= IsReturn;
if (!is_string_type( var->attrs, var->declspec.type )) - buffer_size = get_required_buffer_size_type( var->declspec.type, NULL, var->attrs, TRUE, &alignment ); + buffer_size = get_required_buffer_size_type( var->declspec.type, NULL, var->attrs, TRUE, TRUE, &alignment );
switch (typegen_detect_type( var->declspec.type, var->attrs, TDT_ALL_TYPES )) { @@ -1108,7 +1110,7 @@ static unsigned char get_parameter_fc( const var_t *var, int is_return, unsigned *flags |= MustFree; if (type_array_is_decl_as_ptr(var->declspec.type) && type_array_get_ptr_tfsoff(var->declspec.type) - && get_pointer_fc(var->declspec.type, var->attrs, !is_return) == FC_RP) + && get_pointer_fc(var->declspec.type, var->attrs, TRUE, !is_return) == FC_RP) { *typestring_offset = var->declspec.type->typestring_offset; *flags |= IsSimpleRef; @@ -1116,7 +1118,7 @@ static unsigned char get_parameter_fc( const var_t *var, int is_return, unsigned break; case TGT_STRING: *flags |= MustFree; - if (is_declptr( var->declspec.type ) && get_pointer_fc( var->declspec.type, var->attrs, !is_return ) == FC_RP) + if (is_declptr( var->declspec.type ) && get_pointer_fc( var->declspec.type, var->attrs, TRUE, !is_return ) == FC_RP) { /* skip over pointer description straight to string description */ if (is_conformant_array( var->declspec.type )) *typestring_offset += 4; @@ -1132,12 +1134,12 @@ static unsigned char get_parameter_fc( const var_t *var, int is_return, unsigned buffer_size = 20; break; case TGT_POINTER: - if (get_pointer_fc( var->declspec.type, var->attrs, !is_return ) == FC_RP) + if (get_pointer_fc( var->declspec.type, var->attrs, TRUE, !is_return ) == FC_RP) { const type_t *ref = type_pointer_get_ref_type( var->declspec.type );
if (!is_string_type( var->attrs, ref )) - buffer_size = get_required_buffer_size_type( ref, NULL, NULL, TRUE, &alignment ); + buffer_size = get_required_buffer_size_type( ref, NULL, var->attrs, FALSE, TRUE, &alignment );
switch (typegen_detect_type( ref, var->attrs, TDT_ALL_TYPES )) { @@ -2341,12 +2343,12 @@ static unsigned int type_buffer_alignment(const type_t *t) int is_full_pointer_function(const var_t *func) { const var_t *var; - if (type_has_full_pointer(type_function_get_rettype(func->declspec.type), func->attrs, TRUE)) + if (type_has_full_pointer(type_function_get_rettype(func->declspec.type), func->attrs, TRUE, TRUE)) return TRUE; if (!type_function_get_args(func->declspec.type)) return FALSE; LIST_FOR_EACH_ENTRY( var, type_function_get_args(func->declspec.type), const var_t, entry ) - if (type_has_full_pointer( var->declspec.type, var->attrs, TRUE )) + if (type_has_full_pointer( var->declspec.type, var->attrs, TRUE, TRUE )) return TRUE; return FALSE; } @@ -2365,7 +2367,7 @@ void write_full_pointer_free(FILE *file, int indent, const var_t *func) }
static unsigned int write_nonsimple_pointer(FILE *file, const attr_list_t *attrs, - const type_t *type, + int toplevel_attrs, const type_t *type, enum type_context context, unsigned int offset, unsigned int *typeformat_offset) @@ -2376,7 +2378,7 @@ static unsigned int write_nonsimple_pointer(FILE *file, const attr_list_t *attrs int pointer_type; unsigned char flags = 0;
- pointer_type = get_pointer_fc_context(type, attrs, context); + pointer_type = get_pointer_fc_context(type, attrs, toplevel_attrs, context);
in_attr = is_attr(attrs, ATTR_IN); out_attr = is_attr(attrs, ATTR_OUT); @@ -2443,7 +2445,7 @@ static unsigned int write_nonsimple_pointer(FILE *file, const attr_list_t *attrs return start_offset; }
-static unsigned int write_simple_pointer(FILE *file, const attr_list_t *attrs, +static unsigned int write_simple_pointer(FILE *file, const attr_list_t *attrs, int toplevel_attrs, const type_t *type, enum type_context context) { unsigned char fc; @@ -2458,7 +2460,7 @@ static unsigned int write_simple_pointer(FILE *file, const attr_list_t *attrs, if (is_string_type(attrs, type)) error("write_simple_pointer: can't handle type %s which is a string type\n", type->name);
- pointer_fc = get_pointer_fc_context(type, attrs, context); + pointer_fc = get_pointer_fc_context(type, attrs, toplevel_attrs, context);
ref = type_pointer_get_ref_type(type); if (type_get_type(ref) == TYPE_ENUM) @@ -2493,7 +2495,7 @@ static void print_start_tfs_comment(FILE *file, type_t *t, unsigned int tfsoff) print_file(file, 0, ") */\n"); }
-static unsigned int write_pointer_tfs(FILE *file, const attr_list_t *attrs, +static unsigned int write_pointer_tfs(FILE *file, const attr_list_t *attrs, int toplevel_attrs, type_t *type, unsigned int ref_offset, enum type_context context, unsigned int *typestring_offset) @@ -2508,11 +2510,11 @@ static unsigned int write_pointer_tfs(FILE *file, const attr_list_t *attrs, { case TGT_BASIC: case TGT_ENUM: - *typestring_offset += write_simple_pointer(file, attrs, type, context); + *typestring_offset += write_simple_pointer(file, attrs, toplevel_attrs, type, context); break; default: if (ref_offset) - write_nonsimple_pointer(file, attrs, type, context, ref_offset, typestring_offset); + write_nonsimple_pointer(file, attrs, toplevel_attrs, type, context, ref_offset, typestring_offset); break; }
@@ -2580,13 +2582,13 @@ static unsigned int write_user_tfs(FILE *file, type_t *type, unsigned int *tfsof else { if (!processed(utype)) - write_type_tfs(file, NULL, utype, utype->name, TYPE_CONTEXT_CONTAINER, tfsoff); + write_type_tfs(file, NULL, FALSE, utype, utype->name, TYPE_CONTEXT_CONTAINER, tfsoff); absoff = utype->typestring_offset; }
- if (type_get_type(utype) == TYPE_POINTER && get_pointer_fc(utype, NULL, FALSE) == FC_RP) + if (type_get_type(utype) == TYPE_POINTER && get_pointer_fc(utype, NULL, FALSE, FALSE) == FC_RP) flags = 0x40; - else if (type_get_type(utype) == TYPE_POINTER && get_pointer_fc(utype, NULL, FALSE) == FC_UP) + else if (type_get_type(utype) == TYPE_POINTER && get_pointer_fc(utype, NULL, FALSE, FALSE) == FC_UP) flags = 0x80; else flags = 0; @@ -2612,7 +2614,7 @@ static void write_member_type(FILE *file, const type_t *cont, const type_t *type, unsigned int *corroff, unsigned int *tfsoff) { - if (is_embedded_complex(type) && !is_conformant_array(type)) + if (is_embedded_complex(type, attrs) && !is_conformant_array(type)) { unsigned int absoff; short reloff; @@ -2652,29 +2654,29 @@ static void write_array_element_type(FILE *file, const attr_list_t *attrs, const { type_t *elem = type_array_get_element_type(type);
- if (!is_embedded_complex(elem) && is_ptr(elem)) + if (!is_embedded_complex(elem, attrs) && is_ptr(elem)) { type_t *ref = type_pointer_get_ref_type(elem);
if (processed(ref)) { - write_nonsimple_pointer(file, NULL, elem, TYPE_CONTEXT_CONTAINER, + write_nonsimple_pointer(file, attrs, FALSE, elem, TYPE_CONTEXT_CONTAINER, ref->typestring_offset, tfsoff); return; } if (cont_is_complex && is_string_type(attrs, elem)) { - write_string_tfs(file, NULL, elem, TYPE_CONTEXT_CONTAINER, NULL, tfsoff); + write_string_tfs(file, attrs, FALSE, elem, TYPE_CONTEXT_CONTAINER, NULL, tfsoff); return; } if (!is_string_type(NULL, elem) && (type_get_type(ref) == TYPE_BASIC || type_get_type(ref) == TYPE_ENUM)) { - *tfsoff += write_simple_pointer(file, NULL, elem, TYPE_CONTEXT_CONTAINER); + *tfsoff += write_simple_pointer(file, attrs, FALSE, elem, TYPE_CONTEXT_CONTAINER); return; } } - write_member_type(file, type, cont_is_complex, NULL, elem, NULL, tfsoff); + write_member_type(file, type, cont_is_complex, attrs, elem, NULL, tfsoff); }
static void write_end(FILE *file, unsigned int *tfsoff) @@ -2726,7 +2728,7 @@ static void write_descriptors(FILE *file, type_t *type, unsigned int *tfsoff) }
static int write_pointer_description_offsets( - FILE *file, const attr_list_t *attrs, type_t *type, + FILE *file, const attr_list_t *attrs, int toplevel_attrs, type_t *type, unsigned int *offset_in_memory, unsigned int *offset_in_buffer, unsigned int *typestring_offset) { @@ -2760,12 +2762,12 @@ static int write_pointer_description_offsets( type_t *ref = type_pointer_get_ref_type(type);
if (is_string_type(attrs, type)) - write_string_tfs(file, attrs, type, TYPE_CONTEXT_CONTAINER, NULL, typestring_offset); + write_string_tfs(file, attrs, toplevel_attrs, type, TYPE_CONTEXT_CONTAINER, NULL, typestring_offset); else if (processed(ref)) - write_nonsimple_pointer(file, attrs, type, TYPE_CONTEXT_CONTAINER, + write_nonsimple_pointer(file, attrs, toplevel_attrs, type, TYPE_CONTEXT_CONTAINER, ref->typestring_offset, typestring_offset); else if (type_get_type(ref) == TYPE_BASIC || type_get_type(ref) == TYPE_ENUM) - *typestring_offset += write_simple_pointer(file, attrs, type, TYPE_CONTEXT_CONTAINER); + *typestring_offset += write_simple_pointer(file, attrs, toplevel_attrs, type, TYPE_CONTEXT_CONTAINER); else error("write_pointer_description_offsets: type format string unknown\n"); } @@ -2776,7 +2778,8 @@ static int write_pointer_description_offsets( * pointer has to be written in-place here */ if (is_string_type(attrs, type)) offset += 4; - write_nonsimple_pointer(file, attrs, type, TYPE_CONTEXT_CONTAINER, offset, typestring_offset); + write_nonsimple_pointer(file, attrs, toplevel_attrs, type, + TYPE_CONTEXT_CONTAINER, offset, typestring_offset); }
return 1; @@ -2785,7 +2788,7 @@ static int write_pointer_description_offsets( if (is_array(type)) { return write_pointer_description_offsets( - file, attrs, type_array_get_element_type(type), offset_in_memory, + file, attrs, FALSE, type_array_get_element_type(type), offset_in_memory, offset_in_buffer, typestring_offset); } else if (is_non_complex_struct(type)) @@ -2804,7 +2807,7 @@ static int write_pointer_description_offsets( *offset_in_buffer += padding; } written += write_pointer_description_offsets( - file, v->attrs, v->declspec.type, offset_in_memory, offset_in_buffer, + file, v->attrs, TRUE, v->declspec.type, offset_in_memory, offset_in_buffer, typestring_offset); } } @@ -2824,7 +2827,7 @@ static int write_pointer_description_offsets( }
static int write_no_repeat_pointer_descriptions( - FILE *file, const attr_list_t *attrs, type_t *type, + FILE *file, const attr_list_t *attrs, int toplevel_attrs, type_t *type, unsigned int *offset_in_memory, unsigned int *offset_in_buffer, unsigned int *typestring_offset) { @@ -2837,7 +2840,7 @@ static int write_no_repeat_pointer_descriptions( print_file(file, 2, "0x%02x, /* FC_PAD */\n", FC_PAD); *typestring_offset += 2;
- return write_pointer_description_offsets(file, attrs, type, + return write_pointer_description_offsets(file, attrs, toplevel_attrs, type, offset_in_memory, offset_in_buffer, typestring_offset); }
@@ -2856,7 +2859,7 @@ static int write_no_repeat_pointer_descriptions( *offset_in_buffer += padding; } written += write_no_repeat_pointer_descriptions( - file, v->attrs, v->declspec.type, + file, v->attrs, TRUE, v->declspec.type, offset_in_memory, offset_in_buffer, typestring_offset); } } @@ -2875,7 +2878,7 @@ static int write_no_repeat_pointer_descriptions( /* Note: if file is NULL return value is number of pointers to write, else * it is the number of type format characters written */ static int write_fixed_array_pointer_descriptions( - FILE *file, const attr_list_t *attrs, type_t *type, + FILE *file, const attr_list_t *attrs, int toplevel_attrs, type_t *type, unsigned int *offset_in_memory, unsigned int *offset_in_buffer, unsigned int *typestring_offset) { @@ -2888,7 +2891,7 @@ static int write_fixed_array_pointer_descriptions( /* unfortunately, this needs to be done in two passes to avoid * writing out redundant FC_FIXED_REPEAT descriptions */ pointer_count = write_pointer_description_offsets( - NULL, attrs, type_array_get_element_type(type), NULL, NULL, &temp); + NULL, attrs, FALSE, type_array_get_element_type(type), NULL, NULL, &temp); if (pointer_count > 0) { unsigned int increment_size; @@ -2906,7 +2909,7 @@ static int write_fixed_array_pointer_descriptions( *typestring_offset += 10;
pointer_count = write_pointer_description_offsets( - file, attrs, type, &offset_of_array_pointer_mem, + file, attrs, toplevel_attrs, type, &offset_of_array_pointer_mem, &offset_of_array_pointer_buf, typestring_offset); } } @@ -2925,7 +2928,7 @@ static int write_fixed_array_pointer_descriptions( *offset_in_buffer += padding; } pointer_count += write_fixed_array_pointer_descriptions( - file, v->attrs, v->declspec.type, offset_in_memory, offset_in_buffer, + file, v->attrs, TRUE, v->declspec.type, offset_in_memory, offset_in_buffer, typestring_offset); } } @@ -2959,7 +2962,7 @@ static int write_conformant_array_pointer_descriptions( /* unfortunately, this needs to be done in two passes to avoid * writing out redundant FC_VARIABLE_REPEAT descriptions */ pointer_count = write_pointer_description_offsets( - NULL, attrs, type_array_get_element_type(type), NULL, NULL, &temp); + NULL, attrs, FALSE, type_array_get_element_type(type), NULL, NULL, &temp); if (pointer_count > 0) { unsigned int increment_size; @@ -2979,7 +2982,7 @@ static int write_conformant_array_pointer_descriptions( *typestring_offset += 8;
pointer_count = write_pointer_description_offsets( - file, attrs, type_array_get_element_type(type), + file, attrs, FALSE, type_array_get_element_type(type), &offset_of_array_pointer_mem, &offset_of_array_pointer_buf, typestring_offset); } @@ -3003,7 +3006,7 @@ static int write_varying_array_pointer_descriptions( /* unfortunately, this needs to be done in two passes to avoid * writing out redundant FC_VARIABLE_REPEAT descriptions */ pointer_count = write_pointer_description_offsets( - NULL, attrs, type_array_get_element_type(type), NULL, NULL, &temp); + NULL, attrs, FALSE, type_array_get_element_type(type), NULL, NULL, &temp); if (pointer_count > 0) { unsigned int increment_size; @@ -3021,7 +3024,7 @@ static int write_varying_array_pointer_descriptions( *typestring_offset += 8;
pointer_count = write_pointer_description_offsets( - file, attrs, type_array_get_element_type(type), offset_in_memory, + file, attrs, FALSE, type_array_get_element_type(type), offset_in_memory, offset_in_buffer, typestring_offset); } } @@ -3066,7 +3069,7 @@ static int write_varying_array_pointer_descriptions( return pointer_count; }
-static void write_pointer_description(FILE *file, const attr_list_t *attrs, type_t *type, +static void write_pointer_description(FILE *file, const attr_list_t *attrs, int toplevel_attrs, type_t *type, unsigned int *typestring_offset) { unsigned int offset_in_buffer; @@ -3079,7 +3082,7 @@ static void write_pointer_description(FILE *file, const attr_list_t *attrs, type offset_in_memory = 0; offset_in_buffer = 0; write_no_repeat_pointer_descriptions( - file, NULL, type, + file, attrs, toplevel_attrs, type, &offset_in_memory, &offset_in_buffer, typestring_offset); }
@@ -3087,7 +3090,7 @@ static void write_pointer_description(FILE *file, const attr_list_t *attrs, type offset_in_memory = 0; offset_in_buffer = 0; write_fixed_array_pointer_descriptions( - file, NULL, type, + file, attrs, toplevel_attrs, type, &offset_in_memory, &offset_in_buffer, typestring_offset);
/* pass 3: search for pointers in conformant only arrays (but don't descend @@ -3112,7 +3115,7 @@ static void write_pointer_description(FILE *file, const attr_list_t *attrs, type &offset_in_memory, &offset_in_buffer, typestring_offset); }
-static unsigned int write_string_tfs(FILE *file, const attr_list_t *attrs, +static unsigned int write_string_tfs(FILE *file, const attr_list_t *attrs, int toplevel_attrs, type_t *type, enum type_context context, const char *name, unsigned int *typestring_offset) { @@ -3126,7 +3129,7 @@ static unsigned int write_string_tfs(FILE *file, const attr_list_t *attrs, if (is_declptr(type)) { unsigned char flag = is_conformant_array(type) ? 0 : FC_SIMPLE_POINTER; - int pointer_type = get_pointer_fc_context(type, attrs, context); + int pointer_type = get_pointer_fc_context(type, attrs, toplevel_attrs, context); if (!pointer_type) pointer_type = FC_RP; print_start_tfs_comment(file, type, *typestring_offset); @@ -3149,7 +3152,7 @@ static unsigned int write_string_tfs(FILE *file, const attr_list_t *attrs,
if (type_get_type(elem_type) == TYPE_POINTER && is_array(type)) { - write_array_tfs(file, attrs, type, name, typestring_offset); + write_array_tfs(file, attrs, toplevel_attrs, type, name, typestring_offset); return start_offset; }
@@ -3225,7 +3228,7 @@ static unsigned int write_string_tfs(FILE *file, const attr_list_t *attrs, } }
-static unsigned int write_array_tfs(FILE *file, const attr_list_t *attrs, type_t *type, +static unsigned int write_array_tfs(FILE *file, const attr_list_t *attrs, int toplevel_attrs, type_t *type, const char *name, unsigned int *typestring_offset) { const expr_t *length_is = type_array_get_variance(type); @@ -3240,12 +3243,12 @@ static unsigned int write_array_tfs(FILE *file, const attr_list_t *attrs, type_t : 0;
if (!is_string_type(attrs, type_array_get_element_type(type))) - write_type_tfs(file, attrs, type_array_get_element_type(type), + write_type_tfs(file, attrs, FALSE, type_array_get_element_type(type), name, TYPE_CONTEXT_CONTAINER_NO_POINTERS, typestring_offset);
size = type_memsize(is_conformant_array(type) ? type_array_get_element_type(type) : type); align = type_buffer_alignment(is_conformant_array(type) ? type_array_get_element_type(type) : type); - fc = get_array_fc(type); + fc = get_array_fc(type, attrs);
start_offset = *typestring_offset; update_tfsoff(type, start_offset, file); @@ -3297,18 +3300,18 @@ static unsigned int write_array_tfs(FILE *file, const attr_list_t *attrs, type_t *typestring_offset += write_conf_or_var_desc(file, current_structure, baseoff, type, length_is, 0);
- if (type_has_pointers(type_array_get_element_type(type)) && + if (type_has_pointers(type_array_get_element_type(type), attrs) && (type_array_is_decl_as_ptr(type) || !current_structure)) { print_file(file, 2, "0x%x,\t/* FC_PP */\n", FC_PP); print_file(file, 2, "0x%x,\t/* FC_PAD */\n", FC_PAD); *typestring_offset += 2; - write_pointer_description(file, is_string_type(attrs, type) ? attrs : NULL, type, typestring_offset); + write_pointer_description(file, attrs, toplevel_attrs, type, typestring_offset); print_file(file, 2, "0x%x,\t/* FC_END */\n", FC_END); *typestring_offset += 1; }
- write_array_element_type(file, is_string_type(attrs, type) ? attrs : NULL, type, FALSE, typestring_offset); + write_array_element_type(file, attrs, type, FALSE, typestring_offset); write_end(file, typestring_offset); } else @@ -3319,7 +3322,7 @@ static unsigned int write_array_tfs(FILE *file, const attr_list_t *attrs, type_t *typestring_offset += write_conf_or_var_desc(file, current_structure, baseoff, type, size_is, 0); *typestring_offset += write_conf_or_var_desc(file, current_structure, baseoff, type, length_is, 0);
- write_array_element_type(file, is_string_type(attrs, type) ? attrs : NULL, type, TRUE, typestring_offset); + write_array_element_type(file, attrs, type, TRUE, typestring_offset); write_end(file, typestring_offset); }
@@ -3393,7 +3396,7 @@ static void write_struct_members(FILE *file, const type_t *type, write_end(file, typestring_offset); }
-static unsigned int write_struct_tfs(FILE *file, type_t *type, +static unsigned int write_struct_tfs(FILE *file, type_t *type, const attr_list_t *attrs, const char *name, unsigned int *tfsoff) { const type_t *save_current_structure = current_structure; @@ -3418,15 +3421,15 @@ static unsigned int write_struct_tfs(FILE *file, type_t *type, name, USHRT_MAX, total_size - USHRT_MAX);
if (fields) LIST_FOR_EACH_ENTRY(f, fields, var_t, entry) - write_type_tfs(file, f->attrs, f->declspec.type, f->name, TYPE_CONTEXT_CONTAINER_NO_POINTERS, tfsoff); + write_type_tfs(file, f->attrs, TRUE, f->declspec.type, f->name, TYPE_CONTEXT_CONTAINER_NO_POINTERS, tfsoff);
array = find_array_or_string_in_struct(type); if (array && !processed(array->declspec.type)) { if(is_string_type(array->attrs, array->declspec.type)) - write_string_tfs(file, array->attrs, array->declspec.type, TYPE_CONTEXT_CONTAINER, array->name, tfsoff); + write_string_tfs(file, array->attrs, TRUE, array->declspec.type, TYPE_CONTEXT_CONTAINER, array->name, tfsoff); else - write_array_tfs(file, array->attrs, array->declspec.type, array->name, tfsoff); + write_array_tfs(file, array->attrs, TRUE, array->declspec.type, array->name, tfsoff); }
corroff = *tfsoff; @@ -3468,12 +3471,12 @@ static unsigned int write_struct_tfs(FILE *file, type_t *type, } else if ((fc == FC_PSTRUCT) || (fc == FC_CPSTRUCT) || - (fc == FC_CVSTRUCT && type_has_pointers(type))) + (fc == FC_CVSTRUCT && type_has_pointers(type, attrs))) { print_file(file, 2, "0x%x,\t/* FC_PP */\n", FC_PP); print_file(file, 2, "0x%x,\t/* FC_PAD */\n", FC_PAD); *tfsoff += 2; - write_pointer_description(file, NULL, type, tfsoff); + write_pointer_description(file, NULL, FALSE, type, tfsoff); print_file(file, 2, "0x%x,\t/* FC_END */\n", FC_END); *tfsoff += 1; } @@ -3493,9 +3496,9 @@ static unsigned int write_struct_tfs(FILE *file, type_t *type, { case TGT_POINTER: if (is_string_type(f->attrs, ft)) - write_string_tfs(file, f->attrs, ft, TYPE_CONTEXT_CONTAINER, f->name, tfsoff); + write_string_tfs(file, f->attrs, TRUE, ft, TYPE_CONTEXT_CONTAINER, f->name, tfsoff); else - write_pointer_tfs(file, f->attrs, ft, + write_pointer_tfs(file, f->attrs, TRUE, ft, type_pointer_get_ref_type(ft)->typestring_offset, TYPE_CONTEXT_CONTAINER, tfsoff); break; @@ -3511,7 +3514,7 @@ static unsigned int write_struct_tfs(FILE *file, type_t *type, * pointer has to be written in-place here */ if (is_string_type(f->attrs, ft)) offset += 4; - write_nonsimple_pointer(file, f->attrs, ft, TYPE_CONTEXT_CONTAINER, offset, tfsoff); + write_nonsimple_pointer(file, f->attrs, TRUE, ft, TYPE_CONTEXT_CONTAINER, offset, tfsoff); } break; default: @@ -3585,7 +3588,7 @@ static unsigned int write_union_tfs(FILE *file, const attr_list_t *attrs, if (cases) nbranch += list_count(cases); if (f->declspec.type) - write_type_tfs(file, f->attrs, f->declspec.type, f->name, TYPE_CONTEXT_CONTAINER, tfsoff); + write_type_tfs(file, f->attrs, TRUE, f->declspec.type, f->name, TYPE_CONTEXT_CONTAINER, tfsoff); }
start_offset = *tfsoff; @@ -3779,7 +3782,7 @@ static unsigned int write_contexthandle_tfs(FILE *file,
if (flags & 0x80) /* via ptr */ { - int pointer_type = get_pointer_fc( type, attrs, context == TYPE_CONTEXT_TOPLEVELPARAM ); + int pointer_type = get_pointer_fc( type, attrs, TRUE, context == TYPE_CONTEXT_TOPLEVELPARAM ); if (!pointer_type) pointer_type = FC_RP; *typeformat_offset += 4; print_file(file, 2,"0x%x, 0x0,\t/* %s */\n", pointer_type, string_of_type(pointer_type) ); @@ -3842,7 +3845,7 @@ static unsigned int write_range_tfs(FILE *file, const attr_list_t *attrs, return start_offset; }
-static unsigned int write_type_tfs(FILE *file, const attr_list_t *attrs, +static unsigned int write_type_tfs(FILE *file, const attr_list_t *attrs, int toplevel_attrs, type_t *type, const char *name, enum type_context context, unsigned int *typeformat_offset) @@ -3857,7 +3860,7 @@ static unsigned int write_type_tfs(FILE *file, const attr_list_t *attrs, case TGT_USER_TYPE: return write_user_tfs(file, type, typeformat_offset); case TGT_STRING: - return write_string_tfs(file, attrs, type, context, name, typeformat_offset); + return write_string_tfs(file, attrs, toplevel_attrs, type, context, name, typeformat_offset); case TGT_ARRAY: { unsigned int off; @@ -3865,14 +3868,14 @@ static unsigned int write_type_tfs(FILE *file, const attr_list_t *attrs, if ((context != TYPE_CONTEXT_CONTAINER && context != TYPE_CONTEXT_CONTAINER_NO_POINTERS) || !is_conformant_array(type) || type_array_is_decl_as_ptr(type)) - off = write_array_tfs(file, attrs, type, name, typeformat_offset); + off = write_array_tfs(file, attrs, toplevel_attrs, type, name, typeformat_offset); else off = 0; if (context != TYPE_CONTEXT_CONTAINER && context != TYPE_CONTEXT_CONTAINER_NO_POINTERS) { int ptr_type; - ptr_type = get_pointer_fc_context(type, attrs, context); + ptr_type = get_pointer_fc_context(type, attrs, toplevel_attrs, context); if (type_array_is_decl_as_ptr(type) || (ptr_type != FC_RP && context == TYPE_CONTEXT_TOPLEVELPARAM)) { @@ -3892,7 +3895,7 @@ static unsigned int write_type_tfs(FILE *file, const attr_list_t *attrs, return off; } case TGT_STRUCT: - return write_struct_tfs(file, type, name, typeformat_offset); + return write_struct_tfs(file, type, attrs, name, typeformat_offset); case TGT_UNION: return write_union_tfs(file, attrs, type, typeformat_offset); case TGT_ENUM: @@ -3920,10 +3923,10 @@ static unsigned int write_type_tfs(FILE *file, const attr_list_t *attrs, else ref_context = context;
- offset = write_type_tfs( file, attrs, ref, name, ref_context, typeformat_offset); + offset = write_type_tfs( file, attrs, FALSE, ref, name, ref_context, typeformat_offset); if (context == TYPE_CONTEXT_CONTAINER_NO_POINTERS) return 0; - return write_pointer_tfs(file, attrs, type, offset, context, typeformat_offset); + return write_pointer_tfs(file, attrs, toplevel_attrs, type, offset, context, typeformat_offset); } case TGT_INVALID: break; @@ -3957,14 +3960,14 @@ static void process_tfs_iface(type_t *iface, FILE *file, int indent, unsigned in
current_arg = var = type_function_get_retval(func->declspec.type); if (!is_void(var->declspec.type)) - var->typestring_offset = write_type_tfs( file, var->attrs, var->declspec.type, func->name, + var->typestring_offset = write_type_tfs( file, var->attrs, TRUE, var->declspec.type, func->name, TYPE_CONTEXT_RETVAL, offset);
args = type_function_get_args(func->declspec.type); if (args) LIST_FOR_EACH_ENTRY( var, args, var_t, entry ) { current_arg = var; - var->typestring_offset = write_type_tfs( file, var->attrs, var->declspec.type, var->name, + var->typestring_offset = write_type_tfs( file, var->attrs, TRUE, var->declspec.type, var->name, TYPE_CONTEXT_TOPLEVELPARAM, offset ); } break; @@ -3978,7 +3981,7 @@ static void process_tfs_iface(type_t *iface, FILE *file, int indent, unsigned in if (is_attr(ref->type->attrs, ATTR_ENCODE) || is_attr(ref->type->attrs, ATTR_DECODE)) ref->type->typestring_offset = write_type_tfs( file, - ref->type->attrs, ref->type, ref->type->name, + ref->type->attrs, TRUE, ref->type, ref->type->name, TYPE_CONTEXT_CONTAINER, offset); } break; @@ -4020,17 +4023,17 @@ void write_typeformatstring(FILE *file, const statement_list_t *stmts, type_pred print_file(file, indent, "\n"); }
-static unsigned int get_required_buffer_size_type( - const type_t *type, const char *name, const attr_list_t *attrs, int toplevel_param, unsigned int *alignment) +static unsigned int get_required_buffer_size_type(const type_t *type, const char *name, + const attr_list_t *attrs, int toplevel_attrs, int toplevel_param, unsigned int *alignment) { *alignment = 0; - switch (typegen_detect_type(type, NULL, TDT_IGNORE_RANGES)) + switch (typegen_detect_type(type, attrs, TDT_IGNORE_RANGES)) { case TGT_USER_TYPE: { const char *uname = NULL; const type_t *utype = get_user_type(type, &uname); - return get_required_buffer_size_type(utype, uname, NULL, FALSE, alignment); + return get_required_buffer_size_type(utype, uname, NULL, FALSE, FALSE, alignment); } case TGT_BASIC: switch (get_basic_fc(type)) @@ -4102,8 +4105,8 @@ static unsigned int get_required_buffer_size_type( unsigned int size, align; const type_t *ref = type_pointer_get_ref_type(type); if (is_string_type( attrs, ref )) break; - if (!(size = get_required_buffer_size_type( ref, name, NULL, FALSE, &align ))) break; - if (get_pointer_fc(type, attrs, toplevel_param) != FC_RP) + if (!(size = get_required_buffer_size_type( ref, name, attrs, FALSE, FALSE, &align ))) break; + if (get_pointer_fc(type, attrs, toplevel_attrs, toplevel_param) != FC_RP) { size += 4 + align; align = 4; @@ -4113,13 +4116,13 @@ static unsigned int get_required_buffer_size_type( }
case TGT_ARRAY: - switch (get_array_fc(type)) + switch (get_array_fc(type, attrs)) { case FC_SMFARRAY: case FC_LGFARRAY: return type_array_get_dim(type) * get_required_buffer_size_type(type_array_get_element_type(type), name, - NULL, FALSE, alignment); + attrs, FALSE, FALSE, alignment); } break;
@@ -4150,7 +4153,7 @@ static unsigned int get_required_buffer_size(const var_t *var, unsigned int *ali
if (!is_string_type(var->attrs, var->declspec.type)) return get_required_buffer_size_type(var->declspec.type, var->name, - var->attrs, TRUE, alignment); + var->attrs, TRUE, TRUE, alignment); } return 0; } @@ -4444,7 +4447,7 @@ static void write_remoting_arg(FILE *file, int indent, const var_t *func, const unsigned int alignment, start_offset = type->typestring_offset;
if (is_ptr(type) || is_array(type)) - pointer_type = get_pointer_fc(type, var->attrs, pass != PASS_RETURN); + pointer_type = get_pointer_fc(type, var->attrs, TRUE, pass != PASS_RETURN); else pointer_type = 0;
@@ -4559,7 +4562,7 @@ static void write_remoting_arg(FILE *file, int indent, const var_t *func, const break; case TGT_ARRAY: { - unsigned char tc = get_array_fc(type); + unsigned char tc = get_array_fc(type, var->attrs); const char *array_type = NULL;
/* We already have the size_is expression since it's at the @@ -4686,7 +4689,7 @@ static void write_remoting_arg(FILE *file, int indent, const var_t *func, const case TGT_POINTER: { const type_t *ref = type_pointer_get_ref_type(type); - if (pointer_type == FC_RP) switch (typegen_detect_type(ref, NULL, TDT_ALL_TYPES)) + if (pointer_type == FC_RP) switch (typegen_detect_type(ref, var->attrs, TDT_ALL_TYPES)) { case TGT_BASIC: print_phase_basetype(file, indent, local_var_prefix, phase, pass, var, var->name); @@ -5004,7 +5007,7 @@ void assign_stub_out_args( FILE *file, int indent, const var_t *func, const char /* fall through */ case TGT_STRUCT: case TGT_UNION: - if (type_has_pointers(ref)) + if (type_has_pointers(ref, var->attrs)) print_file(file, indent, "memset(&%s_W%u, 0, sizeof(%s_W%u));\n", local_var_prefix, i, local_var_prefix, i); break; diff --git a/tools/widl/typegen.h b/tools/widl/typegen.h index 95ad601768d..cc843625023 100644 --- a/tools/widl/typegen.h +++ b/tools/widl/typegen.h @@ -97,7 +97,6 @@ int is_full_pointer_function(const var_t *func); void write_full_pointer_init(FILE *file, int indent, const var_t *func, int is_server); void write_full_pointer_free(FILE *file, int indent, const var_t *func); unsigned char get_basic_fc(const type_t *type); -unsigned char get_pointer_fc(const type_t *type, const attr_list_t *attrs, int toplevel_param); unsigned char get_struct_fc(const type_t *type); enum typegen_type typegen_detect_type(const type_t *type, const attr_list_t *attrs, unsigned int flags); unsigned int type_memsize_and_alignment(const type_t *t, unsigned int *align);
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=147384
Your paranoid android.
=== debian11 (build log) ===
Task: The win32 Wine build failed
=== debian11b (build log) ===
Task: The wow64 Wine build failed