]> Nishi Git Mirror - gwion.git/commitdiff
:art: Check union array
authorfennecdjay <astor.jeremie@wanadoo.fr>
Sat, 29 Dec 2018 19:56:51 +0000 (20:56 +0100)
committerfennecdjay <astor.jeremie@wanadoo.fr>
Sat, 29 Dec 2018 19:56:51 +0000 (20:56 +0100)
ast
src/parse/scan1.c
tests/error/union_array_empty.gw

diff --git a/ast b/ast
index 056e651d390aa53a2b2a4f6944df4ef76ab5df49..90919a17d261acf6b31d0b33981371b211f0cb2c 160000 (submodule)
--- a/ast
+++ b/ast
@@ -1 +1 @@
-Subproject commit 056e651d390aa53a2b2a4f6944df4ef76ab5df49
+Subproject commit 90919a17d261acf6b31d0b33981371b211f0cb2c
index ea068088c8e6a221200938ae51a8266db98c95e2..b10a80279799ae3de3b4c9be9a6d93f772b058ba 100644 (file)
@@ -234,11 +234,6 @@ ANN static inline m_bool scan1_stmt_type(const Env env, const Stmt_Type stmt) {
   return stmt->type->def ? scan1_class_def(env, stmt->type->def) : 1;
 }
 
-ANN static inline m_bool scan1_stmt_union_array(const Array_Sub array) { GWDEBUG_EXE
-  return !array->exp ? GW_OK :
-    err_msg(array->exp->pos, "array declaration must be empty in union.");
-}
-
 ANN m_bool scan1_stmt_union(const Env env, const Stmt_Union stmt) { GWDEBUG_EXE
   Decl_List l = stmt->l;
   const m_uint scope = union_push(env, stmt);
@@ -248,15 +243,9 @@ ANN m_bool scan1_stmt_union(const Env env, const Stmt_Union stmt) { GWDEBUG_EXE
   }
   do {
     const Exp_Decl decl = l->self->d.exp_decl;
-    Var_Decl_List list = decl.list;
     SET_FLAG(decl.td, checked | stmt->flag);
     if(GET_FLAG(stmt, static))
       SET_FLAG(decl.td, static);
-    do {
-      const Var_Decl var_decl = list->self;
-      if(var_decl->array)
-        CHECK_BB(scan1_stmt_union_array(var_decl->array))
-    } while((list = list->next));
     CHECK_BB(scan1_exp_decl(env, &l->self->d.exp_decl))
   } while((l = l->next));
   union_pop(env, stmt, scope);
index eaa415b593745f78cdaa871ca12d5f5754d66a1c..e1264e20aed0644696e9569632e2df141d9d2167 100644 (file)
@@ -1,6 +1,5 @@
-// [contains] array declaration must be empty in union
- union
-{
+// [contains] must be defined with empty
+union {
   int i;
   int @array[4];
 };