From: Mark Wooding Date: Fri, 8 May 2020 23:10:54 +0000 (+0100) Subject: struct/buf.h: Muffle annoying new GCC warning. X-Git-Url: https://git.distorted.org.uk/~mdw/mLib/commitdiff_plain/4debfda5599eb92a2e58eaf8d8c6a790f9d98391 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. --- 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)