]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
added several compilation flags
authorYann Collet <cyan@fb.com>
Tue, 16 May 2017 00:15:46 +0000 (17:15 -0700)
committerYann Collet <cyan@fb.com>
Tue, 16 May 2017 00:15:46 +0000 (17:15 -0700)
examples/Makefile
lib/Makefile
programs/Makefile
tests/Makefile
tests/datagencli.c
tests/fullbench.c
tests/paramgrill.c

index b84983f08c0c3d9311daf61068747e9a2f284231..e279a537d71e8ffefc36fc4b98e65efd6f00e5bd 100644 (file)
@@ -46,7 +46,7 @@ clean:
         simple_compression simple_decompression \
         dictionary_compression dictionary_decompression \
         streaming_compression streaming_decompression \
-               multiple_streaming_compression
+        multiple_streaming_compression
        @echo Cleaning completed
 
 test: all
index f5f610372472fadfc5b2bba9f457dbb8f926d274..cc109944d5e7c0d02b27bac129e98df75fd5a784 100644 (file)
@@ -24,7 +24,9 @@ CPPFLAGS+= -I. -I./common -DXXH_NAMESPACE=ZSTD_
 CFLAGS  ?= -O3
 DEBUGFLAGS = -Wall -Wextra -Wcast-qual -Wcast-align -Wshadow \
            -Wstrict-aliasing=1 -Wswitch-enum -Wdeclaration-after-statement \
-           -Wstrict-prototypes -Wundef -Wpointer-arith -Wformat-security
+           -Wstrict-prototypes -Wundef -Wpointer-arith -Wformat-security \
+           -Wvla -Wformat=2 -Winit-self -Wfloat-equal -Wwrite-strings \
+           -Wbad-function-cast -Wredundant-decls
 CFLAGS  += $(DEBUGFLAGS) $(MOREFLAGS)
 FLAGS    = $(CPPFLAGS) $(CFLAGS)
 
index bb40253b9c2a58d08eb211451ce6c672b9c40970..9efa00074965abe21650e0a77c98f2ea265b5632 100644 (file)
@@ -43,7 +43,9 @@ CPPFLAGS+= -I$(ZSTDDIR) -I$(ZSTDDIR)/common -I$(ZSTDDIR)/compress \
 CFLAGS  ?= -O3
 DEBUGFLAGS = -Wall -Wextra -Wcast-qual -Wcast-align -Wshadow \
           -Wstrict-aliasing=1 -Wswitch-enum -Wdeclaration-after-statement \
-          -Wstrict-prototypes -Wundef -Wpointer-arith -Wformat-security
+          -Wstrict-prototypes -Wundef -Wpointer-arith -Wformat-security \
+          -Wvla -Wformat=2 -Winit-self -Wfloat-equal -Wwrite-strings \
+          -Wbad-function-cast -Wredundant-decls
 CFLAGS  += $(DEBUGFLAGS) $(MOREFLAGS)
 FLAGS    = $(CPPFLAGS) $(CFLAGS) $(LDFLAGS)
 
@@ -56,7 +58,7 @@ ZDICT_FILES := $(ZSTDDIR)/dictBuilder/*.c
 ZSTDDECOMP_O = $(ZSTDDIR)/decompress/zstd_decompress.o
 
 ZSTD_LEGACY_SUPPORT ?= 4
-ZSTDLEGACY_FILES:=
+ZSTDLEGACY_FILES :=
 ifneq ($(ZSTD_LEGACY_SUPPORT), 0)
 ifeq ($(shell test $(ZSTD_LEGACY_SUPPORT) -lt 8; echo $$?), 0)
        ZSTDLEGACY_FILES += $(shell ls $(ZSTDDIR)/legacy/*.c | grep 'v0[$(ZSTD_LEGACY_SUPPORT)-7]')
index ea58c0fe5119e91ff6b434b7977ae01d5fb22fef..560c36e1f80e80b494e033833fc9c63f57f0d728 100644 (file)
@@ -33,7 +33,9 @@ CPPFLAGS+= -I$(ZSTDDIR) -I$(ZSTDDIR)/common -I$(ZSTDDIR)/compress \
 CFLAGS  ?= -O3
 CFLAGS  += -Wall -Wextra -Wcast-qual -Wcast-align -Wshadow \
            -Wstrict-aliasing=1 -Wswitch-enum -Wdeclaration-after-statement \
-           -Wstrict-prototypes -Wundef -Wformat-security
+           -Wstrict-prototypes -Wundef -Wformat-security \
+           -Wvla -Wformat=2 -Winit-self -Wfloat-equal -Wwrite-strings \
+           -Wbad-function-cast -Wredundant-decls
 CFLAGS  += $(MOREFLAGS)
 FLAGS    = $(CPPFLAGS) $(CFLAGS) $(LDFLAGS)
 
index 2f3ebc4d6863f29eb2de77a41d4fab6fc6a746d6..3bb634b75e6bea75aa6c0ad08fd2f4ab7cc0d427 100644 (file)
@@ -48,7 +48,8 @@ static int usage(const char* programName)
     DISPLAY( "Arguments :\n");
     DISPLAY( " -g#    : generate # data (default:%i)\n", SIZE_DEFAULT);
     DISPLAY( " -s#    : Select seed (default:%i)\n", SEED_DEFAULT);
-    DISPLAY( " -P#    : Select compressibility in %% (default:%i%%)\n", COMPRESSIBILITY_DEFAULT);
+    DISPLAY( " -P#    : Select compressibility in %% (default:%i%%)\n",
+                        COMPRESSIBILITY_DEFAULT);
     DISPLAY( " -h     : display help and exit\n");
     return 0;
 }
@@ -56,7 +57,7 @@ static int usage(const char* programName)
 
 int main(int argc, const char** argv)
 {
-    double proba = (double)COMPRESSIBILITY_DEFAULT / 100;
+    unsigned probaU32 = COMPRESSIBILITY_DEFAULT;
     double litProba = 0.0;
     U64 size = SIZE_DEFAULT;
     U32 seed = SEED_DEFAULT;
@@ -94,11 +95,10 @@ int main(int argc, const char** argv)
                     break;
                 case 'P':
                     argument++;
-                    proba=0.0;
+                    probaU32=0.0;
                     while ((*argument>='0') && (*argument<='9'))
-                        proba *= 10, proba += *argument++ - '0';
-                    if (proba>100.) proba=100.;
-                    proba /= 100.;
+                        probaU32 *= 10, probaU32 += *argument++ - '0';
+                    if (probaU32>100.) probaU32=100.;
                     break;
                 case 'L':   /* hidden argument : Literal distribution probability */
                     argument++;
@@ -117,11 +117,12 @@ int main(int argc, const char** argv)
                 }
     }   }   }   /* for(argNb=1; argNb<argc; argNb++) */
 
-    DISPLAYLEVEL(4, "Data Generator \n");
+    DISPLAYLEVEL(4, "Compressible data Generator \n");
+    if (probaU32!=COMPRESSIBILITY_DEFAULT)
+        DISPLAYLEVEL(3, "Compressibility : %i%%\n", probaU32);
     DISPLAYLEVEL(3, "Seed = %u \n", seed);
-    if (proba!=COMPRESSIBILITY_DEFAULT) DISPLAYLEVEL(3, "Compressibility : %i%%\n", (U32)(proba*100));
 
-    RDG_genStdout(size, proba, litProba, seed);
+    RDG_genStdout(size, (double)probaU32/100, litProba, seed);
     DISPLAYLEVEL(1, "\n");
 
     return 0;
index 13323aec1b2494ffb82a06bb80879670aa29db2a..2cdad2e38b10159bd7ce0d344741ee852a4a8465 100644 (file)
@@ -363,9 +363,8 @@ static size_t benchMem(const void* src, size_t srcSize, U32 benchNb)
         for (loopNb = 1; loopNb <= g_nbIterations; loopNb++) {
             clock_t const timeLoop = TIMELOOP_S * CLOCKS_PER_SEC;
             clock_t clockStart;
-            U32 nbRounds;
             size_t benchResult=0;
-            double averageTime;
+            U32 nbRounds;
 
             clockStart = clock();
             while (clock() == clockStart);
@@ -374,10 +373,11 @@ static size_t benchMem(const void* src, size_t srcSize, U32 benchNb)
                 benchResult = benchFunction(dstBuff, dstBuffSize, buff2, src, srcSize);
                 if (ZSTD_isError(benchResult)) { DISPLAY("ERROR ! %s() => %s !! \n", benchName, ZSTD_getErrorName(benchResult)); exit(1); }
             }
-            averageTime = (((double)BMK_clockSpan(clockStart)) / CLOCKS_PER_SEC) / nbRounds;
-            if (averageTime < bestTime) bestTime = averageTime;
-            DISPLAY("%2i- %-30.30s : %7.1f MB/s  (%9u)\r", loopNb, benchName, (double)srcSize / (1 MB) / bestTime, (U32)benchResult);
-    }   }
+            {   clock_t const clockTotal = BMK_clockSpan(clockStart);
+                double const averageTime = (double)clockTotal / CLOCKS_PER_SEC / nbRounds;
+                if (averageTime < bestTime) bestTime = averageTime;
+                DISPLAY("%2i- %-30.30s : %7.1f MB/s  (%9u)\r", loopNb, benchName, (double)srcSize / (1 MB) / bestTime, (U32)benchResult);
+    }   }   }
     DISPLAY("%2u\n", benchNb);
 
 _cleanOut:
index 9b032c0a6ecd373d89e731e988d69788ffd1a056..1185c664980f85249b37eb9d3e9c5cb88cca3c8c 100644 (file)
@@ -38,7 +38,7 @@
 #define GB *(1ULL<<30)
 
 #define NBLOOPS    2
-#define TIMELOOP   (2 * CLOCKS_PER_SEC)
+#define TIMELOOP  (2 * CLOCKS_PER_SEC)
 
 #define NB_LEVELS_TRACKED 30
 
@@ -47,7 +47,7 @@ static const size_t maxMemory = (sizeof(size_t)==4)  ?  (2 GB - 64 MB) : (size_t
 #define COMPRESSIBILITY_DEFAULT 0.50
 static const size_t sampleSize = 10000000;
 
-static const U32 g_grillDuration_s = 60000;   /* about 16 hours */
+static const double g_grillDuration_s = 90000;   /* about 24 hours */
 static const clock_t g_maxParamTime = 15 * CLOCKS_PER_SEC;
 static const clock_t g_maxVariationTime = 60 * CLOCKS_PER_SEC;
 static const int g_maxNbVariations = 64;
@@ -87,9 +87,11 @@ void BMK_SetNbIterations(int nbLoops)
 *  Private functions
 *********************************************************/
 
-static clock_t BMK_clockSpan(clock_t cStart) { return clock() - cStart; }  /* works even if overflow ; max span ~ 30 mn */
+/* works even if overflow ; max span ~ 30 mn */
+static clock_t BMK_clockSpan(clock_t cStart) { return clock() - cStart; }
 
-static U32 BMK_timeSpan(time_t tStart) { return (U32)difftime(time(NULL), tStart); }  /* accuracy in seconds only, span can be multiple years */
+/* accuracy in seconds only, span can be multiple years */
+static double BMK_timeSpan(time_t tStart) { return difftime(time(NULL), tStart); }
 
 
 static size_t BMK_findMaxMem(U64 requiredMem)