Jelajahi Sumber

zstd: Suppress clang-analyzer warnings

Brad King 2 tahun lalu
induk
melakukan
d531b9e7d1

+ 2 - 0
Utilities/cmzstd/lib/common/bitstream.h

@@ -14,6 +14,8 @@
 #ifndef BITSTREAM_H_MODULE
 #define BITSTREAM_H_MODULE
 
+#include <assert.h>
+
 #if defined (__cplusplus)
 extern "C" {
 #endif

+ 4 - 0
Utilities/cmzstd/lib/compress/fse_compress.c

@@ -646,6 +646,10 @@ size_t FSE_compress_wksp (void* dst, size_t dstSize, const void* src, size_t src
     void* scratchBuffer = (void*)(CTable + CTableSize);
     size_t const scratchBufferSize = wkspSize - (CTableSize * sizeof(FSE_CTable));
 
+#ifdef __clang_analyzer__
+    memset(norm, 0, sizeof(norm));
+#endif
+
     /* init conditions */
     if (wkspSize < FSE_COMPRESS_WKSP_SIZE_U32(tableLog, maxSymbolValue)) return ERROR(tableLog_tooLarge);
     if (srcSize <= 1) return 0;  /* Not compressible */

+ 11 - 0
Utilities/cmzstd/lib/dictBuilder/divsufsort.c

@@ -40,6 +40,10 @@
 #include <stdio.h>
 #include <stdlib.h>
 
+#ifdef __clang_analyzer__
+#include <string.h>
+#endif
+
 #include "divsufsort.h"
 
 /*- Constants -*/
@@ -1119,6 +1123,9 @@ tr_copy(int *ISA, const int *SA,
 
   v = b - SA - 1;
   for(c = first, d = a - 1; c <= d; ++c) {
+    #ifdef __clang_analyzer__
+    assert(c);
+    #endif
     if((0 <= (s = *c - depth)) && (ISA[s] == v)) {
       *++d = s;
       ISA[s] = d - SA;
@@ -1184,6 +1191,10 @@ tr_introsort(int *ISA, const int *ISAd,
   int limit, next;
   int ssize, trlink = -1;
 
+  #ifdef __clang_analyzer__
+  memset(stack, 0, sizeof(stack));
+  #endif
+
   for(ssize = 0, limit = tr_ilg(last - first);;) {
 
     if(limit < 0) {