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

ast: add FunctionNoProtoType #832

Merged
merged 1 commit into from
Mar 17, 2020
Merged

Conversation

mewmew
Copy link
Contributor

@mewmew mewmew commented Mar 6, 2020

c2go is now capable of parsing function types without parameters.

Example C source that is now parsed:
typedef int (*foo)();

Fixes #831.


This change is Reviewable

c2go is now capable of parsing function types without parameters.

Example C source that is now parsed:
	typedef int (*foo)();

Fixes elliotchance#831.
@mewmew
Copy link
Contributor Author

mewmew commented Mar 6, 2020

Note, c2go is now capable of parsing function signatures without parameters. However, I've not yet figured out how to add type resolution for the produced AST nodes.

When using c2go to parse the following two C source files, the former produces a Go source file without warnings, and the latter produces two warnings related to type resolution.

No warnings in Go output source file

Input C source:

typedef int (*foo)(void);

Output Go code (extract):

package main

type foo func()

Warnings related to type resolution in Go output source file

Input C source:

typedef int (*foo)();

Output Go code (extract):

// Warning (TypedefDecl):  /home/u/Desktop/ccc/a/a.c:1 : Cannot separate function 'int (*)()' : Cannot resolve type '' : probably an incorrect type translation 1
// Warning (TypedefDecl):  /home/u/Desktop/ccc/a/a.c:1 : Cannot resolve type 'int (*)()' : Cannot separate function 'int (*)()' : Cannot resolve type '' : probably an incorrect type translation 1

package main

type foo func()

@mewmew mewmew changed the title ast: add ConstantExpr ast: add FunctionNoProtoType Mar 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants