From 117091452b2afe2ad2031cdc03f720bb13df24e7 Mon Sep 17 00:00:00 2001 From: Nicolas Sauzede Date: Sun, 3 Oct 2021 07:09:08 +0200 Subject: [PATCH] os: workaround `_ = C.pipe(&pipeset[0])` gcc warning `warning: ignoring return value of pipe declared with attribute warn_unused_result` (#12046) --- vlib/os/process_nix.c.v | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/vlib/os/process_nix.c.v b/vlib/os/process_nix.c.v index 74140d124d..ad37aaee12 100644 --- a/vlib/os/process_nix.c.v +++ b/vlib/os/process_nix.c.v @@ -5,9 +5,10 @@ fn C.setpgid(pid int, pgid int) int fn (mut p Process) unix_spawn_process() int { mut pipeset := [6]int{} if p.use_stdio_ctl { - _ = C.pipe(&pipeset[0]) // pipe read end 0 <- 1 pipe write end - _ = C.pipe(&pipeset[2]) // pipe read end 2 <- 3 pipe write end - _ = C.pipe(&pipeset[4]) // pipe read end 4 <- 5 pipe write end + mut dont_care := C.pipe(&pipeset[0]) // pipe read end 0 <- 1 pipe write end + dont_care = C.pipe(&pipeset[2]) // pipe read end 2 <- 3 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() if pid != 0 {