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

ci: prepare for enabling compilation with g++ again

This commit is contained in:
Delyan Angelov 2020-07-25 19:20:47 +03:00
parent 7c86156be5
commit 3d2fd471b6
2 changed files with 11 additions and 7 deletions

View File

@ -124,8 +124,9 @@ fn (mut d DenseArray) push(key string, value voidptr) u32 {
if d.cap == d.len {
d.cap += d.cap >> 3
unsafe {
d.keys = &string(v_realloc(d.keys, sizeof(string) * d.cap))
d.values = v_realloc(d.values, u32(d.value_bytes) * d.cap)
x := v_realloc(byteptr(d.keys), sizeof(string) * d.cap)
d.keys = &string(x)
d.values = v_realloc(byteptr(d.values), u32(d.value_bytes) * d.cap)
}
}
push_index := d.len
@ -174,8 +175,9 @@ fn (mut d DenseArray) zeros_to_end() {
d.len = count
d.cap = if count < 8 { u32(8) } else { count }
unsafe {
d.keys = &string(v_realloc(d.keys, sizeof(string) * d.cap))
d.values = v_realloc(d.values, u32(d.value_bytes) * d.cap)
x := v_realloc(byteptr(d.keys), sizeof(string) * d.cap)
d.keys = &string(x)
d.values = v_realloc(byteptr(d.values), u32(d.value_bytes) * d.cap)
}
}
@ -280,7 +282,8 @@ fn (mut m map) ensure_extra_metas(probe_count u32) {
m.extra_metas += extra_metas_inc
mem_size := (m.cap + 2 + m.extra_metas)
unsafe {
m.metas = &u32(v_realloc(m.metas, sizeof(u32) * mem_size))
x := v_realloc(byteptr(m.metas), sizeof(u32) * mem_size)
m.metas = &u32(x)
C.memset(m.metas + mem_size - extra_metas_inc, 0, sizeof(u32) * extra_metas_inc)
}
// Should almost never happen
@ -342,7 +345,8 @@ fn (mut m map) expand() {
fn (mut m map) rehash() {
meta_bytes := sizeof(u32) * (m.cap + 2 + m.extra_metas)
unsafe {
m.metas = &u32(v_realloc(m.metas, meta_bytes))
x := v_realloc(byteptr(m.metas), meta_bytes)
m.metas = &u32(x)
C.memset(m.metas, 0, meta_bytes)
}
for i := u32(0); i < m.key_values.len; i++ {

View File

@ -16,7 +16,7 @@ const (
c_reserved = ['delete', 'exit', 'link', 'unix', 'error', 'calloc', 'malloc', 'free', 'panic',
'auto', 'char', 'default', 'do', 'double', 'extern', 'float', 'inline', 'int', 'long', 'register',
'restrict', 'short', 'signed', 'sizeof', 'static', 'switch', 'typedef', 'union', 'unsigned', 'void',
'volatile', 'while', 'new', 'namespace', 'class', 'typename']
'volatile', 'while', 'new', 'namespace', 'class', 'typename', 'export']
// same order as in token.Kind
cmp_str = ['eq', 'ne', 'gt', 'lt', 'ge', 'le']
// when operands are switched