scc

simple C compiler
git clone git://git.2f30.org/scc
Log | Files | Refs | README | LICENSE

commit b9158535e95666900dd3f78ebb53eb7a0dba964f
parent c19b3bf153c5a741945e1ed2681f2279dd0c7a28
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Tue,  1 Sep 2015 18:43:13 +0200

Add auto refence in test002

This is another form of incomplete types that must be checked.

Diffstat:
Mcc1/tests/test002.c | 23++++++++++++++++++++---
1 file changed, 20 insertions(+), 3 deletions(-)

diff --git a/cc1/tests/test002.c b/cc1/tests/test002.c @@ -4,29 +4,46 @@ description: Test forward references before definition of types output: G4 P x F1 -G6 F1 main +G7 F1 main { - S2 S ( M5 I i +M6 P next ) A2 S2 y +A3 P p +A4 N n A2 M5 .I #I0 :I G4 @S2 A2 :S2 + A4 #N0 :N A3 A2 'P :P ,P + j L7 + d +L5 + A4 #N1 :+N A3 A3 @S2 M6 .P :P ,P +L7 + j L5 A3 #P0 !I + b +L6 } */ struct S *x; struct S { int i; + struct S *next; }; -void +int main(void) { - struct S y; + struct S y, *p; + unsigned n; y.i = 0; *x = y; + + for (n = 0, p = &y; p; ++n, p = p->next) + /* nothing */; }