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

Alexandre Julliard julliard at wine.codeweavers.com
Tue Jan 24 06:45:15 CST 2006


Module: wine
Branch: refs/heads/master
Commit: e9c771f98b214092cd20c3e492c73ac24f3c28b8
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=e9c771f98b214092cd20c3e492c73ac24f3c28b8

Author: Robert Shearman <rob at codeweavers.com>
Date:   Tue Jan 24 11:12:20 2006 +0100

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.

---

 tools/widl/parser.y |   15 ++++++++++++++-
 1 files changed, 14 insertions(+), 1 deletions(-)

diff --git a/tools/widl/parser.y b/tools/widl/parser.y
index e4ee9ff..8585218 100644
--- a/tools/widl/parser.y
+++ b/tools/widl/parser.y
@@ -1257,9 +1257,13 @@ static int get_struct_type(var_t *field)
         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;
+        if (PREV_LINK(field))
+            yyerror("field %s deriving from a conformant array must be the last field in the structure\n",
+                    field->name);
         continue;
     }
 
@@ -1303,6 +1307,9 @@ static int get_struct_type(var_t *field)
       break;
     case RPC_FC_CARRAY:
       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;
     case RPC_FC_C_CSTRING:
     case RPC_FC_C_WSTRING:
@@ -1320,11 +1327,17 @@ static int get_struct_type(var_t *field)
 
     case RPC_FC_CPSTRUCT:
       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;
       break;
 
     case RPC_FC_CSTRUCT:
       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;
 
     case RPC_FC_PSTRUCT:




More information about the wine-cvs mailing list