Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
madler committed Dec 27, 2017
1 parent 57864e6 commit 9c1eaa1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 2 additions & 2 deletions 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/
Expand Down
5 changes: 5 additions & 0 deletions pigz.c
Expand Up @@ -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
Expand All @@ -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];
Expand Down

0 comments on commit 9c1eaa1

Please sign in to comment.