From 7060aee8c2de9080135133d07221237e7db6adb7 Mon Sep 17 00:00:00 2001 From: Przemyslaw Skibinski Date: Mon, 6 Feb 2017 19:43:13 +0100 Subject: [PATCH 01/14] platform.h added to build_package.bat --- lib/dll/example/build_package.bat | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/dll/example/build_package.bat b/lib/dll/example/build_package.bat index ce738a56c..b225af8d8 100644 --- a/lib/dll/example/build_package.bat +++ b/lib/dll/example/build_package.bat @@ -4,6 +4,7 @@ COPY tests\fullbench.c bin\example\ COPY programs\datagen.c bin\example\ COPY programs\datagen.h bin\example\ COPY programs\util.h bin\example\ +COPY programs\platform.h bin\example\ COPY lib\common\mem.h bin\example\ COPY lib\common\zstd_errors.h bin\example\ COPY lib\common\zstd_internal.h bin\example\ From 94abd6a26cad4b2993fc0b5fce19a8b01d4a35ad Mon Sep 17 00:00:00 2001 From: Przemyslaw Skibinski Date: Tue, 7 Feb 2017 16:36:19 +0100 Subject: [PATCH 02/14] SET_REALTIME_PRIORITY --- programs/bench.c | 2 +- programs/util.h | 8 ++++---- zlibWrapper/examples/zwrapbench.c | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/programs/bench.c b/programs/bench.c index dcb23b1f2..c8f1dcf0a 100644 --- a/programs/bench.c +++ b/programs/bench.c @@ -457,7 +457,7 @@ static void BMK_benchCLevel(void* srcBuffer, size_t benchedSize, if (!pch) pch = strrchr(displayName, '/'); /* Linux */ if (pch) displayName = pch+1; - SET_HIGH_PRIORITY; + SET_REALTIME_PRIORITY; if (g_displayLevel == 1 && !g_additionalParam) DISPLAY("bench %s %s: input %u bytes, %u seconds, %u KB blocks\n", ZSTD_VERSION_STRING, ZSTD_GIT_COMMIT_STRING, (U32)benchedSize, g_nbSeconds, (U32)(g_blockSize>>10)); diff --git a/programs/util.h b/programs/util.h index 651027bae..656b3a96b 100644 --- a/programs/util.h +++ b/programs/util.h @@ -44,7 +44,7 @@ extern "C" { ******************************************/ #if defined(_WIN32) # include -# define SET_HIGH_PRIORITY SetPriorityClass(GetCurrentProcess(), REALTIME_PRIORITY_CLASS) +# define SET_REALTIME_PRIORITY SetPriorityClass(GetCurrentProcess(), REALTIME_PRIORITY_CLASS) # define UTIL_sleep(s) Sleep(1000*s) # define UTIL_sleepMilli(milli) Sleep(milli) #elif PLATFORM_POSIX_VERSION >= 0 /* Unix-like operating system */ @@ -52,9 +52,9 @@ extern "C" { # include /* setpriority */ # include /* clock_t, nanosleep, clock, CLOCKS_PER_SEC */ # if defined(PRIO_PROCESS) -# define SET_HIGH_PRIORITY setpriority(PRIO_PROCESS, 0, -20) +# define SET_REALTIME_PRIORITY setpriority(PRIO_PROCESS, 0, -20) # else -# define SET_HIGH_PRIORITY /* disabled */ +# define SET_REALTIME_PRIORITY /* disabled */ # endif # define UTIL_sleep(s) sleep(s) # if (defined(__linux__) && (PLATFORM_POSIX_VERSION >= 199309L)) || (PLATFORM_POSIX_VERSION >= 200112L) /* nanosleep requires POSIX.1-2001 */ @@ -63,7 +63,7 @@ extern "C" { # define UTIL_sleepMilli(milli) /* disabled */ # endif #else -# define SET_HIGH_PRIORITY /* disabled */ +# define SET_REALTIME_PRIORITY /* disabled */ # define UTIL_sleep(s) /* disabled */ # define UTIL_sleepMilli(milli) /* disabled */ #endif diff --git a/zlibWrapper/examples/zwrapbench.c b/zlibWrapper/examples/zwrapbench.c index e5c54438b..328c1096b 100644 --- a/zlibWrapper/examples/zwrapbench.c +++ b/zlibWrapper/examples/zwrapbench.c @@ -591,7 +591,7 @@ static void BMK_benchCLevel(void* srcBuffer, size_t benchedSize, if (!pch) pch = strrchr(displayName, '/'); /* Linux */ if (pch) displayName = pch+1; - SET_HIGH_PRIORITY; + SET_REALTIME_PRIORITY; if (g_displayLevel == 1 && !g_additionalParam) DISPLAY("bench %s %s: input %u bytes, %u seconds, %u KB blocks\n", ZSTD_VERSION_STRING, ZSTD_GIT_COMMIT_STRING, (U32)benchedSize, g_nbIterations, (U32)(g_blockSize>>10)); From d05014c7390ec99a6b13ba32c46529acfb5759d1 Mon Sep 17 00:00:00 2001 From: Przemyslaw Skibinski Date: Tue, 7 Feb 2017 16:48:01 +0100 Subject: [PATCH 03/14] added the "--rt-prio" option --- programs/bench.c | 23 +++++++++++++---------- programs/bench.h | 2 +- programs/zstdcli.c | 6 ++++-- 3 files changed, 18 insertions(+), 13 deletions(-) diff --git a/programs/bench.c b/programs/bench.c index c8f1dcf0a..5870eaf72 100644 --- a/programs/bench.c +++ b/programs/bench.c @@ -449,7 +449,7 @@ static void BMK_benchCLevel(void* srcBuffer, size_t benchedSize, const char* displayName, int cLevel, int cLevelLast, const size_t* fileSizes, unsigned nbFiles, const void* dictBuffer, size_t dictBufferSize, - ZSTD_compressionParameters *compressionParams) + ZSTD_compressionParameters *compressionParams, int setRealTimePrio) { int l; @@ -457,7 +457,10 @@ static void BMK_benchCLevel(void* srcBuffer, size_t benchedSize, if (!pch) pch = strrchr(displayName, '/'); /* Linux */ if (pch) displayName = pch+1; - SET_REALTIME_PRIORITY; + if (setRealTimePrio) { + DISPLAYLEVEL(2, "Note : switching to a real-time priority \n"); + SET_REALTIME_PRIORITY; + } if (g_displayLevel == 1 && !g_additionalParam) DISPLAY("bench %s %s: input %u bytes, %u seconds, %u KB blocks\n", ZSTD_VERSION_STRING, ZSTD_GIT_COMMIT_STRING, (U32)benchedSize, g_nbSeconds, (U32)(g_blockSize>>10)); @@ -505,8 +508,8 @@ static void BMK_loadFiles(void* buffer, size_t bufferSize, if (totalSize == 0) EXM_THROW(12, "no data to bench"); } -static void BMK_benchFileTable(const char** fileNamesTable, unsigned nbFiles, const char* dictFileName, - int cLevel, int cLevelLast, ZSTD_compressionParameters *compressionParams) +static void BMK_benchFileTable(const char** fileNamesTable, unsigned nbFiles, const char* dictFileName, int cLevel, + int cLevelLast, ZSTD_compressionParameters *compressionParams, int setRealTimePrio) { void* srcBuffer; size_t benchedSize; @@ -545,7 +548,7 @@ static void BMK_benchFileTable(const char** fileNamesTable, unsigned nbFiles, co BMK_benchCLevel(srcBuffer, benchedSize, displayName, cLevel, cLevelLast, fileSizes, nbFiles, - dictBuffer, dictBufferSize, compressionParams); + dictBuffer, dictBufferSize, compressionParams, setRealTimePrio); } /* clean up */ @@ -555,7 +558,7 @@ static void BMK_benchFileTable(const char** fileNamesTable, unsigned nbFiles, co } -static void BMK_syntheticTest(int cLevel, int cLevelLast, double compressibility, ZSTD_compressionParameters* compressionParams) +static void BMK_syntheticTest(int cLevel, int cLevelLast, double compressibility, ZSTD_compressionParameters* compressionParams, int setRealTimePrio) { char name[20] = {0}; size_t benchedSize = 10000000; @@ -569,7 +572,7 @@ static void BMK_syntheticTest(int cLevel, int cLevelLast, double compressibility /* Bench */ snprintf (name, sizeof(name), "Synthetic %2u%%", (unsigned)(compressibility*100)); - BMK_benchCLevel(srcBuffer, benchedSize, name, cLevel, cLevelLast, &benchedSize, 1, NULL, 0, compressionParams); + BMK_benchCLevel(srcBuffer, benchedSize, name, cLevel, cLevelLast, &benchedSize, 1, NULL, 0, compressionParams, setRealTimePrio); /* clean up */ free(srcBuffer); @@ -577,7 +580,7 @@ static void BMK_syntheticTest(int cLevel, int cLevelLast, double compressibility int BMK_benchFiles(const char** fileNamesTable, unsigned nbFiles, const char* dictFileName, - int cLevel, int cLevelLast, ZSTD_compressionParameters* compressionParams) + int cLevel, int cLevelLast, ZSTD_compressionParameters* compressionParams, int setRealTimePrio) { double const compressibility = (double)g_compressibilityDefault / 100; @@ -587,8 +590,8 @@ int BMK_benchFiles(const char** fileNamesTable, unsigned nbFiles, const char* di if (cLevelLast > cLevel) DISPLAYLEVEL(2, "Benchmarking levels from %d to %d\n", cLevel, cLevelLast); if (nbFiles == 0) - BMK_syntheticTest(cLevel, cLevelLast, compressibility, compressionParams); + BMK_syntheticTest(cLevel, cLevelLast, compressibility, compressionParams, setRealTimePrio); else - BMK_benchFileTable(fileNamesTable, nbFiles, dictFileName, cLevel, cLevelLast, compressionParams); + BMK_benchFileTable(fileNamesTable, nbFiles, dictFileName, cLevel, cLevelLast, compressionParams, setRealTimePrio); return 0; } diff --git a/programs/bench.h b/programs/bench.h index 2918c02bf..77a527f8f 100644 --- a/programs/bench.h +++ b/programs/bench.h @@ -16,7 +16,7 @@ #include "zstd.h" /* ZSTD_compressionParameters */ int BMK_benchFiles(const char** fileNamesTable, unsigned nbFiles,const char* dictFileName, - int cLevel, int cLevelLast, ZSTD_compressionParameters* compressionParams); + int cLevel, int cLevelLast, ZSTD_compressionParameters* compressionParams, int setRealTimePrio); /* Set Parameters */ void BMK_setNbSeconds(unsigned nbLoops); diff --git a/programs/zstdcli.c b/programs/zstdcli.c index 6ca294fc2..30391eb0e 100644 --- a/programs/zstdcli.c +++ b/programs/zstdcli.c @@ -267,7 +267,8 @@ int main(int argCount, const char* argv[]) nextArgumentsAreFiles=0, ultra=0, lastCommand = 0, - nbThreads = 1; + nbThreads = 1, + setRealTimePrio = 0; unsigned bench_nbSeconds = 3; /* would be better if this value was synchronized from bench */ size_t blockSize = 0; zstd_operation_mode operation = zom_compress; @@ -356,6 +357,7 @@ int main(int argCount, const char* argv[]) if (!strcmp(argument, "--no-dictID")) { FIO_setDictIDFlag(0); continue; } if (!strcmp(argument, "--keep")) { FIO_setRemoveSrcFile(0); continue; } if (!strcmp(argument, "--rm")) { FIO_setRemoveSrcFile(1); continue; } + if (!strcmp(argument, "--rt-prio")) { setRealTimePrio = 1; continue; } /* long commands with arguments */ #ifndef ZSTD_NODICT @@ -574,7 +576,7 @@ int main(int argCount, const char* argv[]) BMK_setBlockSize(blockSize); BMK_setNbThreads(nbThreads); BMK_setNbSeconds(bench_nbSeconds); - BMK_benchFiles(filenameTable, filenameIdx, dictFileName, cLevel, cLevelLast, &compressionParams); + BMK_benchFiles(filenameTable, filenameIdx, dictFileName, cLevel, cLevelLast, &compressionParams, setRealTimePrio); #endif (void)bench_nbSeconds; goto _end; From 0665a359aa95ccc5386a1bb7cad42909fc2cca86 Mon Sep 17 00:00:00 2001 From: Przemyslaw Skibinski Date: Tue, 7 Feb 2017 20:12:59 +0100 Subject: [PATCH 04/14] "--rt-prio" renamed to "--priority=rt" --- programs/zstdcli.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/programs/zstdcli.c b/programs/zstdcli.c index 30391eb0e..604e4c5f2 100644 --- a/programs/zstdcli.c +++ b/programs/zstdcli.c @@ -357,7 +357,7 @@ int main(int argCount, const char* argv[]) if (!strcmp(argument, "--no-dictID")) { FIO_setDictIDFlag(0); continue; } if (!strcmp(argument, "--keep")) { FIO_setRemoveSrcFile(0); continue; } if (!strcmp(argument, "--rm")) { FIO_setRemoveSrcFile(1); continue; } - if (!strcmp(argument, "--rt-prio")) { setRealTimePrio = 1; continue; } + if (!strcmp(argument, "--priority=rt")) { setRealTimePrio = 1; continue; } /* long commands with arguments */ #ifndef ZSTD_NODICT From 40580ff669a4e5bb4d681973fb61281b2ac2d140 Mon Sep 17 00:00:00 2001 From: Przemyslaw Skibinski Date: Wed, 8 Feb 2017 13:49:06 +0100 Subject: [PATCH 05/14] added description of "--priority=rt" --- programs/zstd.1 | 3 ++- programs/zstdcli.c | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/programs/zstd.1 b/programs/zstd.1 index 384f69e3a..684fb868a 100644 --- a/programs/zstd.1 +++ b/programs/zstd.1 @@ -289,7 +289,8 @@ and weight typically 100x the target dictionary size (for example, 10 MB for a 1 .TP .B \-B# cut file into independent blocks of size # (default: no block) - +.B \--priority=rt + set process priority to real-time .SH ADVANCED COMPRESSION OPTIONS .TP diff --git a/programs/zstdcli.c b/programs/zstdcli.c index 604e4c5f2..a7dbda313 100644 --- a/programs/zstdcli.c +++ b/programs/zstdcli.c @@ -148,6 +148,7 @@ static int usage_advanced(const char* programName) DISPLAY( " -e# : test all compression levels from -bX to # (default: 1)\n"); DISPLAY( " -i# : minimum evaluation time in seconds (default : 3s)\n"); DISPLAY( " -B# : cut file into independent blocks of size # (default: no block)\n"); + DISPLAY( "--priority=rt : set process priority to real-time\n"); #endif return 0; } From 4b4f8c2d71ddd22df117b1330495acaa1100d95d Mon Sep 17 00:00:00 2001 From: Przemyslaw Skibinski Date: Wed, 8 Feb 2017 13:58:04 +0100 Subject: [PATCH 06/14] turn off test-pool for qemu-ppc64-static --- tests/Makefile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/Makefile b/tests/Makefile index f49d23018..07069d3ac 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -225,7 +225,10 @@ zstd-playTests: datagen file $(ZSTD) ZSTD="$(QEMU_SYS) $(ZSTD)" ./playTests.sh $(ZSTDRTTEST) -test: test-zstd test-fullbench test-fuzzer test-zstream test-longmatch test-invalidDictionaries test-pool +test: test-zstd test-fullbench test-fuzzer test-zstream test-longmatch test-invalidDictionaries +ifneq ($(QEMU_SYS),qemu-ppc64-static) +test: test-pool +endif test32: test-zstd32 test-fullbench32 test-fuzzer32 test-zstream32 From ca20edd96024e71011f83e526d831028c877e30f Mon Sep 17 00:00:00 2001 From: Przemyslaw Skibinski Date: Wed, 8 Feb 2017 14:32:49 +0100 Subject: [PATCH 07/14] fixed zlib detection with MinGW --- programs/Makefile | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/programs/Makefile b/programs/Makefile index ae798c2a6..b189224f3 100644 --- a/programs/Makefile +++ b/programs/Makefile @@ -67,7 +67,10 @@ endif # zlib detection VOID = /dev/null -HAVE_ZLIB := $(shell echo "\#include \nint main(){}" | $(CC) -o $(VOID) -x c - -lz 2> $(VOID) && echo 1 || echo 0) +HAVE_ZLIB := $(shell echo -e "\#include \nint main(){}" | $(CC) -o have_zlib -x c - -lz 2> $(VOID) && echo 1 || echo 0) +ifeq ($(HAVE_ZLIB), 1) +TEMP := $(shell rm have_zlib$(EXT)) +endif ifeq ($(HAVE_ZLIB), 1) ZLIBCPP = -DZSTD_GZDECOMPRESS ZLIBLD = -lz @@ -152,7 +155,7 @@ clean: @$(RM) $(ZSTDDIR)/decompress/*.o $(ZSTDDIR)/decompress/zstd_decompress.gcda @$(RM) core *.o tmp* result* *.gcda dictionary *.zst \ zstd$(EXT) zstd32$(EXT) zstd-compress$(EXT) zstd-decompress$(EXT) \ - *.gcda default.profraw have_zlib + *.gcda default.profraw have_zlib$(EXT) @echo Cleaning completed clean_decomp_o: From 93901fe85ca3eb342dfbbbc6c4778c5f653a438c Mon Sep 17 00:00:00 2001 From: Przemyslaw Skibinski Date: Wed, 8 Feb 2017 21:11:18 +0100 Subject: [PATCH 08/14] remove redundant "ifeq ($(HAVE_ZLIB), 1)" --- programs/Makefile | 2 -- 1 file changed, 2 deletions(-) diff --git a/programs/Makefile b/programs/Makefile index b189224f3..8257e394e 100644 --- a/programs/Makefile +++ b/programs/Makefile @@ -70,8 +70,6 @@ VOID = /dev/null HAVE_ZLIB := $(shell echo -e "\#include \nint main(){}" | $(CC) -o have_zlib -x c - -lz 2> $(VOID) && echo 1 || echo 0) ifeq ($(HAVE_ZLIB), 1) TEMP := $(shell rm have_zlib$(EXT)) -endif -ifeq ($(HAVE_ZLIB), 1) ZLIBCPP = -DZSTD_GZDECOMPRESS ZLIBLD = -lz endif From a0f9006e5a8c844a9d36d85307d3ad5d5b24ed78 Mon Sep 17 00:00:00 2001 From: Nick Terrell Date: Wed, 8 Feb 2017 17:25:01 -0800 Subject: [PATCH 09/14] #undef _POSIX_C_SOURCE if already defined --- programs/platform.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/programs/platform.h b/programs/platform.h index f30528aa9..b54b94d75 100644 --- a/programs/platform.h +++ b/programs/platform.h @@ -1,6 +1,6 @@ /** * platform.h - compiler and OS detection - * + * * Copyright (c) 2016-present, Przemyslaw Skibinski, Yann Collet, Facebook, Inc. * All rights reserved. * @@ -23,7 +23,7 @@ extern "C" { ****************************************/ #if defined(_MSC_VER) # define _CRT_SECURE_NO_WARNINGS /* Disable Visual Studio warning messages for fopen, strncpy, strerror */ -# define _CRT_SECURE_NO_DEPRECATE /* VS2005 - must be declared before and */ +# define _CRT_SECURE_NO_DEPRECATE /* VS2005 - must be declared before and */ # if (_MSC_VER <= 1800) /* (1800 = Visual Studio 2013) */ # define snprintf sprintf_s /* snprintf unsupported by Visual <= 2013 */ # endif @@ -52,7 +52,7 @@ extern "C" { * Turn on Large Files support (>4GB) for 32-bit Linux/Unix ***********************************************************/ #if !defined(__64BIT__) /* No point defining Large file for 64 bit */ -# 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 */ # endif # if !defined(_LARGEFILE_SOURCE) /* obsolete macro, replaced with _FILE_OFFSET_BITS */ @@ -77,6 +77,9 @@ extern "C" { # define PLATFORM_POSIX_VERSION 200112L # else # if defined(__linux__) || defined(__linux) +# ifdef _POSIX_C_SOURCE +# undef _POSIX_C_SOURCE +# endif # define _POSIX_C_SOURCE 200112L /* use feature test macro */ # endif # include /* declares _POSIX_VERSION */ From e0b3265e87e30b57d5bf8c6c5acbab20c44d9f67 Mon Sep 17 00:00:00 2001 From: Sean Purcell Date: Wed, 8 Feb 2017 15:31:47 -0800 Subject: [PATCH 10/14] Fix ZSTD_getErrorString and add tests --- lib/common/zstd_common.c | 2 +- tests/fuzzer.c | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/common/zstd_common.c b/lib/common/zstd_common.c index 749b2870c..8408a589a 100644 --- a/lib/common/zstd_common.c +++ b/lib/common/zstd_common.c @@ -41,7 +41,7 @@ ZSTD_ErrorCode ZSTD_getErrorCode(size_t code) { return ERR_getErrorCode(code); } /*! ZSTD_getErrorString() : * provides error code string from enum */ -const char* ZSTD_getErrorString(ZSTD_ErrorCode code) { return ERR_getErrorName(code); } +const char* ZSTD_getErrorString(ZSTD_ErrorCode code) { return ERR_getErrorString(code); } /*=************************************************************** diff --git a/tests/fuzzer.c b/tests/fuzzer.c index 60546c07a..84d2c0237 100644 --- a/tests/fuzzer.c +++ b/tests/fuzzer.c @@ -505,6 +505,16 @@ static int basicUnitTests(U32 seed, double compressibility) if (r != _3BYTESTESTLENGTH) goto _output_error; } DISPLAYLEVEL(4, "OK \n"); + /* error string tests */ + DISPLAYLEVEL(4, "test%3i : testing ZSTD error code strings : ", testNb++); + if (strcmp("No error detected", ZSTD_getErrorName((ZSTD_ErrorCode)(0-ZSTD_error_no_error))) != 0) goto _output_error; + if (strcmp("No error detected", ZSTD_getErrorString(ZSTD_error_no_error)) != 0) goto _output_error; + if (strcmp("Unspecified error code", ZSTD_getErrorString((ZSTD_ErrorCode)(0-ZSTD_error_GENERIC))) != 0) goto _output_error; + if (strcmp("Error (generic)", ZSTD_getErrorName((size_t)0-ZSTD_error_GENERIC)) != 0) goto _output_error; + if (strcmp("Error (generic)", ZSTD_getErrorString(ZSTD_error_GENERIC)) != 0) goto _output_error; + if (strcmp("No error detected", ZSTD_getErrorName(ZSTD_error_GENERIC)) != 0) goto _output_error; + DISPLAYLEVEL(4, "OK \n"); + _end: free(CNBuffer); free(compressedBuffer); From 545987996a198c090fd7d1e591157505a5b02b41 Mon Sep 17 00:00:00 2001 From: Nick Terrell Date: Wed, 8 Feb 2017 17:38:17 -0800 Subject: [PATCH 11/14] Fix deprecation warnings for clang with C++14 --- lib/deprecated/zbuff.h | 4 +++- lib/dictBuilder/zdict.h | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/deprecated/zbuff.h b/lib/deprecated/zbuff.h index 85f973557..f62091976 100644 --- a/lib/deprecated/zbuff.h +++ b/lib/deprecated/zbuff.h @@ -42,7 +42,9 @@ extern "C" { #ifdef ZBUFF_DISABLE_DEPRECATE_WARNINGS # define ZBUFF_DEPRECATED(message) ZSTDLIB_API /* disable deprecation warnings */ #else -# if (defined(__GNUC__) && (__GNUC__ >= 5)) || defined(__clang__) +# if defined (__cplusplus) && (__cplusplus >= 201402) /* C++14 or greater */ +# define ZBUFF_DEPRECATED(message) [[deprecated(message)]] ZSTDLIB_API +# elif (defined(__GNUC__) && (__GNUC__ >= 5)) || defined(__clang__) # define ZBUFF_DEPRECATED(message) ZSTDLIB_API __attribute__((deprecated(message))) # elif defined(__GNUC__) && (__GNUC__ >= 3) # define ZBUFF_DEPRECATED(message) ZSTDLIB_API __attribute__((deprecated)) diff --git a/lib/dictBuilder/zdict.h b/lib/dictBuilder/zdict.h index 4d0a62a2c..4ead4474f 100644 --- a/lib/dictBuilder/zdict.h +++ b/lib/dictBuilder/zdict.h @@ -174,7 +174,7 @@ ZDICTLIB_API size_t ZDICT_finalizeDictionary(void* dictBuffer, size_t dictBuffer #else # define ZDICT_GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__) # if defined (__cplusplus) && (__cplusplus >= 201402) /* C++14 or greater */ -# define ZDICT_DEPRECATED(message) ZDICTLIB_API [[deprecated(message)]] +# define ZDICT_DEPRECATED(message) [[deprecated(message)]] ZDICTLIB_API # elif (ZDICT_GCC_VERSION >= 405) || defined(__clang__) # define ZDICT_DEPRECATED(message) ZDICTLIB_API __attribute__((deprecated(message))) # elif (ZDICT_GCC_VERSION >= 301) From 13127fd05b7ce947b57a0175c54a1b1c7353916f Mon Sep 17 00:00:00 2001 From: Przemyslaw Skibinski Date: Thu, 9 Feb 2017 11:32:14 +0100 Subject: [PATCH 12/14] don't use "echo -e" --- programs/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/programs/Makefile b/programs/Makefile index 8257e394e..a7de2e1af 100644 --- a/programs/Makefile +++ b/programs/Makefile @@ -67,7 +67,7 @@ endif # zlib detection VOID = /dev/null -HAVE_ZLIB := $(shell echo -e "\#include \nint main(){}" | $(CC) -o have_zlib -x c - -lz 2> $(VOID) && echo 1 || echo 0) +HAVE_ZLIB := $(shell echo $$'\#include \nint main(){}' | $(CC) -o have_zlib -x c - -lz 2> $(VOID) && echo 1 || echo 0) ifeq ($(HAVE_ZLIB), 1) TEMP := $(shell rm have_zlib$(EXT)) ZLIBCPP = -DZSTD_GZDECOMPRESS From 896638a8a296674cac145aff51b6dc7f724c4b94 Mon Sep 17 00:00:00 2001 From: Przemyslaw Skibinski Date: Thu, 9 Feb 2017 17:01:17 +0100 Subject: [PATCH 13/14] echo replaced with printf --- programs/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/programs/Makefile b/programs/Makefile index a7de2e1af..862ba35dd 100644 --- a/programs/Makefile +++ b/programs/Makefile @@ -67,7 +67,7 @@ endif # zlib detection VOID = /dev/null -HAVE_ZLIB := $(shell echo $$'\#include \nint main(){}' | $(CC) -o have_zlib -x c - -lz 2> $(VOID) && echo 1 || echo 0) +HAVE_ZLIB := $(shell printf '\#include \nint main(){}' | $(CC) -o have_zlib -x c - -lz 2> $(VOID) && echo 1 || echo 0) ifeq ($(HAVE_ZLIB), 1) TEMP := $(shell rm have_zlib$(EXT)) ZLIBCPP = -DZSTD_GZDECOMPRESS From d08019813be545a66de0afa8718261df44efd7dc Mon Sep 17 00:00:00 2001 From: Nick Terrell Date: Thu, 9 Feb 2017 14:20:52 -0800 Subject: [PATCH 14/14] Improvement from @inikep --- programs/platform.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/programs/platform.h b/programs/platform.h index b54b94d75..def8945bd 100644 --- a/programs/platform.h +++ b/programs/platform.h @@ -77,10 +77,9 @@ extern "C" { # define PLATFORM_POSIX_VERSION 200112L # else # if defined(__linux__) || defined(__linux) -# ifdef _POSIX_C_SOURCE -# undef _POSIX_C_SOURCE +# ifndef _POSIX_C_SOURCE +# define _POSIX_C_SOURCE 200112L /* use feature test macro */ # endif -# define _POSIX_C_SOURCE 200112L /* use feature test macro */ # endif # include /* declares _POSIX_VERSION */ # if defined(_POSIX_VERSION) /* POSIX compliant */