elliotchance / c2go

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

stb_vorbis.c does not transpile #822

Open electricface opened 5 years ago

electricface commented 5 years ago

https://github.com/nothings/stb/blob/master/stb_vorbis.c

c2go transpile stb_vorbis.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]*$
0x3b7d4c0 <col:11, col:21> 'float *' prefix '&' cannot overflow

goroutine 21 [running]:
github.com/elliotchance/c2go/ast.groupsFromRegex(0xc0003826e0, 0xa6, 0xc0006876f6, 0x3f, 0x2b)
    /home/tp/program_lang/go/src/github.com/elliotchance/c2go/ast/ast.go:286 +0x35d
github.com/elliotchance/c2go/ast.parseUnaryOperator(0xc0006876f6, 0x3f, 0x6af171)
    /home/tp/program_lang/go/src/github.com/elliotchance/c2go/ast/unary_operator.go:16 +0x62
github.com/elliotchance/c2go/ast.Parse(0xc0006876e8, 0x4d, 0x6aab24, 0x5)
    /home/tp/program_lang/go/src/github.com/elliotchance/c2go/ast/ast.go:246 +0x21de
main.convertLinesToNodes(0xc000e81870, 0x23c4, 0x4788, 0x0, 0x0, 0x0)
    /home/tp/program_lang/go/src/github.com/elliotchance/c2go/main.go:89 +0x1c8
main.convertLinesToNodesParallel.func1.1(0xc0000283c0, 0xc00000e008, 0xc000e81870, 0x23c4, 0x4788, 0x0)
    /home/tp/program_lang/go/src/github.com/elliotchance/c2go/main.go:113 +0x53
created by main.convertLinesToNodesParallel.func1
    /home/tp/program_lang/go/src/github.com/elliotchance/c2go/main.go:111 +0x11b
elliotchance commented 5 years ago

This error happens when it cannot understand a line from the clang AST output. See here for an example on how to fix: https://github.com/elliotchance/c2go/pull/770