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

pull/12050/head
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
1 changed files with 4 additions and 3 deletions

View File

@ -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 {