Konstantin8105 / c4go

Transpiling C code to Go code
MIT License
363 stars 37 forks source link

Error in sputc Mac OSX. #148

Closed LucasMW closed 5 years ago

LucasMW commented 5 years ago

Compiler message: syntax error: unexpected =, expecting )

in function sputc / __sputc - transpiled function from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/stdio.h:264

The syntax error is in this line: }())[0] = uint8(_c)))

The whole function: func __sputc(_c int, _p noarch.File) (c4goDefaultReturn int) { if func() int { tempVar := &_p[0]._w tempVar -- defer func() { }() return tempVar }() >= 0 || _p[0]._w >= _p[0]._lbfsize && int(byte(_c)) != int('\n') { return int(((func() []uint8 { tempVar := &_p[0]._p defer func() { tempVar ++ }() return tempVar }())[0] = uint8(_c))) // Warning (ast.MemberExpr): /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/stdio.h:265 :cannot determine type for LHS 'FILE ', will use 'void ' for all fields. Is lvalue = true. n.Name = _w // Warning (ast.MemberExpr): /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/stdio.h:265 :cannot determine type for LHS 'FILE ', will use 'void ' for all fields. Is lvalue = true. n.Name = _lbfsize // Warning (ast.MemberExpr): /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/stdio.h:265 :cannot determine type for LHS 'FILE ', will use 'void ' for all fields. Is lvalue = true. n.Name = _w // Warning (ast.MemberExpr): /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/stdio.h:265 :cannot determine type for LHS 'FILE ', will use 'void ' for all fields. Is lvalue = true. n.Name = _lbfsize // Warning (ast.MemberExpr): /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/stdio.h:266 :cannot determine type for LHS 'FILE ', will use 'void ' for all fields. Is lvalue = true. n.Name = _p } else { return (__swbuf(_c, _p)) } return }

Konstantin8105 commented 5 years ago

Hello, @LucasMW Generally MacOs is not supported.

LucasMW commented 5 years ago

@Konstantin8105 c4go does not support MacOs? That is sad. I've managed to make the program run by removing content. I removed the content of sputc (which wasn't used) and removed several unused headers. It worked, but I had to do it manually. I think c4go is actually close to supporting MacOs.

Konstantin8105 commented 5 years ago

Yes, you right. MacOS use to many specific. I recomend use project https://github.com/elliotchance/c2go for MacOs.

stek29 commented 5 years ago

Why does have Transpiler works on linux and Mac machines in readme then?

Also, the fact it's failing on Darwin stdio doesn't mean Darwin stdio is bad, it means that c4go can't handle it -- and same error can happen in the code being transpiled on linux too.

Konstantin8105 commented 5 years ago

Thank you @stek29, I will fix , because Mac is not support.