From 06c26e37edbea4a9deb3c55f6f7b8ea10fea69e8 Mon Sep 17 00:00:00 2001 From: llyyr Date: Mon, 23 Oct 2023 19:34:59 +0530 Subject: [PATCH] osdep: fix clang warnings with `_FORTIFY_SOURCE` This fixes warnings generated for `-Wunused-result` when mpv is built with `-O1 -D_FORTIFY_SOURCE=1` or higher on clang since read/write functions are declared with the `warn_unused_result` attribute. Cast to void to avoid these warnings. --- osdep/subprocess-posix.c | 2 +- osdep/terminal-unix.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/osdep/subprocess-posix.c b/osdep/subprocess-posix.c index 013ca143ed..2d81b9a10f 100644 --- a/osdep/subprocess-posix.c +++ b/osdep/subprocess-posix.c @@ -134,7 +134,7 @@ static pid_t spawn_process(const char *path, struct mp_subprocess_opts *opts, as_execvpe(path, opts->exe, opts->args, opts->env ? opts->env : environ); child_failed: - write(p[1], &(char){1}, 1); // shouldn't be able to fail + (void)write(p[1], &(char){1}, 1); // shouldn't be able to fail _exit(1); } diff --git a/osdep/terminal-unix.c b/osdep/terminal-unix.c index 99073d90e2..d31e1e753f 100644 --- a/osdep/terminal-unix.c +++ b/osdep/terminal-unix.c @@ -435,7 +435,7 @@ static void *terminal_thread(void *ptr) } if (fds[1].revents & POLLIN) { int8_t c = -1; - read(stop_cont_pipe[0], &c, 1); + (void)read(stop_cont_pipe[0], &c, 1); if (c == PIPE_STOP) do_deactivate_getch2(); else if (c == PIPE_CONT)