From 9c1eaa1792f4d712db3213ec295e13440932e466 Mon Sep 17 00:00:00 2001 From: Mark Adler Date: Tue, 26 Dec 2017 14:46:47 -0800 Subject: [PATCH] Improve compatibility for cross-platform testing. Avoid warning for ignoring chown() return value on some glibc's, and change compiler from cc to gcc. Sometimes the (void) before chown() is not sufficient to signal the programmer's intent to ignore the return value. (Thank you return-value police.) This commit kills that gcc warning just for copymeta(). Using pragma then required ignoring a warning for versions of gcc that don't recognize it (when using -Wall). Finally, gcc is used instead of cc for platforms that don't make that equivalency. --- Makefile | 4 ++-- pigz.c | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 45ce793..c31bd80 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ -CC=cc -CFLAGS=-O3 -Wall -Wextra +CC=gcc +CFLAGS=-O3 -Wall -Wextra -Wno-unknown-pragmas LDFLAGS= LIBS=-lm -lpthread -lz ZOPFLI=zopfli/src/zopfli/ diff --git a/pigz.c b/pigz.c index 622e226..743f24e 100644 --- a/pigz.c +++ b/pigz.c @@ -3574,6 +3574,9 @@ local char *justname(char *path) { return p == NULL ? path : p + 1; } +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-result" + // Copy file attributes, from -> to, as best we can. This is best effort, so no // errors are reported. The mode bits, including suid, sgid, and the sticky bit // are copied (if allowed), the owner's user id and group id are copied (again @@ -3600,6 +3603,8 @@ local void copymeta(char *from, char *to) { (void)utimes(to, times); } +#pragma GCC diagnostic pop + // Set the access and modify times of fd to t. local void touch(char *path, time_t t) { struct timeval times[2];