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

Could not match regexp - FieldDecl - unsigned short #27

Closed
carstenhag opened this issue Apr 14, 2017 · 3 comments
Closed

Could not match regexp - FieldDecl - unsigned short #27

carstenhag opened this issue Apr 14, 2017 · 3 comments
Labels
Milestone

Comments

@carstenhag
Copy link

carstenhag commented Apr 14, 2017

Machine: Macbook, OS: 64bit Mac OS X 10.12.3 16D32 , Kernel: x86_64 Darwin 16.4.0 (different machine than the other issue)
knightstour.c Gist

It consists of a few basic input/output stuff, recursive methods, simple math functions and memory allocation.

Hi, I tried to transpile a C program I wrote but unfortunately c2go seems to have a problem with unsigned shorts, yet I don't use that data type at all in the program.

~ λ c2go knightstour.c
panic: could not match regexp '(?P<address>[0-9a-fx]+) <(?P<position>.*)>(?P<position2> [^ ]+)?(?P<referenced> referenced)? (?P<name>\w+?) '(?P<type>.+?)'' with string 'FieldDecl 0x7f9bc9083d00 <line:91:5, line:97:8> line:91:5 'unsigned short''

goroutine 1 [running]:
main.groupsFromRegex(0x1122b7a, 0x6f, 0xc420298d34, 0x4a, 0x1)
	/Users/chag0709/go/src/github.com/elliotchance/c2go/ast.go:150 +0x392
main.parseFieldDecl(0xc420298d34, 0x4a, 0x111b029)
	/Users/chag0709/go/src/github.com/elliotchance/c2go/field_decl.go:26 +0x4e
main.Parse(0xc420298d34, 0x4a, 0x4e, 0xc4200841e0)
	/Users/chag0709/go/src/github.com/elliotchance/c2go/ast.go:69 +0xb9c
main.convertLinesToNodes(0xc4202fe000, 0x16f9, 0x16f9, 0xc4202fe000, 0x16f9, 0x16f9)
	/Users/chag0709/go/src/github.com/elliotchance/c2go/main.go:38 +0x1d8
main.Start(0xc42007c060, 0x2, 0x2, 0x0, 0x0)
	/Users/chag0709/go/src/github.com/elliotchance/c2go/main.go:143 +0x289
main.main()
	/Users/chag0709/go/src/github.com/elliotchance/c2go/main.go:171 +0x49
@elliotchance
Copy link
Owner

At the moment these header files aren't actually supported. I am doing a release for each header file at the moment.

I will fix up this specific AST bug in the next patch release.

@elliotchance
Copy link
Owner

#31

Sorry I forgot to explain. It's true that your code does not contain unsigned short however when the code is preprocessed with clang all of the header files are included and one of them will be using an unsigned short.

@elliotchance elliotchance modified the milestone: v0.8.4 Apr 15, 2017
@elliotchance
Copy link
Owner

This specific error was fixed in v0.8.4: https://github.com/elliotchance/c2go/pull/31/files#diff-4ad9b558001cb3715242544f18347066R368

Being able to compile knightstour.c is a much greater task.

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

No branches or pull requests

2 participants