From 4debfda5599eb92a2e58eaf8d8c6a790f9d98391 Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Sat, 9 May 2020 00:10:54 +0100 Subject: [PATCH] struct/buf.h: Muffle annoying new GCC warning. 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 | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/struct/buf.h b/struct/buf.h index b96a886..a3585b4 100644 --- a/struct/buf.h +++ b/struct/buf.h @@ -44,6 +44,10 @@ # 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) -- 2.11.0