[Commit] nickle compile.c,1.134,1.135
Keith Packard
commit@keithp.com
Wed, 28 May 2003 23:13:11 -0700
- Previous message: [Commit] Xc/src Xc.h,1.9,1.10 xcsurface.c,1.3,1.4
- Next message: [Commit] rrserver array.5c,NONE,1.1 boards.5c,NONE,1.1 connect.5c,NONE,1.1 dispatch.5c,NONE,1.1 games.5c,NONE,1.1 lex.5c,NONE,1.1 main.5c,NONE,1.1 net.5c,NONE,1.1 rr.5c,NONE,1.1 server.5c,NONE,1.1 show.5c,NONE,1.1 shuffle.5c,NONE,1.1 readreq.5c,1.1,1.2 rrnet.5c,1.1,NONE rrparse.5c,1.1,NONE rrproto.5c,1.1,NONE rrserver.5c,1.1,NONE rrservreq.5c,1.1,NONE
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Committed by: keithp
Update of /local/src/CVS/nickle
In directory home.keithp.com:/tmp/cvs-serv14894
Modified Files:
compile.c
Log Message:
Fix implicit multi-dimensional array initializers
Index: compile.c
===================================================================
RCS file: /local/src/CVS/nickle/compile.c,v
retrieving revision 1.134
retrieving revision 1.135
diff -u -d -r1.134 -r1.135
--- compile.c 28 May 2003 19:10:09 -0000 1.134
+++ compile.c 29 May 2003 06:13:09 -0000 1.135
@@ -1467,6 +1467,30 @@
RETURN(obj);
}
+/*
+ * typedef struct { int x; } foo;
+ * typedef struct { foo[2,2] q; } bar;
+ * bar y = { q = { { { x = 1 } ... } ... } };
+ *
+ *
+ * ARRAY
+ * / \
+ * COMMA 0
+ * / \
+ * ARRAY COMMA
+ * / \ | \
+ * COMMA 0 DOTS 0
+ * / \
+ * STRUCT COMMA
+ * / \ | \
+ * COMMA 0 DOTS 0
+ * / \
+ * ASSIGN 0
+ * | \
+ * NAME TEN_NUM
+ * "x" 1
+ */
+
static ObjPtr
CompileArrayInit (ObjPtr obj, ExprPtr expr, Type *type, ExprPtr stat, CodePtr code)
{
@@ -1633,15 +1657,17 @@
init = CompileImplicitInit (sub);
if (init)
{
- init = NewExprTree (COMMA,
- init,
- NewExprTree (COMMA,
- NewExprTree (DOTS, 0, 0),
- 0));
dim = CompileCountDeclDimensions (type->array.dimensions);
- while (--dim)
- init = NewExprTree (OC, init, 0);
- init = NewExprTree (ARRAY, init, 0);
+ while (--dim >= 0)
+ {
+ init = NewExprTree (ARRAY,
+ NewExprTree (COMMA,
+ init,
+ NewExprTree (COMMA,
+ NewExprTree (DOTS, 0, 0),
+ 0)),
+ 0);
+ }
}
else
init = NewExprTree (ANONINIT, 0, 0);
- Previous message: [Commit] Xc/src Xc.h,1.9,1.10 xcsurface.c,1.3,1.4
- Next message: [Commit] rrserver array.5c,NONE,1.1 boards.5c,NONE,1.1 connect.5c,NONE,1.1 dispatch.5c,NONE,1.1 games.5c,NONE,1.1 lex.5c,NONE,1.1 main.5c,NONE,1.1 net.5c,NONE,1.1 rr.5c,NONE,1.1 server.5c,NONE,1.1 show.5c,NONE,1.1 shuffle.5c,NONE,1.1 readreq.5c,1.1,1.2 rrnet.5c,1.1,NONE rrparse.5c,1.1,NONE rrproto.5c,1.1,NONE rrserver.5c,1.1,NONE rrservreq.5c,1.1,NONE
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]