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

cc: add support for tcc backend on windows-i386 (#6297)

This commit is contained in:
Ruofan XU 2020-09-08 21:15:35 +08:00 committed by GitHub
parent 1c5b9db63f
commit 90128ed4ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 22 additions and 7 deletions

View File

@ -1209,7 +1209,7 @@ fn (mut re RE) impl_compile(in_txt string) (int,int) {
}
// init the state stack
re.state_stack = [StateDotObj{}].repeat(tmp_count+1)
re.state_stack = []StateDotObj{len: tmp_count+1, init: StateDotObj{}}
// OR branch
// a|b|cd

View File

@ -94,7 +94,13 @@ fn test_inttypes_string_interpolation() {
i := -1622999040
ui := u32(3421958087)
vp := voidptr(ui)
bp := byteptr(15541149836)
mut bp := byteptr(0)
$if x64 {
bp = byteptr(15541149836)
}
$else {
bp = byteptr(3541149836)
}
l := i64(-7694555558525237396)
ul := u64(17234006112912956370)
assert '$s $us' == '-23456 54321'
@ -109,10 +115,17 @@ fn test_inttypes_string_interpolation() {
assert '${l:x}:${ul:X}' == '9537727cad98876c:EF2B7D4001165BD2'
// default pointer format is platform dependent, so try a few
eprintln("platform pointer format: '${vp:p}:$bp'")
assert '${vp:p}:$bp' == '0xcbf6efc7:0x39e53208c' ||
'${vp:p}:$bp' == 'CBF6EFC7:39E53208C' ||
'${vp:p}:$bp' == 'cbf6efc7:39e53208c' ||
'${vp:p}:$bp' == '00000000CBF6EFC7:000000039E53208C'
$if x64 {
assert '${vp:p}:$bp' == '0xcbf6efc7:0x39e53208c' ||
'${vp:p}:$bp' == 'CBF6EFC7:39E53208C' ||
'${vp:p}:$bp' == 'cbf6efc7:39e53208c' ||
'${vp:p}:$bp' == '00000000CBF6EFC7:000000039E53208C'
}
$else {
assert '${vp:p}:$bp' == 'CBF6EFC7:D311A88C' ||
'${vp:p}:$bp' == 'cbf6efc7:d311a88c' ||
'${vp:p}:$bp' == '0xcbf6efc7:0xd311a88c'
}
}
fn test_utf8_string_interpolation() {

View File

@ -77,6 +77,8 @@ fn C.ntohs() int
fn C.inet_ntop() int
fn C.WSAStringToAddress() int
fn C.getsockname() int
// defined in builtin

View File

@ -23,7 +23,7 @@ fn new_addr(addr C.sockaddr, _saddr string, _port int) ?Addr {
// Convert to string representation
buf := []byte{ len: max_ipv4_addr_len, init: 0 }
$if windows {
res := C.inet_ntop(SocketFamily.inet, &addr, buf.data, buf.len)
res := C.WSAStringToAddress(&addr, SocketFamily.inet, C.NULL, &buf.data, &buf.len)
if res == 0 {
socket_error(-1)?
}