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

os: workaround _ = C.pipe(&pipeset[0]) gcc warning warning: ignoring return value of pipe declared with attribute warn_unused_result (#12046)

This commit is contained in:
Nicolas Sauzede 2021-10-03 07:09:08 +02:00 committed by GitHub
parent 86a5e72c74
commit 117091452b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5,9 +5,10 @@ fn C.setpgid(pid int, pgid int) int
fn (mut p Process) unix_spawn_process() int { fn (mut p Process) unix_spawn_process() int {
mut pipeset := [6]int{} mut pipeset := [6]int{}
if p.use_stdio_ctl { if p.use_stdio_ctl {
_ = C.pipe(&pipeset[0]) // pipe read end 0 <- 1 pipe write end mut dont_care := C.pipe(&pipeset[0]) // pipe read end 0 <- 1 pipe write end
_ = C.pipe(&pipeset[2]) // pipe read end 2 <- 3 pipe write end dont_care = C.pipe(&pipeset[2]) // pipe read end 2 <- 3 pipe write end
_ = C.pipe(&pipeset[4]) // pipe read end 4 <- 5 pipe write end dont_care = C.pipe(&pipeset[4]) // pipe read end 4 <- 5 pipe write end
_ = dont_care // using `_` directly on each above `pipe` fails to avoid C compiler generate an `-Wunused-result` warning
} }
pid := fork() pid := fork()
if pid != 0 { if pid != 0 {