elliotchance / c2go

⚖️ A tool for transpiling C to Go.
MIT License
2.07k stars 154 forks source link

Failed to c2go on ikcp.c #798

Open jinq0123 opened 5 years ago

jinq0123 commented 5 years ago

Failed to c2go on skywind3000/kcp ikcp.c

E:\github-other\kcp (master -> origin)
λ c2go transpile ikcp.c
panic: could not match regexp with string
^(?P<address>[0-9a-fx]+) <(?P<position>.*)> '(?P<type>.*?)'(:'(?P<type2>.*)')?(?P<lvalue> lvalue)?(?P<prefix> prefix)?(?P<postfix> postfix)? '(?P<operator>.*?)'[\s]*$
0x2b14900 <col:35, col:41> 'struct IQUEUEHEAD *' prefix '&' cannot overflow

goroutine 16 [running]:
github.com/elliotchance/c2go/ast.groupsFromRegex(0xc04231bb80, 0xa6, 0xc04292139a, 0x4b, 0x6a4350)
        e:/gopath/src/github.com/elliotchance/c2go/ast/ast.go:286 +0x380
github.com/elliotchance/c2go/ast.parseUnaryOperator(0xc04292139a, 0x4b, 0x6aa0c3)
        e:/gopath/src/github.com/elliotchance/c2go/ast/unary_operator.go:16 +0x69
github.com/elliotchance/c2go/ast.Parse(0xc04292138c, 0x59, 0x6a5995, 0x5)
        e:/gopath/src/github.com/elliotchance/c2go/ast/ast.go:246 +0x2507
main.convertLinesToNodes(0xc0420fdf60, 0xf53, 0xf53, 0x0, 0x0, 0x0)
        e:/gopath/src/github.com/elliotchance/c2go/main.go:89 +0x19f
main.convertLinesToNodesParallel.func1.2(0xc042010240, 0xc042004018, 0xc0420fdf60, 0xf53, 0xf53, 0x0)
        e:/gopath/src/github.com/elliotchance/c2go/main.go:121 +0x60
created by main.convertLinesToNodesParallel.func1
        e:/gopath/src/github.com/elliotchance/c2go/main.go:119 +0x1a4
elliotchance commented 5 years ago

Thanks for finding this bug. It is quite easy to fix if you would like to have a go.

See this: https://github.com/elliotchance/c2go/issues/794

Konstantin8105 commented 5 years ago

Dear @jinq0123 , Please try project https://github.com/Konstantin8105/c4go