Commit e9c771f9 authored by Robert Shearman's avatar Robert Shearman Committed by Alexandre Julliard

widl: Error if an array is in the middle of a structure.

Fix detection of conformant arrays and output an error if the array isn't at the end of the structure.
parent 362d42e0
...@@ -1257,9 +1257,13 @@ static int get_struct_type(var_t *field) ...@@ -1257,9 +1257,13 @@ static int get_struct_type(var_t *field)
continue; continue;
} }
if (is_array_type(field->attrs, field->ptr_level, field->array)) if (is_array_type(field->attrs, field->ptr_level, field->array) &&
field->array && !field->array->is_const)
{ {
has_conformant_array = 1; has_conformant_array = 1;
if (PREV_LINK(field))
yyerror("field %s deriving from a conformant array must be the last field in the structure\n",
field->name);
continue; continue;
} }
...@@ -1303,6 +1307,9 @@ static int get_struct_type(var_t *field) ...@@ -1303,6 +1307,9 @@ static int get_struct_type(var_t *field)
break; break;
case RPC_FC_CARRAY: case RPC_FC_CARRAY:
has_conformant_array = 1; has_conformant_array = 1;
if (PREV_LINK(field))
yyerror("field %s deriving from a conformant array must be the last field in the structure\n",
field->name);
break; break;
case RPC_FC_C_CSTRING: case RPC_FC_C_CSTRING:
case RPC_FC_C_WSTRING: case RPC_FC_C_WSTRING:
...@@ -1320,11 +1327,17 @@ static int get_struct_type(var_t *field) ...@@ -1320,11 +1327,17 @@ static int get_struct_type(var_t *field)
case RPC_FC_CPSTRUCT: case RPC_FC_CPSTRUCT:
has_conformant_array = 1; has_conformant_array = 1;
if (PREV_LINK(field))
yyerror("field %s deriving from a conformant array must be the last field in the structure\n",
field->name);
has_pointer = 1; has_pointer = 1;
break; break;
case RPC_FC_CSTRUCT: case RPC_FC_CSTRUCT:
has_conformant_array = 1; has_conformant_array = 1;
if (PREV_LINK(field))
yyerror("field %s deriving from a conformant array must be the last field in the structure\n",
field->name);
break; break;
case RPC_FC_PSTRUCT: case RPC_FC_PSTRUCT:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment