1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

checker: c2v fixes (#14161)

This commit is contained in:
playX 2022-04-25 22:34:26 +00:00 committed by GitHub
parent 501b293e84
commit dce2173ac9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 0 deletions

View File

@ -482,3 +482,6 @@ fn C.glTexImage2D()
// used by ios for println // used by ios for println
fn C.WrappedNSLog(str &u8) fn C.WrappedNSLog(str &u8)
// absolute value
fn C.abs(number int) int

View File

@ -19,6 +19,10 @@ pub fn (mut c Checker) check_types(got ast.Type, expected ast.Type) bool {
if expected == ast.voidptr_type { if expected == ast.voidptr_type {
return true return true
} }
if expected == ast.bool_type && (got.is_any_kind_of_pointer() || got.is_int()) {
return true
}
if expected.is_any_kind_of_pointer() { //&& !got.is_any_kind_of_pointer() { if expected.is_any_kind_of_pointer() { //&& !got.is_any_kind_of_pointer() {
// Allow `int` as `&i8` etc in C code. // Allow `int` as `&i8` etc in C code.
deref := expected.deref() deref := expected.deref()