geofast.h: 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:30 +01:00 committed by Tim Edwards
parent e8f9b0af5e
commit 88d36bfd1e
1 changed files with 2 additions and 2 deletions

View File

@ -32,12 +32,12 @@
*/
#define GEOCLIP(r, area) \
if (1) { \
do { \
if ((r)->r_xbot < (area)->r_xbot) (r)->r_xbot = (area)->r_xbot; \
if ((r)->r_ybot < (area)->r_ybot) (r)->r_ybot = (area)->r_ybot; \
if ((r)->r_xtop > (area)->r_xtop) (r)->r_xtop = (area)->r_xtop; \
if ((r)->r_ytop > (area)->r_ytop) (r)->r_ytop = (area)->r_ytop; \
} else
} while(0)
/* --------------------- Transforming rectangles ---------------------- */