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

builtin,os: fix unused return C warnings for real (#9814)

This commit is contained in:
Nicolas Sauzede
2021-04-20 16:28:58 +02:00
committed by GitHub
parent 0b0a5de9e5
commit 258be508f4
3 changed files with 19 additions and 17 deletions

View File

@ -120,12 +120,12 @@ pub fn eprintln(s string) {
C.fprintf(C.stderr, c'%.*s\n', s.len, s.str)
}
} $else {
_ := 0
mut n := 0
if s.str == 0 {
_ = C.write(2, c'eprintln(NIL)\n', 14)
n = C.write(2, c'eprintln(NIL)\n', 14)
} else {
_ = C.write(2, s.str, s.len)
_ = C.write(2, c'\n', 1)
n = C.write(2, s.str, s.len)
n = C.write(2, c'\n', 1)
}
}
C.fflush(C.stderr)
@ -158,11 +158,11 @@ pub fn eprint(s string) {
C.fprintf(C.stderr, c'%.*s', s.len, s.str)
}
} $else {
_ := 0
mut n := 0
if s.str == 0 {
_ = C.write(2, c'eprint(NIL)', 11)
n = C.write(2, c'eprint(NIL)', 11)
} else {
_ = C.write(2, s.str, s.len)
n = C.write(2, s.str, s.len)
}
}
C.fflush(C.stderr)
@ -172,7 +172,7 @@ pub fn eprint(s string) {
// print prints a message to stdout. Unlike `println` stdout is not automatically flushed.
// A call to `flush()` will flush the output buffer to stdout.
pub fn print(s string) {
_ := 0
mut n := 0
$if android {
C.fprintf(C.stdout, c'%.*s', s.len, s.str)
} $else $if ios {
@ -181,7 +181,7 @@ pub fn print(s string) {
} $else $if freestanding {
bare_print(s.str, u64(s.len))
} $else {
_ = C.write(1, s.str, s.len)
n = C.write(1, s.str, s.len)
}
}
@ -194,7 +194,7 @@ fn C.asl_log(voidptr, voidptr, int, charptr)
*/
// println prints a message with a line end, to stdout. stdout is flushed.
pub fn println(s string) {
_ := 0
mut n := 0
if s.str == 0 {
$if android {
C.fprintf(C.stdout, c'println(NIL)\n')
@ -204,7 +204,7 @@ pub fn println(s string) {
bare_print(s.str, u64(s.len))
bare_print(c'println(NIL)\n', 13)
} $else {
_ = C.write(1, c'println(NIL)\n', 13)
n = C.write(1, c'println(NIL)\n', 13)
}
return
}
@ -216,8 +216,8 @@ pub fn println(s string) {
bare_print(s.str, u64(s.len))
bare_print(c'\n', 1)
} $else {
_ = C.write(1, s.str, s.len)
_ = C.write(1, c'\n', 1)
n = C.write(1, s.str, s.len)
n = C.write(1, c'\n', 1)
}
}