summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIlya Leoshkevich <iii@linux.ibm.com>2019-03-26 10:52:02 +0100
committerHans Kristian Rosbach <hk-github@circlestorm.org>2019-03-27 13:01:02 +0100
commit3714bcf395ae1146645f0f2590b914e715569bf3 (patch)
tree975db6d13c8b5793768062760065717526f546c6
parenteea02140087f06b3787f9c6a7ce59f9ff71a9902 (diff)
downloadProject-Tick-3714bcf395ae1146645f0f2590b914e715569bf3.tar.gz
Project-Tick-3714bcf395ae1146645f0f2590b914e715569bf3.zip
Fix building with gcc 8.2.1 and -Wall -Wextra -pedantic -Werror
* ptrdiff_t check always failed because of unused parameter * sizeof(void *) check always failed because of double semicolon * Sign issue in nice_match assignment * dist parameter of set_bytes may be unused * Parameters of main may be unused in test/example.c * snprintf requires a _POSIX_C_SOURCE #define in test/minigzip.c, because a _POSIX_SOURCE #define is present
-rwxr-xr-xconfigure6
-rw-r--r--match_p.h2
-rw-r--r--memcopy.h1
-rw-r--r--test/example.c3
-rw-r--r--test/minigzip.c1
5 files changed, 9 insertions, 4 deletions
diff --git a/configure b/configure
index 91ae5be558..6b35df7d46 100755
--- a/configure
+++ b/configure
@@ -718,7 +718,7 @@ echo >> configure.log
echo -n "Checking for ptrdiff_t... " | tee -a configure.log
cat > $test.c <<EOF
#include <stddef.h>
-int fun(ptrdiff_t *a) { return 0; }
+int fun(ptrdiff_t *a) { (void)a; return 0; }
EOF
if try $CC -c $CFLAGS $test.c; then
echo "Yes." | tee -a configure.log
@@ -730,7 +730,7 @@ else
echo -n "Checking for sizeof(void *)... " | tee -a configure.log
cat > $test.c <<EOF
#include <stdint.h>
-#define COMPILE_TIME_ASSERT(pred) struct s { int x: (pred) ? 1 : -1; };
+#define COMPILE_TIME_ASSERT(pred) struct s { int x: (pred) ? 1 : -1; }
COMPILE_TIME_ASSERT(sizeof(int32_t) == sizeof(void *));
EOF
if try $CC -c $CFLAGS $test.c; then
@@ -740,7 +740,7 @@ EOF
else
cat > $test.c <<EOF
#include <stdint.h>
-#define COMPILE_TIME_ASSERT(pred) struct s { int x: (pred) ? 1 : -1; };
+#define COMPILE_TIME_ASSERT(pred) struct s { int x: (pred) ? 1 : -1; }
COMPILE_TIME_ASSERT(sizeof(int64_t) == sizeof(void *));
EOF
if try $CC -c $CFLAGS $test.c; then
diff --git a/match_p.h b/match_p.h
index d381eebfd1..b956d8d520 100644
--- a/match_p.h
+++ b/match_p.h
@@ -75,7 +75,7 @@ static inline unsigned longest_match(deflate_state *const s, IPos cur_match) {
* Do not looks for matches beyond the end of the input. This is
* necessary to make deflate deterministic
*/
- nice_match = (unsigned int)s->nice_match > s->lookahead ? s->lookahead : s->nice_match;
+ nice_match = (unsigned int)s->nice_match > s->lookahead ? s->lookahead : (unsigned int)s->nice_match;
/*
* Stop when cur_match becomes <= limit. To simplify the code,
diff --git a/memcopy.h b/memcopy.h
index 9ce391106d..301aa5f732 100644
--- a/memcopy.h
+++ b/memcopy.h
@@ -401,6 +401,7 @@ static inline unsigned char *set_bytes(unsigned char *out, unsigned char *from,
Assert(len < 8, "set_bytes should be called with less than 8 bytes");
#ifndef UNALIGNED_OK
+ (void)dist;
while (len--) {
*out++ = *from++;
}
diff --git a/test/example.c b/test/example.c
index 7567fc5d2f..13a828b72b 100644
--- a/test/example.c
+++ b/test/example.c
@@ -538,6 +538,9 @@ int main(int argc, char *argv[])
#ifdef WITH_GZFILEOP
test_gzio((argc > 1 ? argv[1] : TESTFILE),
uncompr, uncomprLen);
+#else
+ (void)argc;
+ (void)argv;
#endif
test_deflate(compr, comprLen);
diff --git a/test/minigzip.c b/test/minigzip.c
index 3f21b1abec..e8ae9ef88f 100644
--- a/test/minigzip.c
+++ b/test/minigzip.c
@@ -15,6 +15,7 @@
/* @(#) $Id$ */
#define _POSIX_SOURCE 1 /* This file needs POSIX for fdopen(). */
+#define _POSIX_C_SOURCE 200112 /* For snprintf(). */
#include "zbuild.h"
#ifdef ZLIB_COMPAT