changed ZSTD_NANOSLEEP_SUPPORT definition

to please `-Wexpansion-to-defined`
This commit is contained in:
Yann Collet 2018-10-03 15:34:41 -07:00
parent 549c19b42e
commit 4a85b126d9
2 changed files with 13 additions and 9 deletions

View File

@ -50,15 +50,15 @@ extern "C" {
/* ********************************************************* /* *********************************************************
* Turn on Large Files support (>4GB) for 32-bit Linux/Unix * 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) # 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 # endif
# if !defined(_LARGEFILE_SOURCE) /* obsolete macro, replaced with _FILE_OFFSET_BITS */ # if !defined(_LARGEFILE_SOURCE) /* obsolete macro, replaced with _FILE_OFFSET_BITS */
# define _LARGEFILE_SOURCE 1 /* Large File Support extension (LFS) - fseeko, ftello */ # define _LARGEFILE_SOURCE 1 /* Large File Support extension (LFS) - fseeko, ftello */
# endif # endif
# if defined(_AIX) || defined(__hpux) # 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
#endif #endif
@ -181,8 +181,12 @@ static __inline int IS_CONSOLE(FILE* stdStream) {
#ifndef ZSTD_NANOSLEEP_SUPPORT #ifndef ZSTD_NANOSLEEP_SUPPORT
/* mandates support of nanosleep() within <time.h> : http://man7.org/linux/man-pages/man2/nanosleep.2.html */ /* mandates support of nanosleep() within <time.h> : http://man7.org/linux/man-pages/man2/nanosleep.2.html */
# define ZSTD_NANOSLEEP_SUPPORT (defined(__linux__) && (PLATFORM_POSIX_VERSION >= 199309L)) \ # if (defined(__linux__) && (PLATFORM_POSIX_VERSION >= 199309L)) \
|| (PLATFORM_POSIX_VERSION >= 200112L) || (PLATFORM_POSIX_VERSION >= 200112L)
# define ZSTD_NANOSLEEP_SUPPORT 1
# else
# define ZSTD_NANOSLEEP_SUPPORT 0
# endif
#endif #endif

View File

@ -20,7 +20,7 @@ extern "C" {
/*-**************************************** /*-****************************************
* Dependencies * Dependencies
******************************************/ ******************************************/
#include "platform.h" /* PLATFORM_POSIX_VERSION */ #include "platform.h" /* PLATFORM_POSIX_VERSION, ZSTD_NANOSLEEP_SUPPORT, ZSTD_SETPRIORITY_SUPPORT */
#include <stdlib.h> /* malloc */ #include <stdlib.h> /* malloc */
#include <stddef.h> /* size_t, ptrdiff_t */ #include <stddef.h> /* size_t, ptrdiff_t */
#include <stdio.h> /* fprintf */ #include <stdio.h> /* fprintf */
@ -65,7 +65,7 @@ extern "C" {
#elif PLATFORM_POSIX_VERSION > 0 /* Unix-like operating system */ #elif PLATFORM_POSIX_VERSION > 0 /* Unix-like operating system */
# include <unistd.h> /* sleep */ # include <unistd.h> /* sleep */
# define UTIL_sleep(s) sleep(s) # 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); } # define UTIL_sleepMilli(milli) { struct timespec t; t.tv_sec=0; t.tv_nsec=milli*1000000ULL; nanosleep(&t, NULL); }
# else # else
# define UTIL_sleepMilli(milli) /* disabled */ # define UTIL_sleepMilli(milli) /* disabled */