From: Yann Collet Date: Wed, 3 Oct 2018 22:34:41 +0000 (-0700) Subject: changed ZSTD_NANOSLEEP_SUPPORT definition X-Git-Tag: v1.3.6^2~1^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4a85b126d910e2867cd1a83c64f6291f1a4a7694;p=thirdparty%2Fzstd.git changed ZSTD_NANOSLEEP_SUPPORT definition to please `-Wexpansion-to-defined` --- diff --git a/programs/platform.h b/programs/platform.h index b6b3a3bea..155ebcd1e 100644 --- a/programs/platform.h +++ b/programs/platform.h @@ -50,15 +50,15 @@ extern "C" { /* ********************************************************* * Turn on Large Files support (>4GB) for 32-bit Linux/Unix ***********************************************************/ -#if !defined(__64BIT__) || defined(__MINGW32__) /* No point defining Large file for 64 bit but MinGW-w64 requires it */ +#if !defined(__64BIT__) || defined(__MINGW32__) /* No point defining Large file for 64 bit but MinGW-w64 requires it */ # if !defined(_FILE_OFFSET_BITS) -# define _FILE_OFFSET_BITS 64 /* turn off_t into a 64-bit type for ftello, fseeko */ +# define _FILE_OFFSET_BITS 64 /* turn off_t into a 64-bit type for ftello, fseeko */ # endif -# if !defined(_LARGEFILE_SOURCE) /* obsolete macro, replaced with _FILE_OFFSET_BITS */ -# define _LARGEFILE_SOURCE 1 /* Large File Support extension (LFS) - fseeko, ftello */ +# if !defined(_LARGEFILE_SOURCE) /* obsolete macro, replaced with _FILE_OFFSET_BITS */ +# define _LARGEFILE_SOURCE 1 /* Large File Support extension (LFS) - fseeko, ftello */ # endif # if defined(_AIX) || defined(__hpux) -# define _LARGE_FILES /* Large file support on 32-bits AIX and HP-UX */ +# define _LARGE_FILES /* Large file support on 32-bits AIX and HP-UX */ # endif #endif @@ -181,8 +181,12 @@ static __inline int IS_CONSOLE(FILE* stdStream) { #ifndef ZSTD_NANOSLEEP_SUPPORT /* mandates support of nanosleep() within : http://man7.org/linux/man-pages/man2/nanosleep.2.html */ -# define ZSTD_NANOSLEEP_SUPPORT (defined(__linux__) && (PLATFORM_POSIX_VERSION >= 199309L)) \ - || (PLATFORM_POSIX_VERSION >= 200112L) +# if (defined(__linux__) && (PLATFORM_POSIX_VERSION >= 199309L)) \ + || (PLATFORM_POSIX_VERSION >= 200112L) +# define ZSTD_NANOSLEEP_SUPPORT 1 +# else +# define ZSTD_NANOSLEEP_SUPPORT 0 +# endif #endif diff --git a/programs/util.h b/programs/util.h index 596f4bbbc..67aa7a56b 100644 --- a/programs/util.h +++ b/programs/util.h @@ -20,7 +20,7 @@ extern "C" { /*-**************************************** * Dependencies ******************************************/ -#include "platform.h" /* PLATFORM_POSIX_VERSION */ +#include "platform.h" /* PLATFORM_POSIX_VERSION, ZSTD_NANOSLEEP_SUPPORT, ZSTD_SETPRIORITY_SUPPORT */ #include /* malloc */ #include /* size_t, ptrdiff_t */ #include /* fprintf */ @@ -65,7 +65,7 @@ extern "C" { #elif PLATFORM_POSIX_VERSION > 0 /* Unix-like operating system */ # include /* sleep */ # define UTIL_sleep(s) sleep(s) -# if ZSTD_NANOSLEEP_SUPPORT +# if ZSTD_NANOSLEEP_SUPPORT /* necessarily defined in platform.h */ # define UTIL_sleepMilli(milli) { struct timespec t; t.tv_sec=0; t.tv_nsec=milli*1000000ULL; nanosleep(&t, NULL); } # else # define UTIL_sleepMilli(milli) /* disabled */