cc icon indicating copy to clipboard operation
cc copied to clipboard

TODO case '{' InitializerList CommaOpt '}'

Open xlab opened this issue 7 years ago • 3 comments

Hi, got another missing case in linmath.h:193:16

&cc.Declarator{
· Linkage: None,
· Type: float([4])[4],
· DirectDeclarator: &cc.DirectDeclarator{
· · Token: linmath/linmath_impl.h:193:16: IDENTIFIER "S",
· },
}
panic: TODO

goroutine 1 [running]:
github.com/cznic/cc.(*InitializerList).typeCheck(0xc420b59410, 0xc420b6b508, 0x1536280, 0xc420b6b650, 0x0, 0xc4201e3000)
	/Users/xlab/Documents/dev/go/src/github.com/cznic/cc/ast2.go:3046 +0x723
github.com/cznic/cc.(*Initializer).typeCheck(0xc420b53ae0, 0xc420b6b508, 0x1536280, 0xc420b6b650, 0x1536200, 0xc4201e3000)
	/Users/xlab/Documents/dev/go/src/github.com/cznic/cc/ast2.go:2877 +0x136f
github.com/cznic/cc.yyParse(0x1528360, 0xc4201e3000, 0xc420019a40)
	/Users/xlab/Documents/dev/go/src/github.com/cznic/cc/parser.go:3570 +0xd9ff
github.com/cznic/cc.Parse(0xc42029e300, 0x2e6, 0xc420011ca0, 0x1, 0x1, 0x1567c40, 0xc42008fbc0, 0x9, 0x9, 0x12b0eef, ...)
	/Users/xlab/Documents/dev/go/src/github.com/cznic/cc/cc.go:808 +0x76f
github.com/xlab/c-for-go/parser.ParseWith(0xc42029c000, 0xc4200117b0, 0x1, 0x1)

xlab avatar Apr 30 '17 18:04 xlab

Failing code:

mat4x4 S = {{0, u[2], -u[1], 0}, {-u[2], 0, u[0], 0}, {u[1], -u[0], 0, 0}, {0, 0, 0, 0}};

xlab avatar Apr 30 '17 18:04 xlab

@cznic Maybe we need an option to avoid going into function body declarations? As I want to use CC only on the API of header files, but too lazy to strip out the code by hand, altering the headers.

xlab avatar Apr 30 '17 18:04 xlab

Maybe we need an option to avoid going into function body declarations?

Good idea. I wanted to point you to the place where to skip the typecheck but I cannot find it now, lol. Sad lol.

cznic avatar Apr 30 '17 18:04 cznic