summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2018-09-28 13:00:41 +0200
committerantirez <antirez@gmail.com>2018-09-28 13:00:44 +0200
commit08c26591e38c8797e554ee209f7c2a718df302ab (patch)
tree4edd80337b960078eb896db377b638dbbae02fcc
parent5aa347b3774891b8babf1347bde451382f514dea (diff)
downloadredis-08c26591e38c8797e554ee209f7c2a718df302ab.tar.gz
Try to avoid issues with GCC pragmas and older compilers.
See issue #5394.
-rw-r--r--src/lzf_d.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/lzf_d.c b/src/lzf_d.c
index 93f43c27c..d44bfcc8d 100644
--- a/src/lzf_d.c
+++ b/src/lzf_d.c
@@ -52,6 +52,10 @@
#endif
#endif
+#if defined(__GNUC__) && __GNUC__ >= 5
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wimplicit-fallthrough"
+#endif
unsigned int
lzf_decompress (const void *const in_data, unsigned int in_len,
void *out_data, unsigned int out_len)
@@ -86,8 +90,6 @@ lzf_decompress (const void *const in_data, unsigned int in_len,
#ifdef lzf_movsb
lzf_movsb (op, ip, ctrl);
#else
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wimplicit-fallthrough"
switch (ctrl)
{
case 32: *op++ = *ip++; case 31: *op++ = *ip++; case 30: *op++ = *ip++; case 29: *op++ = *ip++;
@@ -99,7 +101,6 @@ lzf_decompress (const void *const in_data, unsigned int in_len,
case 8: *op++ = *ip++; case 7: *op++ = *ip++; case 6: *op++ = *ip++; case 5: *op++ = *ip++;
case 4: *op++ = *ip++; case 3: *op++ = *ip++; case 2: *op++ = *ip++; case 1: *op++ = *ip++;
}
-#pragma GCC diagnostic pop
#endif
}
else /* back reference */
@@ -185,4 +186,6 @@ lzf_decompress (const void *const in_data, unsigned int in_len,
return op - (u8 *)out_data;
}
-
+#if defined(__GNUC__) && __GNUC__ >= 5
+#pragma GCC diagnostic pop
+#endif