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.
This commit is contained in:
parent
362d42e082
commit
e9c771f98b
|
@ -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)
|
||||||
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)
|
||||||
|
|
||||||
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:
|
||||||
|
|
Loading…
Reference in New Issue