From 88d36bfd1e54a8a34b8e38cadee76ed7b8267e2b Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Fri, 4 Oct 2024 17:08:30 +0100 Subject: [PATCH] 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] --- utils/geofast.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utils/geofast.h b/utils/geofast.h index 1af24db1..af1f3664 100644 --- a/utils/geofast.h +++ b/utils/geofast.h @@ -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 ---------------------- */