ci: fix `v -cc clang-11 -cflags -Werror cmd/v`

pull/9608/head
Delyan Angelov 2021-04-05 08:08:51 +03:00
parent 34aa67b1e8
commit 5c07cbf5d3
No known key found for this signature in database
GPG Key ID: 66886C0F12D595ED
3 changed files with 19 additions and 19 deletions

View File

@ -7,13 +7,13 @@ pub const (
rtld_lazy = C.RTLD_LAZY rtld_lazy = C.RTLD_LAZY
) )
fn C.dlopen(filename charptr, flags int) voidptr fn C.dlopen(filename &char, flags int) voidptr
fn C.dlsym(handle voidptr, symbol charptr) voidptr fn C.dlsym(handle voidptr, symbol &char) voidptr
fn C.dlclose(handle voidptr) int fn C.dlclose(handle voidptr) int
fn C.dlerror() charptr fn C.dlerror() &char
// open loads the dynamic shared object. // open loads the dynamic shared object.
pub fn open(filename string, flags int) voidptr { pub fn open(filename string, flags int) voidptr {
@ -35,5 +35,5 @@ pub fn sym(handle voidptr, symbol string) voidptr {
// that occurred from a call to one of the `dl` functions, since the last // that occurred from a call to one of the `dl` functions, since the last
// call to dlerror() // call to dlerror()
pub fn dlerror() string { pub fn dlerror() string {
return unsafe { cstring_to_vstring(byteptr(C.dlerror())) } return unsafe { cstring_to_vstring(C.dlerror()) }
} }

View File

@ -25,7 +25,7 @@ pub fn getenv(key string) string {
return '' return ''
} }
// NB: C.getenv *requires* that the result be copied. // NB: C.getenv *requires* that the result be copied.
return cstring_to_vstring(&byte(s)) return cstring_to_vstring(s)
} }
} }
} }
@ -99,7 +99,7 @@ pub fn environ() map[string]string {
if isnil(derefed) { if isnil(derefed) {
break break
} }
eline := unsafe { cstring_to_vstring(&byte(derefed)) } eline := unsafe { cstring_to_vstring(derefed) }
eq_index := eline.index_byte(`=`) eq_index := eline.index_byte(`=`)
if eq_index > 0 { if eq_index > 0 {
res[eline[0..eq_index]] = eline[eq_index + 1..] res[eline[0..eq_index]] = eline[eq_index + 1..]

View File

@ -40,16 +40,16 @@ pub const (
struct C.utsname { struct C.utsname {
mut: mut:
sysname charptr sysname &char
nodename charptr nodename &char
release charptr release &char
version charptr version &char
machine charptr machine &char
} }
fn C.uname(name voidptr) int fn C.uname(name voidptr) int
fn C.symlink(charptr, charptr) int fn C.symlink(&char, &char) int
pub fn uname() Uname { pub fn uname() Uname {
mut u := Uname{} mut u := Uname{}
@ -58,11 +58,11 @@ pub fn uname() Uname {
x := malloc(int(utsize)) x := malloc(int(utsize))
d := &C.utsname(x) d := &C.utsname(x)
if C.uname(d) == 0 { if C.uname(d) == 0 {
u.sysname = cstring_to_vstring(byteptr(d.sysname)) u.sysname = cstring_to_vstring(d.sysname)
u.nodename = cstring_to_vstring(byteptr(d.nodename)) u.nodename = cstring_to_vstring(d.nodename)
u.release = cstring_to_vstring(byteptr(d.release)) u.release = cstring_to_vstring(d.release)
u.version = cstring_to_vstring(byteptr(d.version)) u.version = cstring_to_vstring(d.version)
u.machine = cstring_to_vstring(byteptr(d.machine)) u.machine = cstring_to_vstring(d.machine)
} }
free(d) free(d)
} }
@ -94,7 +94,7 @@ pub fn ls(path string) ?[]string {
break break
} }
unsafe { unsafe {
bptr := byteptr(&ent.d_name[0]) bptr := &byte(&ent.d_name[0])
if bptr[0] == 0 || (bptr[0] == `.` && bptr[1] == 0) if bptr[0] == 0 || (bptr[0] == `.` && bptr[1] == 0)
|| (bptr[0] == `.` && bptr[1] == `.` && bptr[2] == 0) { || (bptr[0] == `.` && bptr[1] == `.` && bptr[2] == 0) {
continue continue
@ -278,7 +278,7 @@ pub fn debugger_present() bool {
return false return false
} }
fn C.mkstemp(stemplate byteptr) int fn C.mkstemp(stemplate &byte) int
// `is_writable_folder` - `folder` exists and is writable to the process // `is_writable_folder` - `folder` exists and is writable to the process
pub fn is_writable_folder(folder string) ?bool { pub fn is_writable_folder(folder string) ?bool {