From bd75ddf32cb0e4c8d47997243aaf861d6025e3c2 Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Fri, 4 Oct 2024 17:08:37 +0100 Subject: [PATCH] mzMain.c: warning: this 'else' clause does not guard... Use of macro idiom: if(1) { ... } else which has dangling else keyword to allow trailing semicolon at use site, is not a good pattern. Replaced with idiom: do { ... } while(0) which should achieve the same purpose but now cause compile error when used incorrectly at use site. GCC14 -Wall cleanup series [-Wmisleading-indentation] --- mzrouter/mzMain.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mzrouter/mzMain.c b/mzrouter/mzMain.c index c877e8ab..f2e4637b 100644 --- a/mzrouter/mzMain.c +++ b/mzrouter/mzMain.c @@ -233,22 +233,22 @@ bool mzPathsDirty = FALSE; /* macro for adding address pairs to translation table */ #define ADDR_TBL_EQUIV(a1,a2) \ -if(TRUE) \ +do \ { \ HashSetValue(HashFind(&aT, (char *) (a1)), (char *) (a2)); \ HashSetValue(HashFind(&aT, (char *) (a2)), (char *) (a1)); \ -} else +} while(0) /* macro for translating address to address paired with it in address table */ #define ADDR_TBL(type,a) \ -if (TRUE) \ +do \ { \ HashEntry *he = HashLookOnly(&aT, (char *) (a)); \ if(he) \ { \ a = (type) HashGetValue(he); \ } \ -} else +} while(0) /*