1
0
mirror of https://github.com/facebook/zstd.git synced 2025-07-29 11:21:22 +03:00

use PLATFORM_POSIX_VERSION

This commit is contained in:
Przemyslaw Skibinski
2016-12-16 15:00:50 +01:00
parent b0e670a054
commit 3cdfe266cf
4 changed files with 10 additions and 10 deletions

View File

@ -43,12 +43,12 @@ extern "C" {
#endif #endif
/* *********************************************************** /* ************************************************************
* Detect POSIX version * Detect POSIX version
* PLATFORM_POSIX_VERSION = 0 for non-Unix e.g. Windows * PLATFORM_POSIX_VERSION = -1 for non-Unix e.g. Windows
* PLATFORM_POSIX_VERSION = 1 for Unix-like * PLATFORM_POSIX_VERSION = 0 for Unix-like non-POSIX
* PLATFORM_POSIX_VERSION > 1 is equal to found _POSIX_VERSION * PLATFORM_POSIX_VERSION >= 1 is equal to found _POSIX_VERSION
**************************************************************/ ***************************************************************/
#if !defined(_WIN32) && (defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__)) || defined(__midipix__)) #if !defined(_WIN32) && (defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__)) || defined(__midipix__))
/* UNIX-style OS. ------------------------------------------- */ /* UNIX-style OS. ------------------------------------------- */
# if (defined(__APPLE__) && defined(__MACH__) || defined(__SVR4) || defined(_AIX) || defined(__hpux) \ # if (defined(__APPLE__) && defined(__MACH__) || defined(__SVR4) || defined(_AIX) || defined(__hpux) \
@ -62,13 +62,13 @@ extern "C" {
# if defined(_POSIX_VERSION) /* POSIX compliant */ # if defined(_POSIX_VERSION) /* POSIX compliant */
# define PLATFORM_POSIX_VERSION _POSIX_VERSION # define PLATFORM_POSIX_VERSION _POSIX_VERSION
# else # else
# define PLATFORM_POSIX_VERSION 1 # define PLATFORM_POSIX_VERSION 0
# endif # endif
# endif # endif
#endif #endif
#if !defined(PLATFORM_POSIX_VERSION) #if !defined(PLATFORM_POSIX_VERSION)
# define PLATFORM_POSIX_VERSION 0 # define PLATFORM_POSIX_VERSION -1
#endif #endif

View File

@ -73,7 +73,7 @@ extern "C" {
# define SET_HIGH_PRIORITY /* disabled */ # define SET_HIGH_PRIORITY /* disabled */
# endif # endif
# define UTIL_sleep(s) sleep(s) # define UTIL_sleep(s) sleep(s)
# if defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || (defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE >= 199309L)) # if PLATFORM_POSIX_VERSION >= 200112L /* nanosleep requires POSIX.1-2001 */
# 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 */

View File

@ -44,8 +44,7 @@
#if defined(MSDOS) || defined(OS2) || defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__) #if defined(MSDOS) || defined(OS2) || defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__)
# include <io.h> /* _isatty */ # include <io.h> /* _isatty */
# define IS_CONSOLE(stdStream) _isatty(_fileno(stdStream)) # define IS_CONSOLE(stdStream) _isatty(_fileno(stdStream))
#elif defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || defined(_POSIX_SOURCE) || (defined(__APPLE__) && defined(__MACH__)) || \ #elif PLATFORM_POSIX_VERSION >= 200112L /* isatty requires POSIX.1-2001 */
defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) /* https://sourceforge.net/p/predef/wiki/OperatingSystems/ */
# include <unistd.h> /* isatty */ # include <unistd.h> /* isatty */
# define IS_CONSOLE(stdStream) isatty(fileno(stdStream)) # define IS_CONSOLE(stdStream) isatty(fileno(stdStream))
#else #else

View File

@ -14,6 +14,7 @@
#include "platform.h" /* Compiler options */ #include "platform.h" /* Compiler options */
#include <stdio.h> /* fprintf, stderr */ #include <stdio.h> /* fprintf, stderr */
#include "datagen.h" /* RDG_generate */ #include "datagen.h" /* RDG_generate */
#include "mem.h" /* U32, U64 */
/*-************************************ /*-************************************