]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
[lib][tracing] Add ZSTD_NO_TRACE macro
authorNick Terrell <terrelln@fb.com>
Mon, 15 Mar 2021 21:46:26 +0000 (14:46 -0700)
committerNick Terrell <terrelln@fb.com>
Tue, 16 Mar 2021 18:47:27 +0000 (11:47 -0700)
When defined, it disables tracing, and avoids including the header.

contrib/freestanding_lib/freestanding.py
contrib/linux-kernel/Makefile
lib/common/zstd_internal.h
lib/compress/zstd_compress.c
lib/compress/zstd_compress_internal.h
lib/decompress/zstd_decompress.c
lib/decompress/zstd_decompress_internal.h

index ca3f0ac8be7f775e9398adbfa97a5c16e2f71677..a5bcf100f721970dc48c0b0a2b5ca75db28ce875 100755 (executable)
@@ -28,6 +28,7 @@ SKIPPED_FILES = [
     "common/threading.c",
     "common/threading.h",
     "common/zstd_trace.c",
+    "common/zstd_trace.h",
     "compress/zstdmt_compress.h",
     "compress/zstdmt_compress.c",
 ]
@@ -658,7 +659,8 @@ def main(name, args):
             raise RuntimeError(f"{name} is both defined and undefined!")
 
     # Always set tracing to 0
-    if "ZSTD_TRACE" not in (arg[0] for arg in args.defs):
+    if "ZSTD_NO_TRACE" not in (arg[0] for arg in args.defs):
+        args.defs.append(("ZSTD_NO_TRACE", None))
         args.defs.append(("ZSTD_TRACE", "0"))
 
     args.replaces = parse_pair(args.replaces)
index 1cbe3435f483dc0b237120f3a566c9476db59a13..0fefc2bf20dc574a2938ad8c7fa5e2fe8f814391 100644 (file)
@@ -49,7 +49,8 @@ libzstd:
                -RZSTDLIB_VISIBILITY= \
                -RZSTDERRORLIB_VISIBILITY= \
                -DZSTD_HAVE_WEAK_SYMBOLS=0 \
-               -DZSTD_TRACE=0
+               -DZSTD_TRACE=0 \
+               -DZSTD_NO_TRACE
        mv linux/lib/zstd/zstd.h linux/include/linux/zstd_lib.h
        mv linux/lib/zstd/common/zstd_errors.h linux/include/linux/
        cp linux_zstd.h linux/include/linux/zstd.h
index 53a982c7341dd85bfd0d11666b9ef02e7792c8b5..1d1c91ffd8fd5a09b392c4129e024333494e30b8 100644 (file)
 #  define XXH_STATIC_LINKING_ONLY  /* XXH64_state_t */
 #endif
 #include "xxhash.h"                /* XXH_reset, update, digest */
+#ifndef ZSTD_NO_TRACE
+#  include "zstd_trace.h"
+#else
+#  define ZSTD_TRACE 0
+#endif
 
 #if defined (__cplusplus)
 extern "C" {
@@ -365,7 +370,7 @@ typedef struct {
 
     /* longLengthPos and longLengthID to allow us to represent either a single litLength or matchLength
      * in the seqStore that has a value larger than U16 (if it exists). To do so, we increment
-     * the existing value of the litLength or matchLength by 0x10000. 
+     * the existing value of the litLength or matchLength by 0x10000.
      */
     U32   longLengthID;   /* 0 == no longLength; 1 == Represent the long literal; 2 == Represent the long match; */
     U32   longLengthPos;  /* Index of the sequence to apply long length modification to */
index 93c4075c521eff275788bfed8452b38a8529db29..5973497127cade98ea6f15cc649d16a33a10ff44 100644 (file)
@@ -14,7 +14,6 @@
 #include "../common/zstd_deps.h"  /* INT_MAX, ZSTD_memset, ZSTD_memcpy */
 #include "../common/cpu.h"
 #include "../common/mem.h"
-#include "../common/zstd_trace.h"
 #include "hist.h"           /* HIST_countFast_wksp */
 #define FSE_STATIC_LINKING_ONLY   /* FSE_encodeSymbol */
 #include "../common/fse.h"
index 6083ed66418aa6d39a2a221646bc4393eabb8e03..bfe83e2149cfcc53f376a3131ae1021281d9836f 100644 (file)
@@ -19,7 +19,6 @@
 *  Dependencies
 ***************************************/
 #include "../common/zstd_internal.h"
-#include "../common/zstd_trace.h"  /* ZSTD_TraceCtx */
 #include "zstd_cwksp.h"
 #ifdef ZSTD_MULTITHREAD
 #  include "zstdmt_compress.h"
index 15139501bea196fbe770ffdc1c824341ae0ef9ec..10b6a88e155db26138648d867590e404837c9b42 100644 (file)
@@ -58,7 +58,6 @@
 #include "../common/zstd_deps.h"   /* ZSTD_memcpy, ZSTD_memmove, ZSTD_memset */
 #include "../common/cpu.h"         /* bmi2 */
 #include "../common/mem.h"         /* low level memory routines */
-#include "../common/zstd_trace.h"
 #define FSE_STATIC_LINKING_ONLY
 #include "../common/fse.h"
 #define HUF_STATIC_LINKING_ONLY
index 3fcec6c5667fad44d97378d67510776adbc3d67b..40d8202318531ebdf2ee162a633e32599b66d810 100644 (file)
@@ -21,7 +21,6 @@
  *********************************************************/
 #include "../common/mem.h"             /* BYTE, U16, U32 */
 #include "../common/zstd_internal.h"   /* ZSTD_seqSymbol */
-#include "../common/zstd_trace.h"      /* ZSTD_TraceCtx */