Skip to content
This repository has been archived by the owner on May 18, 2024. It is now read-only.

compileFunc: unknown kind = GNUInlineAttr #5

Open
garfeng opened this issue Apr 11, 2022 · 6 comments
Open

compileFunc: unknown kind = GNUInlineAttr #5

garfeng opened this issue Apr 11, 2022 · 6 comments
Labels
bug Something isn't working

Comments

@garfeng
Copy link

garfeng commented Apr 11, 2022

I get the error:

 c2go.exe hello.c
2022/04/11 09:54:54 compileFunc: unknown kind = GNUInlineAttr

Environment: Windows 11, msys2

@xushiwei xushiwei added the bug Something isn't working label Apr 12, 2022
@xushiwei
Copy link
Member

Currently I only test it on macOS.

You can try add GNUInlineAttr to clang/ast (https://github.com/goplus/c2go/blob/main/clang/ast/ast.go#L67), and skip it when compileFunc (https://github.com/goplus/c2go/blob/main/cl/compile.go#L175).

@xushiwei
Copy link
Member

If it can work, welcome to create a pr.

@xushiwei
Copy link
Member

GNUInlineAttr is supported.

@xushiwei
Copy link
Member

I make testdata/atomic passed c2go -test.

See https://github.com/goplus/c2go/blob/main/testdata/atomic/libc_windows.go

You can try same way in other test cases.

@garfeng
Copy link
Author

garfeng commented Jun 10, 2022

Thank you very much for your help.

Translation is still unable in windows.

I have added some other missing typename.

Then I got the error:

c2go atomic.c
# command-line-arguments
.\atomic.c.i.go:30:24: undefined: struct_threadmbcinfostruct
.\atomic.c.i.go:33:11: undefined: struct_threadmbcinfostruct
.\atomic.c.i.go:62:23: undefined: struct_lconv
.\atomic.c.i.go:68:23: undefined: struct___lc_time_data
.\atomic.c.i.go:95:13: undefined: __mingw_vsscanf
.\atomic.c.i.go:104:13: undefined: __mingw_vfscanf
.\atomic.c.i.go:104:29: undefined: __acrt_iob_func
.\libc_windows.go:3:22: undefined: struct__reent
.\libc_windows.go:7:22: undefined: struct__reent
.\libc_windows.go:11:20: undefined: struct__reent
.\atomic.c.i.go:104:29: too many errors
2022/06/10 10:33:21 exit status 2
panic: exit status 2


goroutine 1 [running]:
log.Panicln({0xc00018bb28?, 0x854518?, 0xc000006018?})
        D:/app/go/src/log/log.go:399 +0x65
github.com/goplus/c2go.fatalWith({0x854598?, 0xc0000fc100}, {0x854518, 0xc000006018}, {0x854518?, 0xc000006020?})
        D:/work/go/src/c2go/c2go.go:343 +0xd4
github.com/goplus/c2go.checkWith(...)
        D:/work/go/src/c2go/c2go.go:327
github.com/goplus/c2go.runGoApp({0x0, 0x0}, {0x854518, 0xc000006018}, {0x854518, 0xc000006020}, 0x0)
        D:/work/go/src/c2go/c2go.go:276 +0x555
github.com/goplus/c2go.execFile({0x7ea6a6, 0x4}, {0xc0000881a0, 0xa}, 0x81)
        D:/work/go/src/c2go/c2go.go:214 +0x485
github.com/goplus/c2go.Run({0x7ea6a6, 0x4}, {0xc0000180e0, 0x8}, 0x1, 0x7fba01?)
        D:/work/go/src/c2go/c2go.go:99 +0x167
github.com/goplus/c2go/cmd/c2go/impl.Main(0xc00007a060, {0xc00006e3d0, 0x1, 0x1})
        D:/work/go/src/c2go/cmd/c2go/impl/c2go.go:75 +0x385
main.main()
        D:/work/go/src/c2go/cmd/c2go/main.go:16 +0x8d

$ ls
atomic.c         atomic.c.i       atomic.c.i.go    libc.go          libc_windows.go

I have upload the atomic.c.i and atomic.c.i.go

atomic.zip

@xushiwei

@xushiwei xushiwei reopened this Jun 10, 2022
@xushiwei
Copy link
Member

I will fix this soon.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants