struct/buf.c: Muffle an annoying Clang warning about a pointless assertion.
authorMark Wooding <mdw@distorted.org.uk>
Wed, 18 Sep 2019 19:22:39 +0000 (20:22 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Wed, 18 Sep 2019 19:30:54 +0000 (20:30 +0100)
Of course, since this code is macro-generated, it's not at all
pointless.

struct/buf.c

index 1ac6bb9..d86904c 100644 (file)
@@ -31,6 +31,7 @@
 #include <string.h>
 
 #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);                                                                \