libcamera: process: Properly ignore unused result with gcc

Casting the return value of a function to (void) doesn't ignore the
unused result warning with gcc. Use a #pragma to fix this properly, to
fix compilation with _FORTIFY_SOURCE.

Fixes: df23ab95f3 ("libcamera: process: fix compilation on Chromium OS")
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
This commit is contained in:
Laurent Pinchart 2019-08-19 19:34:09 +03:00
parent d209b2d4b4
commit af4304e497

View file

@ -68,10 +68,15 @@ namespace {
void sigact(int signal, siginfo_t *info, void *ucontext) void sigact(int signal, siginfo_t *info, void *ucontext)
{ {
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-result"
/*
* We're in a signal handler so we can't log any message, and we need
* to continue anyway.
*/
char data = 0; char data = 0;
/* We're in a signal handler so we can't log any message, write(ProcessManager::instance()->writePipe(), &data, sizeof(data));
* and we need to continue anyway. */ #pragma GCC diagnostic pop
(void)write(ProcessManager::instance()->writePipe(), &data, sizeof(data));
const struct sigaction &oldsa = ProcessManager::instance()->oldsa(); const struct sigaction &oldsa = ProcessManager::instance()->oldsa();
if (oldsa.sa_flags & SA_SIGINFO) { if (oldsa.sa_flags & SA_SIGINFO) {