]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
zng_tr_tally_lit: disable -Wtype-limits
authorIlya Leoshkevich <iii@linux.ibm.com>
Tue, 21 Jul 2020 11:15:07 +0000 (13:15 +0200)
committerHans Kristian Rosbach <hk-github@circlestorm.org>
Sun, 23 Aug 2020 08:07:07 +0000 (10:07 +0200)
Some gcc versions complain that parameter c is always less than
MAX_MATCH-MIN_MATCH, and therefore the assertion that checks for this
is useless, but in reality some day MIN_MATCH and MAX_MATCH can change.

So disable the warning around the assertion.

deflate_p.h

index 09746a75834fc449672e51fbb375b787f3e60d79..c956f7f4c761dd586823f9f4b7f089855aca8212 100644 (file)
@@ -33,7 +33,10 @@ static inline int zng_tr_tally_lit(deflate_state *s, unsigned char c) {
     s->sym_buf[s->sym_next++] = c;
     s->dyn_ltree[c].Freq++;
     Tracevv((stderr, "%c", c));
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wtype-limits"
     Assert(c <= (MAX_MATCH-MIN_MATCH), "zng_tr_tally: bad literal");
+#pragma GCC diagnostic pop
     return (s->sym_next == s->sym_end);
 }