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]
This commit is contained in:
Darryl L. Miles 2024-10-04 17:08:37 +01:00 committed by Tim Edwards
parent 88d36bfd1e
commit bd75ddf32c
1 changed files with 4 additions and 4 deletions

View File

@ -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)
/*