struct/buf.h: Muffle annoying new GCC warning.
authorMark Wooding <mdw@distorted.org.uk>
Fri, 8 May 2020 23:10:54 +0000 (00:10 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Fri, 8 May 2020 23:16:35 +0000 (00:16 +0100)
This one seems like more trouble than it's worth.  Just squash it in
GCC versions recent enough to know about the warning.

struct/buf.h

index b96a886..a3585b4 100644 (file)
 #  include "dstr.h"
 #endif
 
+#ifndef MLIB_MACROS_H
+#  include "macros.h"
+#endif
+
 /*----- Data structures ---------------------------------------------------*/
 
 /* --- Buffers --- *
@@ -71,8 +75,14 @@ typedef struct buf {
 #define BBAD(b) ((b)->f & BF_BROKEN)
 #define BOK(b) (!BBAD(b))
 
-#define BENSURE(b, sz)                                                 \
-  (BBAD(b) ? -1 : (sz) > BLEFT(b) ? (b)->f |= BF_BROKEN, -1 : 0)
+#if GCC_VERSION_P(8, 0)
+#  define BENSURE(b, sz)                                               \
+     MUFFLE_WARNINGS_EXPR(GCC_WARNING("-Wint-in-bool-context"),                \
+       (BBAD(b) ? -1 : (sz) > BLEFT(b) ? (b)->f |= BF_BROKEN, -1 : 0))
+#else
+#  define BENSURE(b, sz)                                               \
+     (BBAD(b) ? -1 : (sz) > BLEFT(b) ? (b)->f |= BF_BROKEN, -1 : 0)
+#endif
 
 #define BUF_DOSUFFIXES(_) DOUINTCONV(_) _(z, z, z)