Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transpillation on MacOS 10.15 causes panic: could not match regexp with string #856

Open
mharvey opened this issue May 28, 2020 · 2 comments

Comments

@mharvey
Copy link

mharvey commented May 28, 2020

When attempting to run c2go transpile, the AvailabilityAttr items in the AST cause a panic.

panic: 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]*$
0x7fc5ba891778 <col:108, col:143> macos 10.7 0 0 "" "" 0


goroutine 98 [running]:
github.com/elliotchance/c2go/ast.groupsFromRegex(0xc0006e42a0, 0xdb, 0xc00099de9c, 0x38, 0xc00099de8b)
	/Users/morganharvey/go/src/github.com/elliotchance/c2go/ast/ast.go:310 +0x360
github.com/elliotchance/c2go/ast.parseAvailabilityAttr(0xc00099de9c, 0x38, 0x12b3340)
	/Users/morganharvey/go/src/github.com/elliotchance/c2go/ast/availability_attr.go:24 +0x62
github.com/elliotchance/c2go/ast.Parse(0xc00099de8b, 0x49, 0x12adcd4, 0x5)
	/Users/morganharvey/go/src/github.com/elliotchance/c2go/ast/ast.go:86 +0x2701
main.convertLinesToNodes(0xc00011ecb0, 0x2cc, 0x29f4, 0x0, 0x0, 0x0)
	/Users/morganharvey/go/src/github.com/elliotchance/c2go/main.go:89 +0x1a6
main.convertLinesToNodesParallel.func1.2(0xc000118000, 0xc00011a028, 0xc00011ecb0, 0x2cc, 0x29f4, 0x0)
	/Users/morganharvey/go/src/github.com/elliotchance/c2go/main.go:121 +0x53
created by main.convertLinesToNodesParallel.func1
	/Users/morganharvey/go/src/github.com/elliotchance/c2go/main.go:119 +0x1b5

I've included the full AST in case it helps with debugging.

ast.txt

@elliotchance
Copy link
Owner

This happens when c2go can't understand a particular line of the clang AWS output. You can fix this by adding a test and modifying the regep. Here is an example: https://github.com/elliotchance/c2go/pull/840/files

@mharvey
Copy link
Author

mharvey commented Jun 8, 2020

That appears to be pretty straightforward. Thanks for the pointer. I'll throw a PR your way as my week allows.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants