]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
platform.h: removed Compiler Options
authorPrzemyslaw Skibinski <inikep@gmail.com>
Wed, 21 Dec 2016 12:23:34 +0000 (13:23 +0100)
committerPrzemyslaw Skibinski <inikep@gmail.com>
Wed, 21 Dec 2016 12:23:34 +0000 (13:23 +0100)
15 files changed:
lib/common/mem.h
programs/bench.c
programs/datagen.c
programs/dibio.c
programs/fileio.c
programs/platform.h
programs/util.h
programs/zstdcli.c
tests/datagencli.c
tests/fullbench.c
tests/fuzzer.c
tests/paramgrill.c
tests/zbufftest.c
tests/zstreamtest.c
zlibWrapper/examples/zwrapbench.c

index fb73ef0938578df7d7e4d4b873587fb1dd5b7c66..32c63dd1763c17819eae402fe9691b7bfe383d05 100644 (file)
@@ -46,8 +46,6 @@ MEM_STATIC void MEM_check(void) { MEM_STATIC_ASSERT((sizeof(size_t)==4) || (size
 /*-**************************************************************
 *  Basic Types
 *****************************************************************/
-#ifndef BASIC_TYPES_DEFINED
-#define BASIC_TYPES_DEFINED
 #if  !defined (__VMS) && (defined (__cplusplus) || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */) )
 # include <stdint.h>
   typedef  uint8_t BYTE;
@@ -68,7 +66,6 @@ MEM_STATIC void MEM_check(void) { MEM_STATIC_ASSERT((sizeof(size_t)==4) || (size
   typedef   signed long long  S64;
   typedef ptrdiff_t      iPtrDiff;
 #endif
-#endif
 
 
 /*-**************************************************************
index 2b7436a4f3b204c2dc1ad574f98528111df8f367..9b7f98884c8bf455d1f3b2c92ff7de71e87fbee3 100644 (file)
@@ -8,16 +8,27 @@
  */
 
 
+
+/* **************************************
+*  Compiler Warnings
+****************************************/
+#ifdef _MSC_VER
+#  define _CRT_SECURE_NO_WARNINGS                /* fopen */
+#  pragma warning(disable : 4127)                /* disable: C4127: conditional expression is constant */
+#endif
+
+
 /* *************************************
 *  Includes
 ***************************************/
-#include "platform.h"    /* Compiler options */
-#include "util.h"        /* UTIL_GetFileSize, UTIL_sleep */
+#include "platform.h"    /* Large Files support */
+#include "util.h"        /* UTIL_getFileSize, UTIL_sleep */
 #include <stdlib.h>      /* malloc, free */
 #include <string.h>      /* memset */
 #include <stdio.h>       /* fprintf, fopen, ftello64 */
 #include <time.h>        /* clock_t, clock, CLOCKS_PER_SEC */
 
+#include "mem.h"
 #define ZSTD_STATIC_LINKING_ONLY
 #include "zstd.h"
 #include "datagen.h"     /* RDG_genBuffer */
index 8209c851771df7dc8cfda6afa4400c0e2a1d8ae1..06b5ab97778bf01045245759dd93f1bdde2dda10 100644 (file)
@@ -9,14 +9,22 @@
 
 
 
+/* *************************************
+*  Compiler Options
+***************************************/
+#if defined(_MSC_VER)
+#  define _CRT_SECURE_NO_WARNINGS    /* removes Visual warning on strerror() */
+#  define _CRT_SECURE_NO_DEPRECATE   /* removes VS2005 warning on strerror() */
+#endif
+
 /*-************************************
 *  Dependencies
 **************************************/
-#include "platform.h"  /* Compiler options */
-#include "util.h"      /* U32 */
+#include "platform.h"  /* SET_BINARY_MODE */
 #include <stdlib.h>    /* malloc, free */
 #include <stdio.h>     /* FILE, fwrite, fprintf */
 #include <string.h>    /* memcpy */
+#include "mem.h"       /* U32 */
 
 
 /*-************************************
index 1c22949f1988a1962b7945e8eb57a214e115d87a..b99e717c235f74bd1ff028220441c97d12207abc 100644 (file)
@@ -9,17 +9,27 @@
 
 
 
+/* **************************************
+*  Compiler Warnings
+****************************************/
+#ifdef _MSC_VER
+#  define _CRT_SECURE_NO_WARNINGS                /* fopen */
+#  pragma warning(disable : 4127)                /* disable: C4127: conditional expression is constant */
+#endif
+
+
 /*-*************************************
 *  Includes
 ***************************************/
-#include "platform.h"       /* Compiler options */
-#include "util.h"           /* UTIL_GetFileSize, UTIL_getTotalFileSize */
+#include "platform.h"       /* Large Files support */
+#include "util.h"           /* UTIL_getFileSize, UTIL_getTotalFileSize */
 #include <stdlib.h>         /* malloc, free */
 #include <string.h>         /* memset */
 #include <stdio.h>          /* fprintf, fopen, ftello64 */
 #include <time.h>           /* clock_t, clock, CLOCKS_PER_SEC */
 #include <errno.h>          /* errno */
 
+#include "mem.h"            /* read */
 #include "error_private.h"
 #include "dibio.h"
 
index fa52f9aff9423d9bc336cde2e5b756d5e97cb2df..e2a90a6784664e608e3550407edb333c6d047667 100644 (file)
 *  Compiler Options
 ***************************************/
 #ifdef _MSC_VER   /* Visual */
+#  define _CRT_SECURE_NO_WARNINGS  /* removes Visual warning on strerror() */
 #  pragma warning(disable : 4204)  /* non-constant aggregate initializer */
 #endif
+#if defined(__MINGW32__) && !defined(_POSIX_SOURCE)
+#  define _POSIX_SOURCE 1          /* disable %llu warnings with MinGW on Windows */
+#endif
 
 
 /*-*************************************
 *  Includes
 ***************************************/
-#include "platform.h"   /* Compiler options */
-#include "util.h"       /* UTIL_GetFileSize, _LARGEFILE64_SOURCE */
+#include "platform.h"   /* Large Files support, SET_BINARY_MODE */
+#include "util.h"       /* UTIL_getFileSize */
 #include <stdio.h>      /* fprintf, fopen, fread, _fileno, stdin, stdout */
 #include <stdlib.h>     /* malloc, free */
 #include <string.h>     /* strcmp, strlen */
 #include <time.h>       /* clock */
 #include <errno.h>      /* errno */
 
+#include "mem.h"
 #include "fileio.h"
 #define ZSTD_STATIC_LINKING_ONLY   /* ZSTD_magicNumber, ZSTD_frameHeaderSize_max */
 #include "zstd.h"
index fe4bfded66a3e5c31b7d941b979a1c727372c695..0b82e46bfb84fb5c112b6e0121491c7da7f148d1 100644 (file)
@@ -25,25 +25,6 @@ extern "C" {
 #endif
 
 
-/* **************************************
-*  Compiler Options
-****************************************/
-#if defined(__INTEL_COMPILER)
-#  pragma warning(disable : 177)    /* disable: message #177: function was declared but never referenced */
-#endif
-#if defined(_MSC_VER)
-#  define _CRT_SECURE_NO_WARNINGS   /* Disable some Visual warning messages for fopen, strncpy */
-#  define _CRT_SECURE_NO_DEPRECATE  /* VS2005 */
-#  pragma warning(disable : 4127)   /* disable: C4127: conditional expression is constant */
-#  if (_MSC_VER <= 1800)            /* (1800 = Visual Studio 2013) */
-#    define snprintf sprintf_s      /* snprintf unsupported by Visual <= 2013 */
-#  endif
-#endif
-#if defined(__MINGW32__) && !defined(_POSIX_SOURCE)
-#  define _POSIX_C_SOURCE 1          /* enable __VA_ARGS__ and disable %llu warnings with MinGW on Windows */
-#endif
-
-
 /* **************************************
 *  Detect 64-bit OS
 *  http://nadeausoftware.com/articles/2012/02/c_c_tip_how_detect_processor_type_using_compiler_predefined_macros
@@ -110,6 +91,7 @@ extern "C" {
 *  Detect if isatty() and fileno() are available
 ************************************************/
 #if (defined(__linux__) && (PLATFORM_POSIX_VERSION >= 1)) || (PLATFORM_POSIX_VERSION >= 200112L) || defined(__DJGPP__)
+#  include <unistd.h>   /* isatty */
 #  define IS_CONSOLE(stdStream) isatty(fileno(stdStream))
 #elif defined(MSDOS) || defined(OS2) || defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__)
 #  include <io.h>       /* _isatty */
index 409f6d7c1cb6dcbecd639082dc3402e9282952d3..8b480b2261bd62ab4cbb47b036fa41e3f9c56e8e 100644 (file)
@@ -25,24 +25,35 @@ extern "C" {
 #endif
 
 
+/* **************************************
+*  Compiler Options
+****************************************/
+#if defined(_MSC_VER)
+#  if (_MSC_VER <= 1800)            /* (1800 = Visual Studio 2013) */
+#    define snprintf sprintf_s      /* snprintf unsupported by Visual <= 2013 */
+#  endif
+#endif
+
+
 /*-****************************************
 *  Dependencies
 ******************************************/
-#include "platform.h"   /* Compiler options, PLATFORM_POSIX_VERSION */
-#include <stdlib.h>     /* malloc */
-#include <stddef.h>     /* size_t, ptrdiff_t */
-#include <stdio.h>      /* fprintf */
-#include <sys/types.h>  /* stat, utime */
-#include <sys/stat.h>   /* stat */
+#include "platform.h"     /* PLATFORM_POSIX_VERSION */
+#include <stdlib.h>       /* malloc */
+#include <stddef.h>       /* size_t, ptrdiff_t */
+#include <stdio.h>        /* fprintf */
+#include <sys/types.h>    /* stat, utime */
+#include <sys/stat.h>     /* stat */
 #if defined(_MSC_VER)
-#  include <sys/utime.h>   /* utime */
-#  include <io.h>          /* _chmod */
+#  include <sys/utime.h>  /* utime */
+#  include <io.h>         /* _chmod */
 #else
 #  include <unistd.h>     /* chown, stat */
 #  include <utime.h>      /* utime */
 #endif
-#include <time.h>       /* time */
+#include <time.h>         /* time */
 #include <errno.h>
+#include "mem.h"          /* U32, U64 */
 
 
 /*-****************************************
@@ -81,35 +92,12 @@ extern "C" {
 #define LIST_SIZE_INCREASE   (8*1024)
 
 
-/*-**************************************************************
-*  Basic Types
-*****************************************************************/
-#ifndef BASIC_TYPES_DEFINED
-#define BASIC_TYPES_DEFINED
-#if !defined (__VMS) && (defined (__cplusplus) || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */) )
-# include <stdint.h>
-  typedef  uint8_t BYTE;
-  typedef uint16_t U16;
-  typedef  int16_t S16;
-  typedef uint32_t U32;
-  typedef  int32_t S32;
-  typedef uint64_t U64;
-  typedef  int64_t S64;
-#else
-  typedef unsigned char       BYTE;
-  typedef unsigned short      U16;
-  typedef   signed short      S16;
-  typedef unsigned int        U32;
-  typedef   signed int        S32;
-  typedef unsigned long long  U64;
-  typedef   signed long long  S64;
-#endif
-#endif
-
-
 /*-****************************************
 *  Compiler specifics
 ******************************************/
+#if defined(__INTEL_COMPILER)
+#  pragma warning(disable : 177)    /* disable: message #177: function was declared but never referenced, useful with UTIL_STATIC */
+#endif
 #if defined(__GNUC__)
 #  define UTIL_STATIC static __attribute__((unused))
 #elif defined (__cplusplus) || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */)
index 29fcb746bde98b982b79fcc9cfe7949f55e69613..978ffcfe08cacce3a81886289030b5bd7d584145 100644 (file)
@@ -23,7 +23,7 @@
 /*-************************************
 *  Dependencies
 **************************************/
-#include "platform.h" /* Compiler options, PLATFORM_POSIX_VERSION */
+#include "platform.h" /* IS_CONSOLE, PLATFORM_POSIX_VERSION */
 #include "util.h"     /* UTIL_HAS_CREATEFILELIST, UTIL_createFileList */
 #include <string.h>   /* strcmp, strlen */
 #include <errno.h>    /* errno */
index c4bf489344ec5ab45f112a9af64658ca005a18dd..2f3ebc4d6863f29eb2de77a41d4fab6fc6a746d6 100644 (file)
@@ -11,8 +11,7 @@
 /*-************************************
 *  Dependencies
 **************************************/
-#include "platform.h"  /* Compiler options */
-#include "util.h"      /* U32 */
+#include "util.h"      /* Compiler options */
 #include <stdio.h>     /* fprintf, stderr */
 #include "datagen.h"   /* RDG_generate */
 
index 439de5c7699d6ada743cac8b17a7053c82e8a118..233b4e931e4f479efdd432053fa2b78180c1ca60 100644 (file)
 /*_************************************
 *  Includes
 **************************************/
-#include "platform.h"    /* Compiler options */
-#include "util.h"        /* U32 */
+#include "util.h"        /* Compiler options, UTIL_GetFileSize */
 #include <stdlib.h>      /* malloc */
 #include <stdio.h>       /* fprintf, fopen, ftello64 */
 #include <time.h>        /* clock_t, clock, CLOCKS_PER_SEC */
 
+#include "mem.h"
 #ifndef ZSTD_DLL_IMPORT
     #include "zstd_internal.h"   /* ZSTD_blockHeaderSize, blockType_e, KB, MB */
     #define ZSTD_STATIC_LINKING_ONLY  /* ZSTD_compressBegin, ZSTD_compressContinue, etc. */
index 9088e24832cd058a8de82f0cace22413e35b0758..86d4c6bebb359f04b8e45a4978fc7d248d3c8952 100644 (file)
@@ -12,6 +12,8 @@
 *  Compiler specific
 **************************************/
 #ifdef _MSC_VER    /* Visual Studio */
+#  define _CRT_SECURE_NO_WARNINGS     /* fgets */
+#  pragma warning(disable : 4127)     /* disable: C4127: conditional expression is constant */
 #  pragma warning(disable : 4204)     /* disable: C4204: non-constant aggregate initializer */
 #endif
 
@@ -19,8 +21,6 @@
 /*-************************************
 *  Includes
 **************************************/
-#include "platform.h"     /* Compiler options */
-#include "util.h"         /* U32 */
 #include <stdlib.h>       /* free */
 #include <stdio.h>        /* fgets, sscanf */
 #include <string.h>       /* strcmp */
@@ -30,6 +30,7 @@
 #include "zstd_errors.h"  /* ZSTD_getErrorCode */
 #include "zdict.h"        /* ZDICT_trainFromBuffer */
 #include "datagen.h"      /* RDG_genBuffer */
+#include "mem.h"
 #define XXH_STATIC_LINKING_ONLY
 #include "xxhash.h"       /* XXH64 */
 
index 0825b37a6a55eb18e739597b7c9e3ffdd4f4425c..5eabcba2b60b44ae9f901fda594c436e647da96b 100644 (file)
 /*-************************************
 *  Dependencies
 **************************************/
-#include "platform.h"  /* Compiler options */
-#include "util.h"      /* UTIL_getFileSize */
+#include "util.h"      /* Compiler options, UTIL_GetFileSize */
 #include <stdlib.h>    /* malloc */
 #include <stdio.h>     /* fprintf, fopen, ftello64 */
 #include <string.h>    /* strcmp */
 #include <math.h>      /* log */
 #include <time.h>      /* clock_t */
 
-#include "mem.h"       /* MEM_32bits() */
+#include "mem.h"
 #define ZSTD_STATIC_LINKING_ONLY   /* ZSTD_parameters, ZSTD_estimateCCtxSize */
 #include "zstd.h"
 #include "datagen.h"
index 87cf80b5e729d57b5aded460d19044cfaabcc149..14b73923311d1bf64753de28024cbed7d19031bd 100644 (file)
@@ -12,6 +12,8 @@
 *  Compiler specific
 **************************************/
 #ifdef _MSC_VER    /* Visual Studio */
+#  define _CRT_SECURE_NO_WARNINGS     /* fgets */
+#  pragma warning(disable : 4127)     /* disable: C4127: conditional expression is constant */
 #  pragma warning(disable : 4146)     /* disable: C4146: minus unsigned expression */
 #endif
 
 /*-************************************
 *  Includes
 **************************************/
-#include "platform.h"     /* Compiler options */
 #include <stdlib.h>       /* free */
 #include <stdio.h>        /* fgets, sscanf */
 #include <time.h>         /* clock_t, clock() */
 #include <string.h>       /* strcmp */
-#include "mem.h"          /* MEM_writeLE32 */
+#include "mem.h"
 #define ZSTD_STATIC_LINKING_ONLY   /* ZSTD_maxCLevel */
 #include "zstd.h"         /* ZSTD_compressBound */
 #define ZBUFF_STATIC_LINKING_ONLY  /* ZBUFF_createCCtx_advanced */
index 9da0010bebfb031f359993b211231ed8c6846487..ce619308572cc40af5410b430fa5978691f2ab58 100644 (file)
@@ -12,6 +12,8 @@
 *  Compiler specific
 **************************************/
 #ifdef _MSC_VER    /* Visual Studio */
+#  define _CRT_SECURE_NO_WARNINGS     /* fgets */
+#  pragma warning(disable : 4127)     /* disable: C4127: conditional expression is constant */
 #  pragma warning(disable : 4146)     /* disable: C4146: minus unsigned expression */
 #endif
 
 /*-************************************
 *  Includes
 **************************************/
-#include "platform.h"     /* Compiler options */
 #include <stdlib.h>       /* free */
 #include <stdio.h>        /* fgets, sscanf */
 #include <time.h>         /* clock_t, clock() */
 #include <string.h>       /* strcmp */
-#include "mem.h"          /* MEM_writeLE32 */
+#include "mem.h"
 #define ZSTD_STATIC_LINKING_ONLY   /* ZSTD_maxCLevel, ZSTD_customMem */
 #include "zstd.h"         /* ZSTD_compressBound */
 #include "zstd_errors.h"  /* ZSTD_error_srcSize_wrong */
index 8999657fa58156a71efad4245059c2b513d66072..e0aca00157a0d01328d638d372ad213fa76606da 100644 (file)
 /* *************************************
 *  Includes
 ***************************************/
-#include "platform.h"    /* Compiler options */
-#include "util.h"        /* U32, UTIL_GetFileSize, UTIL_sleep */
+#include "util.h"        /* Compiler options, UTIL_GetFileSize, UTIL_sleep */
 #include <stdlib.h>      /* malloc, free */
 #include <string.h>      /* memset */
 #include <stdio.h>       /* fprintf, fopen, ftello64 */
 #include <time.h>        /* clock_t, clock, CLOCKS_PER_SEC */
 #include <ctype.h>       /* toupper */
 
+#include "mem.h"
 #define ZSTD_STATIC_LINKING_ONLY
 #include "zstd.h"
 #include "datagen.h"     /* RDG_genBuffer */