solstice-pp

Post-processing utilities for the solstice app
git clone git://git.meso-star.com/solstice-pp.git
Log | Files | Refs | README | LICENSE

commit 3c504c650e65dfb5d0e9af52354a95e31f36e417
parent 87fcfcd0cd043ab8b8704f4931d1ccbbf0f490e1
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Tue,  4 Jun 2019 12:00:24 +0200

Fix the "multi-statement macro" GCC warnings

Diffstat:
Msolpp.h | 10+++++-----
1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/solpp.h b/solpp.h @@ -33,8 +33,8 @@ struct mc { double E/* Expected value */, SE/* Standard Error */; }; #define FOR_EACH(Id, Start, End) for((Id)=(Start); (Id)<(End); ++(Id)) -#define CHK(Cond) if(!(Cond)) \ - {fprintf(stderr, "error:%s:%d\n", __FILE__, __LINE__); abort();} (void)0 +#define CHK(Cond) { if(!(Cond)) \ + {fprintf(stderr, "error:%s:%d\n", __FILE__, __LINE__); abort();}} (void)0 /******************************************************************************* * Dynamic buffer @@ -42,10 +42,10 @@ struct mc { double E/* Expected value */, SE/* Standard Error */; }; #define BUF(Type) struct { Type* mem; size_t ca; size_t sz; } #define BUF_NULL {NULL, 0, 0} #define BUF_RELEASE(B) free((B).mem) -#define BUF_RESERVE(B, Sz) \ - if((Sz)>(B).ca) { \ +#define BUF_RESERVE(B, Sz) { \ + if((Sz)>(B).ca) \ CHK((B).mem = realloc((B).mem, sizeof(*(B).mem)*((B).ca=(Sz)))); \ - } (void)0 +} (void)0 #define BUF_RESIZE(B, Sz) {BUF_RESERVE((B), Sz); (B).sz = Sz;} (void)0 #define BUF_PUSH(B, E) { \ if((B).sz >= (B).ca) BUF_RESERVE((B), ((B).ca?(B).ca*2:32)); \