Konstantin8105 / c4go

Transpiling C code to Go code
MIT License
365 stars 39 forks source link

AST Error : cannot parse line: `AvailabilityAttr #477

Closed dimchansky closed 3 years ago

dimchansky commented 5 years ago

Getting many AST errors, when trying to run c4go transpile prime.c:

$ clang --version
Apple clang version 11.0.0 (clang-1100.0.33.12)
Target: x86_64-apple-darwin18.7.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
$ go version
go version go1.13 darwin/amd64
$ go get -u github.com/Konstantin8105/c4go
$ cd $GOPATH/src/github.com/Konstantin8105/c4go
$ go generate ./...
$ go install
$ c4go version
Build time: Nov  7 12:33:56 2019 UTC
Git hash:   "2be694ee034469afcdb348d84c551e7c61d025bd"

$ cd $GOPATH/src/github.com/Konstantin8105/c4go/examples/
$ c4go transpile prime.c
AST error #0:
/* AST Error :
cannot parse line: `AvailabilityAttr 0x7fca9c80ff00 <col:120, col:188> swift 0 0 0 Unavailable "Use snprintf instead." "" 0`. could not match regexp with string
^(?P<address>[0-9a-fx]+) <(?P<position>.*)>(?P<inherited> Inherited)? (?P<os>\w+) (?P<version>[\d.]+) (?P<unknown1>[\d.]+) (?P<unknown2>[\d.]+)(?P<unavalable> Unavailable)? "(?P<message1>.*?)"(?P<message2> ".*?")?[\s]*$
0x7fca9c80ff00 <col:120, col:188> swift 0 0 0 Unavailable "Use snprintf instead." "" 0

*/
AST error #1:
/* AST Error :
cannot parse line: `AvailabilityAttr 0x7fca9d008600 <col:132, col:167> macos 10.7 0 0 "" "" 0`. could not match regexp with string
^(?P<address>[0-9a-fx]+) <(?P<position>.*)>(?P<inherited> Inherited)? (?P<os>\w+) (?P<version>[\d.]+) (?P<unknown1>[\d.]+) (?P<unknown2>[\d.]+)(?P<unavalable> Unavailable)? "(?P<message1>.*?)"(?P<message2> ".*?")?[\s]*$
0x7fca9d008600 <col:132, col:167> macos 10.7 0 0 "" "" 0

*/
AST error #2:
/* AST Error :
cannot parse line: `AvailabilityAttr 0x7fca9d008978 <col:114, col:149> macos 10.7 0 0 "" "" 0`. could not match regexp with string
^(?P<address>[0-9a-fx]+) <(?P<position>.*)>(?P<inherited> Inherited)? (?P<os>\w+) (?P<version>[\d.]+) (?P<unknown1>[\d.]+) (?P<unknown2>[\d.]+)(?P<unavalable> Unavailable)? "(?P<message1>.*?)"(?P<message2> ".*?")?[\s]*$
0x7fca9d008978 <col:114, col:149> macos 10.7 0 0 "" "" 0

*/
AST error #3:
/* AST Error :
cannot parse line: `AvailabilityAttr 0x7fca9d008d28 <col:99, col:134> macos 10.13 0 0 "" "" 0`. could not match regexp with string
^(?P<address>[0-9a-fx]+) <(?P<position>.*)>(?P<inherited> Inherited)? (?P<os>\w+) (?P<version>[\d.]+) (?P<unknown1>[\d.]+) (?P<unknown2>[\d.]+)(?P<unavalable> Unavailable)? "(?P<message1>.*?)"(?P<message2> ".*?")?[\s]*$
0x7fca9d008d28 <col:99, col:134> macos 10.13 0 0 "" "" 0

*/
AST error #4:
/* AST Error :
cannot parse line: `AvailabilityAttr 0x7fca9d008dc8 <col:153, col:185> ios 11.0 0 0 "" "" 0`. could not match regexp with string
^(?P<address>[0-9a-fx]+) <(?P<position>.*)>(?P<inherited> Inherited)? (?P<os>\w+) (?P<version>[\d.]+) (?P<unknown1>[\d.]+) (?P<unknown2>[\d.]+)(?P<unavalable> Unavailable)? "(?P<message1>.*?)"(?P<message2> ".*?")?[\s]*$
0x7fca9d008dc8 <col:153, col:185> ios 11.0 0 0 "" "" 0

*/
AST error #5:
/* AST Error :
cannot parse line: `AvailabilityAttr 0x7fca9d008e38 <col:204, col:237> tvos 11.0 0 0 "" "" 0`. could not match regexp with string
^(?P<address>[0-9a-fx]+) <(?P<position>.*)>(?P<inherited> Inherited)? (?P<os>\w+) (?P<version>[\d.]+) (?P<unknown1>[\d.]+) (?P<unknown2>[\d.]+)(?P<unavalable> Unavailable)? "(?P<message1>.*?)"(?P<message2> ".*?")?[\s]*$
0x7fca9d008e38 <col:204, col:237> tvos 11.0 0 0 "" "" 0

*/
AST error #6:
/* AST Error :
cannot parse line: `AvailabilityAttr 0x7fca9d008ea8 <col:256, col:291> watchos 4.0 0 0 "" "" 0`. could not match regexp with string
^(?P<address>[0-9a-fx]+) <(?P<position>.*)>(?P<inherited> Inherited)? (?P<os>\w+) (?P<version>[\d.]+) (?P<unknown1>[\d.]+) (?P<unknown2>[\d.]+)(?P<unavalable> Unavailable)? "(?P<message1>.*?)"(?P<message2> ".*?")?[\s]*$
0x7fca9d008ea8 <col:256, col:291> watchos 4.0 0 0 "" "" 0

*/
AST error #7:
/* AST Error :
cannot parse line: `AvailabilityAttr 0x7fca9d009190 <col:69, col:104> macos 10.13 0 0 "" "" 0`. could not match regexp with string
^(?P<address>[0-9a-fx]+) <(?P<position>.*)>(?P<inherited> Inherited)? (?P<os>\w+) (?P<version>[\d.]+) (?P<unknown1>[\d.]+) (?P<unknown2>[\d.]+)(?P<unavalable> Unavailable)? "(?P<message1>.*?)"(?P<message2> ".*?")?[\s]*$
0x7fca9d009190 <col:69, col:104> macos 10.13 0 0 "" "" 0

*/
AST error #8:
/* AST Error :
cannot parse line: `AvailabilityAttr 0x7fca9d009230 <col:123, col:155> ios 11.0 0 0 "" "" 0`. could not match regexp with string
^(?P<address>[0-9a-fx]+) <(?P<position>.*)>(?P<inherited> Inherited)? (?P<os>\w+) (?P<version>[\d.]+) (?P<unknown1>[\d.]+) (?P<unknown2>[\d.]+)(?P<unavalable> Unavailable)? "(?P<message1>.*?)"(?P<message2> ".*?")?[\s]*$
0x7fca9d009230 <col:123, col:155> ios 11.0 0 0 "" "" 0

*/
AST error #9:
/* AST Error :
cannot parse line: `AvailabilityAttr 0x7fca9d0092a0 <col:174, col:207> tvos 11.0 0 0 "" "" 0`. could not match regexp with string
^(?P<address>[0-9a-fx]+) <(?P<position>.*)>(?P<inherited> Inherited)? (?P<os>\w+) (?P<version>[\d.]+) (?P<unknown1>[\d.]+) (?P<unknown2>[\d.]+)(?P<unavalable> Unavailable)? "(?P<message1>.*?)"(?P<message2> ".*?")?[\s]*$
0x7fca9d0092a0 <col:174, col:207> tvos 11.0 0 0 "" "" 0

*/
AST error #10:
/* AST Error :
cannot parse line: `AvailabilityAttr 0x7fca9d009310 <col:226, col:261> watchos 4.0 0 0 "" "" 0`. could not match regexp with string
^(?P<address>[0-9a-fx]+) <(?P<position>.*)>(?P<inherited> Inherited)? (?P<os>\w+) (?P<version>[\d.]+) (?P<unknown1>[\d.]+) (?P<unknown2>[\d.]+)(?P<unavalable> Unavailable)? "(?P<message1>.*?)"(?P<message2> ".*?")?[\s]*$
0x7fca9d009310 <col:226, col:261> watchos 4.0 0 0 "" "" 0

*/
AST error #11:
/* AST Error :
cannot parse line: `AvailabilityAttr 0x7fca9d006d38 <col:108, col:143> macos 10.7 0 0 "" "" 0`. could not match regexp with string
^(?P<address>[0-9a-fx]+) <(?P<position>.*)>(?P<inherited> Inherited)? (?P<os>\w+) (?P<version>[\d.]+) (?P<unknown1>[\d.]+) (?P<unknown2>[\d.]+)(?P<unavalable> Unavailable)? "(?P<message1>.*?)"(?P<message2> ".*?")?[\s]*$
0x7fca9d006d38 <col:108, col:143> macos 10.7 0 0 "" "" 0

*/
AST error #12:
/* AST Error :
cannot parse line: `AvailabilityAttr 0x7fca9d007130 <col:113, col:148> macos 10.7 0 0 "" "" 0`. could not match regexp with string
^(?P<address>[0-9a-fx]+) <(?P<position>.*)>(?P<inherited> Inherited)? (?P<os>\w+) (?P<version>[\d.]+) (?P<unknown1>[\d.]+) (?P<unknown2>[\d.]+)(?P<unavalable> Unavailable)? "(?P<message1>.*?)"(?P<message2> ".*?")?[\s]*$
0x7fca9d007130 <col:113, col:148> macos 10.7 0 0 "" "" 0

*/
AST error #13:
/* AST Error :
cannot parse line: `AvailabilityAttr 0x7fca9c810880 <line:184:16, col:86> swift 0 0 0 Unavailable "Use mkstemp(3) instead." "" 0`. could not match regexp with string
^(?P<address>[0-9a-fx]+) <(?P<position>.*)>(?P<inherited> Inherited)? (?P<os>\w+) (?P<version>[\d.]+) (?P<unknown1>[\d.]+) (?P<unknown2>[\d.]+)(?P<unavalable> Unavailable)? "(?P<message1>.*?)"(?P<message2> ".*?")?[\s]*$
0x7fca9c810880 <line:184:16, col:86> swift 0 0 0 Unavailable "Use mkstemp(3) instead." "" 0

*/
AST error #14:
/* AST Error :
cannot parse line: `AvailabilityAttr 0x7fca9c811d00 <col:125, col:194> swift 0 0 0 Unavailable "Use vsnprintf instead." "" 0`. could not match regexp with string
^(?P<address>[0-9a-fx]+) <(?P<position>.*)>(?P<inherited> Inherited)? (?P<os>\w+) (?P<version>[\d.]+) (?P<unknown1>[\d.]+) (?P<unknown2>[\d.]+)(?P<unavalable> Unavailable)? "(?P<message1>.*?)"(?P<message2> ".*?")?[\s]*$
0x7fca9c811d00 <col:125, col:194> swift 0 0 0 Unavailable "Use vsnprintf instead." "" 0

*/
AST error #15:
/* AST Error :
cannot parse line: `AvailabilityAttr 0x7fca9c8124a0 <col:35, col:121> swift 0 0 0 Unavailable "Use posix_spawn APIs or NSTask instead." "" 0`. could not match regexp with string
^(?P<address>[0-9a-fx]+) <(?P<position>.*)>(?P<inherited> Inherited)? (?P<os>\w+) (?P<version>[\d.]+) (?P<unknown1>[\d.]+) (?P<unknown2>[\d.]+)(?P<unavalable> Unavailable)? "(?P<message1>.*?)"(?P<message2> ".*?")?[\s]*$
0x7fca9c8124a0 <col:35, col:121> swift 0 0 0 Unavailable "Use posix_spawn APIs or NSTask instead." "" 0

*/
AST error #16:
/* AST Error :
cannot parse line: `AvailabilityAttr 0x7fca9d004758 <line:304:16, col:86> swift 0 0 0 Unavailable "Use mkstemp(3) instead." "" 0`. could not match regexp with string
^(?P<address>[0-9a-fx]+) <(?P<position>.*)>(?P<inherited> Inherited)? (?P<os>\w+) (?P<version>[\d.]+) (?P<unknown1>[\d.]+) (?P<unknown2>[\d.]+)(?P<unavalable> Unavailable)? "(?P<message1>.*?)"(?P<message2> ".*?")?[\s]*$
0x7fca9d004758 <line:304:16, col:86> swift 0 0 0 Unavailable "Use mkstemp(3) instead." "" 0

*/
AST error #17:
/* AST Error :
cannot parse line: `AvailabilityAttr 0x7fca9c8127f8 <col:76, col:162> swift 0 0 0 Unavailable "Use posix_spawn APIs or NSTask instead." "" 0`. could not match regexp with string
^(?P<address>[0-9a-fx]+) <(?P<position>.*)>(?P<inherited> Inherited)? (?P<os>\w+) (?P<version>[\d.]+) (?P<unknown1>[\d.]+) (?P<unknown2>[\d.]+)(?P<unavalable> Unavailable)? "(?P<message1>.*?)"(?P<message2> ".*?")?[\s]*$
0x7fca9c8127f8 <col:76, col:162> swift 0 0 0 Unavailable "Use posix_spawn APIs or NSTask instead." "" 0

*/
AST error #18:
/* AST Error :
cannot parse line: `AvailabilityAttr 0x7fca9c804728 <col:67, col:103> macos 10.10 0 0 "" "" 0`. could not match regexp with string
^(?P<address>[0-9a-fx]+) <(?P<position>.*)>(?P<inherited> Inherited)? (?P<os>\w+) (?P<version>[\d.]+) (?P<unknown1>[\d.]+) (?P<unknown2>[\d.]+)(?P<unavalable> Unavailable)? "(?P<message1>.*?)"(?P<message2> ".*?")?[\s]*$
0x7fca9c804728 <col:67, col:103> macos 10.10 0 0 "" "" 0

*/
AST error #19:
/* AST Error :
cannot parse line: `AvailabilityAttr 0x7fca9c8064f0 <col:73, col:109> macos 10.12 0 0 "" "" 0`. could not match regexp with string
^(?P<address>[0-9a-fx]+) <(?P<position>.*)>(?P<inherited> Inherited)? (?P<os>\w+) (?P<version>[\d.]+) (?P<unknown1>[\d.]+) (?P<unknown2>[\d.]+)(?P<unavalable> Unavailable)? "(?P<message1>.*?)"(?P<message2> ".*?")?[\s]*$
0x7fca9c8064f0 <col:73, col:109> macos 10.12 0 0 "" "" 0

*/
AST error #20:
/* AST Error :
cannot parse line: `AvailabilityAttr 0x7fca9c806590 <col:128, col:160> ios 10.0 0 0 "" "" 0`. could not match regexp with string
^(?P<address>[0-9a-fx]+) <(?P<position>.*)>(?P<inherited> Inherited)? (?P<os>\w+) (?P<version>[\d.]+) (?P<unknown1>[\d.]+) (?P<unknown2>[\d.]+)(?P<unavalable> Unavailable)? "(?P<message1>.*?)"(?P<message2> ".*?")?[\s]*$
0x7fca9c806590 <col:128, col:160> ios 10.0 0 0 "" "" 0

*/
AST error #21:
/* AST Error :
cannot parse line: `AvailabilityAttr 0x7fca9c806600 <col:179, col:212> tvos 10.0 0 0 "" "" 0`. could not match regexp with string
^(?P<address>[0-9a-fx]+) <(?P<position>.*)>(?P<inherited> Inherited)? (?P<os>\w+) (?P<version>[\d.]+) (?P<unknown1>[\d.]+) (?P<unknown2>[\d.]+)(?P<unavalable> Unavailable)? "(?P<message1>.*?)"(?P<message2> ".*?")?[\s]*$
0x7fca9c806600 <col:179, col:212> tvos 10.0 0 0 "" "" 0

*/
AST error #22:
/* AST Error :
cannot parse line: `AvailabilityAttr 0x7fca9c806670 <col:231, col:266> watchos 3.0 0 0 "" "" 0`. could not match regexp with string
^(?P<address>[0-9a-fx]+) <(?P<position>.*)>(?P<inherited> Inherited)? (?P<os>\w+) (?P<version>[\d.]+) (?P<unknown1>[\d.]+) (?P<unknown2>[\d.]+)(?P<unavalable> Unavailable)? "(?P<message1>.*?)"(?P<message2> ".*?")?[\s]*$
0x7fca9c806670 <col:231, col:266> watchos 3.0 0 0 "" "" 0

*/
AST error #23:
/* AST Error :
cannot parse line: `AvailabilityAttr 0x7fca9c806ae0 <col:85, col:121> macos 10.12 0 0 "" "" 0`. could not match regexp with string
^(?P<address>[0-9a-fx]+) <(?P<position>.*)>(?P<inherited> Inherited)? (?P<os>\w+) (?P<version>[\d.]+) (?P<unknown1>[\d.]+) (?P<unknown2>[\d.]+)(?P<unavalable> Unavailable)? "(?P<message1>.*?)"(?P<message2> ".*?")?[\s]*$
0x7fca9c806ae0 <col:85, col:121> macos 10.12 0 0 "" "" 0

*/
AST error #24:
/* AST Error :
cannot parse line: `AvailabilityAttr 0x7fca9c806b80 <col:140, col:172> ios 10.0 0 0 "" "" 0`. could not match regexp with string
^(?P<address>[0-9a-fx]+) <(?P<position>.*)>(?P<inherited> Inherited)? (?P<os>\w+) (?P<version>[\d.]+) (?P<unknown1>[\d.]+) (?P<unknown2>[\d.]+)(?P<unavalable> Unavailable)? "(?P<message1>.*?)"(?P<message2> ".*?")?[\s]*$
0x7fca9c806b80 <col:140, col:172> ios 10.0 0 0 "" "" 0

*/
AST error #25:
/* AST Error :
cannot parse line: `AvailabilityAttr 0x7fca9c806bf0 <col:191, col:224> tvos 10.0 0 0 "" "" 0`. could not match regexp with string
^(?P<address>[0-9a-fx]+) <(?P<position>.*)>(?P<inherited> Inherited)? (?P<os>\w+) (?P<version>[\d.]+) (?P<unknown1>[\d.]+) (?P<unknown2>[\d.]+)(?P<unavalable> Unavailable)? "(?P<message1>.*?)"(?P<message2> ".*?")?[\s]*$
0x7fca9c806bf0 <col:191, col:224> tvos 10.0 0 0 "" "" 0

*/
AST error #26:
/* AST Error :
cannot parse line: `AvailabilityAttr 0x7fca9c806c60 <col:243, col:278> watchos 3.0 0 0 "" "" 0`. could not match regexp with string
^(?P<address>[0-9a-fx]+) <(?P<position>.*)>(?P<inherited> Inherited)? (?P<os>\w+) (?P<version>[\d.]+) (?P<unknown1>[\d.]+) (?P<unknown2>[\d.]+)(?P<unavalable> Unavailable)? "(?P<message1>.*?)"(?P<message2> ".*?")?[\s]*$
0x7fca9c806c60 <col:243, col:278> watchos 3.0 0 0 "" "" 0

*/
Konstantin8105 commented 5 years ago

Hello, Feel free for creating PR for example https://github.com/Konstantin8105/c4go/pull/475/files

Konstantin8105 commented 3 years ago

Hello, try use tests env: go1.10 && ubuntu && clang3.6