]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
Fixed VS variable shadowing warning (and added test) 2259/head
authorCarl Woffenden <cwoffenden@gmail.com>
Wed, 29 Jul 2020 10:33:39 +0000 (12:33 +0200)
committerCarl Woffenden <cwoffenden@gmail.com>
Wed, 29 Jul 2020 10:33:39 +0000 (12:33 +0200)
contrib/single_file_libs/build_decoder_test.sh
contrib/single_file_libs/build_library_test.sh
lib/dictBuilder/cover.c
lib/dictBuilder/fastcover.c

index 13f52bd63a60a25357cf1b35af977634ad276ad9..48d017fcffa5aff1672de695d5dfb2a67f4da498 100755 (executable)
@@ -12,7 +12,7 @@ IN_FILES="examples/emscripten.c"
 # Emscripten build using emcc.
 emscripten_emcc_build() {
   # Compile the the same example as above
-  CC_FLAGS="-Wall -Wextra -Werror -Os -g0 -flto"
+  CC_FLAGS="-Wall -Wextra -Wshadow -Werror -Os -g0 -flto"
   emcc $CC_FLAGS -s WASM=1 -I. -o $OUT_WASM $IN_FILES
   # Did compilation work?
   if [ $? -ne 0 ]; then
@@ -66,7 +66,7 @@ fi
 echo "Single file decoder creation script: PASSED"
 
 # Compile the generated output
-cc -Wall -Wextra -Werror -Os -g0 -o $OUT_FILE examples/simple.c
+cc -Wall -Wextra -Wshadow -Werror -Os -g0 -o $OUT_FILE examples/simple.c
 # Did compilation work?
 if [ $? -ne 0 ]; then
   echo "Compiling simple.c: FAILED"
index 367b8de7866420f92f49cf0132a582e94482ff46..7fb99656bcc27ee8490e5f109ee13b5fad28a0e7 100755 (executable)
@@ -15,7 +15,7 @@ IN_FILES="zstd.c examples/roundtrip.c"
 # Emscripten build using emcc.
 emscripten_emcc_build() {
   # Compile the the same example as above
-  CC_FLAGS="-Wall -Wextra -Werror -Os -g0 -flto"
+  CC_FLAGS="-Wall -Wextra -Wshadow -Werror -Os -g0 -flto"
   emcc $CC_FLAGS -s WASM=1 -I. -o $OUT_WASM $IN_FILES
   # Did compilation work?
   if [ $? -ne 0 ]; then
@@ -72,7 +72,7 @@ echo "Single file library creation script: PASSED"
 cp "$ZSTD_SRC_ROOT/zstd.h" zstd.h
 
 # Compile the generated output
-cc -Wall -Wextra -Werror -pthread -I. -Os -g0 -o $OUT_FILE zstd.c examples/roundtrip.c
+cc -Wall -Wextra -Werror -Wshadow -pthread -I. -Os -g0 -o $OUT_FILE zstd.c examples/roundtrip.c
 # Did compilation work?
 if [ $? -ne 0 ]; then
   echo "Compiling roundtrip.c: FAILED"
index 12de1074adf57b933fdb2071936911c44dc265ca..bd9dd8654ead3e097dba4cbafd7b0d670807896d 100644 (file)
@@ -63,13 +63,13 @@ static int g_displayLevel = 2;
 #define DISPLAYLEVEL(l, ...) LOCALDISPLAYLEVEL(g_displayLevel, l, __VA_ARGS__)
 
 #ifndef LOCALDISPLAYUPDATE
-static const clock_t refreshRate = CLOCKS_PER_SEC * 15 / 100;
+static const clock_t g_refreshRate = CLOCKS_PER_SEC * 15 / 100;
 static clock_t g_time = 0;
 #endif
 #undef  LOCALDISPLAYUPDATE
 #define LOCALDISPLAYUPDATE(displayLevel, l, ...)                               \
   if (displayLevel >= l) {                                                     \
-    if ((clock() - g_time > refreshRate) || (displayLevel >= 4)) {             \
+    if ((clock() - g_time > g_refreshRate) || (displayLevel >= 4)) {             \
       g_time = clock();                                                        \
       DISPLAY(__VA_ARGS__);                                                    \
     }                                                                          \
index 4a4b8f8be62e86f092189ee5fc65bd0ccfab627f..8265e2c0a7b4258b762fdacc0555e845b0ac2d98 100644 (file)
@@ -60,13 +60,13 @@ static int g_displayLevel = 2;
 #define DISPLAYLEVEL(l, ...) LOCALDISPLAYLEVEL(g_displayLevel, l, __VA_ARGS__)
 
 #ifndef LOCALDISPLAYUPDATE
-static const clock_t refreshRate = CLOCKS_PER_SEC * 15 / 100;
+static const clock_t g_refreshRate = CLOCKS_PER_SEC * 15 / 100;
 static clock_t g_time = 0;
 #endif
 #undef  LOCALDISPLAYUPDATE
 #define LOCALDISPLAYUPDATE(displayLevel, l, ...)                               \
   if (displayLevel >= l) {                                                     \
-    if ((clock() - g_time > refreshRate) || (displayLevel >= 4)) {             \
+    if ((clock() - g_time > g_refreshRate) || (displayLevel >= 4)) {             \
       g_time = clock();                                                        \
       DISPLAY(__VA_ARGS__);                                                    \
     }                                                                          \