Open garfeng opened 2 years ago
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).
If it can work, welcome to create a pr.
GNUInlineAttr is supported.
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.
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
@xushiwei
I will fix this soon.
I get the error:
Environment: Windows 11, msys2