compiler: make V compilable wit the tcc backend

pull/2293/head
Alexander Medvednikov 2019-10-11 03:55:54 +03:00
parent c3787e17fd
commit 726aaecc46
5 changed files with 15 additions and 2 deletions

View File

@ -41,6 +41,12 @@ fn (p mut Parser) comp_time() {
p.statements_no_rcbr()
p.genln('#endif')
}
else if name == 'tinyc' {
p.genln('#ifdef __TINYC__')
p.check(.lcbr)
p.statements_no_rcbr()
p.genln('#endif')
}
else {
println('Supported platforms:')
println(supported_platforms)

View File

@ -4,6 +4,9 @@ import os
#flag windows -l shell32
// RegOpenKeyExA etc
#flag windows -l advapi32
struct MsvcResult {
full_cl_exe_path string
exe_path string

Binary file not shown.

View File

@ -31,7 +31,7 @@ pub fn (a f64) eq(b f64) bool {
return C.fabs(a - b) <= C.DBL_EPSILON
}
pub fn (a f32) eq(b f32) bool {
return C.fabsf(a - b) <= C.FLT_EPSILON
return C.fabs(a - b) <= C.FLT_EPSILON
}
pub fn (a f64) eqbit(b f64) bool {
return C.DEFAULT_EQUAL(a, b)

View File

@ -201,7 +201,11 @@ pub fn (s string) u32() u32 {
}
pub fn (s string) u64() u64 {
return C.strtoull(*char(s.str), 0, 0)
//$if tinyc {
return u64(s.int()) // TODO
//} $else {
//return C.strtoull(*char(s.str), 0, 0)
//}
//return C.atoll(s.str) // temporary fix for tcc on windows.
}