Richard Pospesel : widl: Fail compilation if an incomplete union or enum is used in a remoted field.
Alexandre Julliard
julliard at winehq.org
Wed Aug 21 14:39:32 CDT 2019
Module: wine
Branch: master
Commit: 181cafcd52a29b6e8600119f104ea603b311f551
URL: https://source.winehq.org/git/wine.git/?a=commit;h=181cafcd52a29b6e8600119f104ea603b311f551
Author: Richard Pospesel <richard at torproject.org>
Date: Tue Aug 20 22:28:25 2019 -0500
widl: Fail compilation if an incomplete union or enum is used in a remoted field.
Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
tools/widl/parser.y | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/tools/widl/parser.y b/tools/widl/parser.y
index a52afc7..072e138 100644
--- a/tools/widl/parser.y
+++ b/tools/widl/parser.y
@@ -2573,10 +2573,15 @@ static void check_field_common(const type_t *container_type,
type = type_array_get_element_type(type);
more_to_do = TRUE;
break;
+ case TGT_ENUM:
+ type = type_get_real_type(type);
+ if (!type_is_complete(type))
+ {
+ error_loc_info(&arg->loc_info, "undefined type declaration \"enum %s\"\n", type->name);
+ }
case TGT_USER_TYPE:
case TGT_IFACE_POINTER:
case TGT_BASIC:
- case TGT_ENUM:
case TGT_RANGE:
/* nothing to do */
break;
@@ -2601,10 +2606,15 @@ static void check_remoting_fields(const var_t *var, type_t *type)
if (type_is_complete(type))
fields = type_struct_get_fields(type);
else
- error_loc_info(&var->loc_info, "undefined type declaration %s\n", type->name);
+ error_loc_info(&var->loc_info, "undefined type declaration \"struct %s\"\n", type->name);
}
else if (type_get_type(type) == TYPE_UNION || type_get_type(type) == TYPE_ENCAPSULATED_UNION)
- fields = type_union_get_cases(type);
+ {
+ if (type_is_complete(type))
+ fields = type_union_get_cases(type);
+ else
+ error_loc_info(&var->loc_info, "undefined type declaration \"union %s\"\n", type->name);
+ }
if (fields) LIST_FOR_EACH_ENTRY( field, fields, const var_t, entry )
if (field->declspec.type) check_field_common(type, type->name, field);
More information about the wine-cvs
mailing list