From: Mark Wooding Date: Wed, 18 Sep 2019 19:22:39 +0000 (+0100) Subject: struct/buf.c: Muffle an annoying Clang warning about a pointless assertion. X-Git-Tag: 2.4.0~1 X-Git-Url: https://git.distorted.org.uk/~mdw/mLib/commitdiff_plain/0d61a23cc6a7628bb9ada98ae7a65700dc1fd2f7 struct/buf.c: Muffle an annoying Clang warning about a pointless assertion. Of course, since this code is macro-generated, it's not at all pointless. --- diff --git a/struct/buf.c b/struct/buf.c index 1ac6bb9..d86904c 100644 --- a/struct/buf.c +++ b/struct/buf.c @@ -31,6 +31,7 @@ #include #include "buf.h" +#include "macros.h" /*----- Main code ---------------------------------------------------------*/ @@ -273,7 +274,9 @@ void *buf_getmemz(buf *b, size_t *nn) #define BUF_PUTMEM_(n, W, w) \ int buf_putmem##w(buf *b, const void *p, size_t sz) \ { \ - assert(sz <= MASK##W); \ + MUFFLE_WARNINGS_STMT \ + (CLANG_WARNING("-Wtautological-constant-out-of-range-compare"), \ + { assert(sz <= MASK##W); }); \ if (buf_putu##w(b, sz) || buf_put(b, p, sz)) \ return (-1); \ return (0); \