From 43f31da324ae3558574db60f73ac30e27b5aa431 Mon Sep 17 00:00:00 2001 From: christianEQ Date: Thu, 15 Jul 2021 20:14:14 +0000 Subject: [PATCH] fix warnings for mac build Former-commit-id: 570fbd014944a655f6c8e7216f2b9226f378c7c7 --- src/Makefile | 2 +- src/connection.cpp | 3 +++ src/replication.cpp | 2 +- src/t_set.cpp | 6 +++--- src/t_stream.cpp | 4 ++-- 5 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/Makefile b/src/Makefile index 179bb46e7..37f7ba917 100644 --- a/src/Makefile +++ b/src/Makefile @@ -29,7 +29,7 @@ ifneq (,$(findstring FreeBSD,$(uname_S))) STD+=-Wno-c11-extensions endif endif -WARN=-Wall -W -Wno-missing-field-initializers +WARN=-Wall -W -Wno-missing-field-initializers -Wno-address-of-packed-member -Wno-atomic-alignment OPT=$(OPTIMIZATION) # Detect if the compiler supports C11 _Atomic diff --git a/src/connection.cpp b/src/connection.cpp index 11d1e0809..e72cc8451 100644 --- a/src/connection.cpp +++ b/src/connection.cpp @@ -437,6 +437,9 @@ void connSetThreadAffinity(connection *conn, int cpu) { { serverLog(LL_WARNING, "Failed to set socket affinity"); } +#else + (void)conn; + (void)cpu; #endif } diff --git a/src/replication.cpp b/src/replication.cpp index e01124fb1..f29cdb184 100644 --- a/src/replication.cpp +++ b/src/replication.cpp @@ -4803,7 +4803,7 @@ void replicationNotifyLoadedKey(redisDb *db, robj_roptr key, robj_roptr val, lon redisObjectStack objTtl; initStaticStringObject(objTtl, sdscatprintf(sdsempty(), "%lld", expire)); redisObjectStack objMvcc; - initStaticStringObject(objMvcc, sdscatprintf(sdsempty(), "%lu", mvccFromObj(val))); + initStaticStringObject(objMvcc, sdscatprintf(sdsempty(), "%" PRIu64, mvccFromObj(val))); redisObject *argv[5] = {shared.mvccrestore, key.unsafe_robjcast(), &objMvcc, &objTtl, &objPayload}; replicationFeedSlaves(g_pserver->slaves, db - g_pserver->db, argv, 5); diff --git a/src/t_set.cpp b/src/t_set.cpp index 6aa0cedc5..4d1f4420e 100644 --- a/src/t_set.cpp +++ b/src/t_set.cpp @@ -512,7 +512,7 @@ void spopWithCountCommand(client *c) { const char *sdsele; robj *objele; int encoding; - int64_t llele; + int64_t llele = 0; unsigned long remaining = size-count; /* Elements left after SPOP. */ /* If we are here, the number of requested elements is less than the @@ -664,7 +664,7 @@ void srandmemberWithCountCommand(client *c) { int uniq = 1; robj_roptr set; const char *ele; - int64_t llele; + int64_t llele = 0; int encoding; dict *d; @@ -813,7 +813,7 @@ void srandmemberWithCountCommand(client *c) { void srandmemberCommand(client *c) { robj_roptr set; const char *ele; - int64_t llele; + int64_t llele = 0; int encoding; if (c->argc == 3) { diff --git a/src/t_stream.cpp b/src/t_stream.cpp index 828b9353b..d82044deb 100644 --- a/src/t_stream.cpp +++ b/src/t_stream.cpp @@ -842,7 +842,7 @@ int64_t streamTrim(stream *s, streamAddTrimArgs *args) { /* Trims a stream by length. Returns the number of deleted items. */ int64_t streamTrimByLength(stream *s, long long maxlen, int approx) { - streamAddTrimArgs args = {0}; + streamAddTrimArgs args = {{0}}; args.trim_strategy = TRIM_STRATEGY_MAXLEN; args.approx_trim = approx; args.limit = approx ? 100 * g_pserver->stream_node_max_entries : 0; @@ -852,7 +852,7 @@ int64_t streamTrimByLength(stream *s, long long maxlen, int approx) { /* Trims a stream by minimum ID. Returns the number of deleted items. */ int64_t streamTrimByID(stream *s, streamID minid, int approx) { - streamAddTrimArgs args = {0}; + streamAddTrimArgs args = {{0}}; args.trim_strategy = TRIM_STRATEGY_MINID; args.approx_trim = approx; args.limit = approx ? 100 * g_pserver->stream_node_max_entries : 0;