From d9ba30a6f56b2bb7e6f1b125a3d2eaa871c96eba Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Sat, 12 Nov 2022 13:05:24 -0800 Subject: Handle -Wextra-semi-stmt warnings from clang Use do {...} while (0) idiom for pre-processor macros that define code blocks so that trailing semi-colons don't appear to be extraneous grid.c:305:38: warning: empty expression statement has no effect; remove unnecessary ';' to silence this warning [-Wextra-semi-stmt] CI_GET_CHAR_INFO_1D (fs, ch, cs); ^ grid.c:311:40: warning: empty expression statement has no effect; remove unnecessary ';' to silence this warning [-Wextra-semi-stmt] CI_GET_CHAR_INFO_2D (fs, r, c, cs); ^ grid.c:488:46: warning: empty expression statement has no effect; remove unnecessary ';' to silence this warning [-Wextra-semi-stmt] donestr (XftColor, xftColor, XtRXftColor); ^ grid.c:546:42: warning: empty expression statement has no effect; remove unnecessary ';' to silence this warning [-Wextra-semi-stmt] donestr (XftFont *, font, XtRXftFont); ^ Signed-off-by: Alan Coopersmith --- grid.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/grid.c b/grid.c index fc3b272..4aff728 100644 --- a/grid.c +++ b/grid.c @@ -247,7 +247,7 @@ GridLastChar (Widget w) (cs)->ascent|(cs)->descent) == 0)) #define CI_GET_CHAR_INFO_1D(fs,col,cs) \ -{ \ +do { \ cs = NULL; \ if (col >= fs->min_char_or_byte2 && col <= fs->max_char_or_byte2) { \ if (fs->per_char == NULL) { \ @@ -258,14 +258,14 @@ GridLastChar (Widget w) if (CI_NONEXISTCHAR(cs)) \ cs = NULL; \ } \ -} +} while (0) /* * CI_GET_CHAR_INFO_2D - return the charinfo struct for the indicated row and * column. This is used for fonts that have more than row zero. */ #define CI_GET_CHAR_INFO_2D(fs,row,col,cs) \ -{ \ +do { \ cs = NULL; \ if (row >= fs->min_byte1 && row <= fs->max_byte1 && \ col >= fs->min_char_or_byte2 && col <= fs->max_char_or_byte2) { \ @@ -280,7 +280,7 @@ GridLastChar (Widget w) if (CI_NONEXISTCHAR(cs)) \ cs = NULL; \ } \ -} +} while (0) static Boolean GridHasChar (Widget w, long ch) @@ -389,7 +389,7 @@ static XtConvertArgRec xftColorConvertArgs[] = { }; #define donestr(type, value, tstr) \ - { \ + do { \ if (toVal->addr != NULL) { \ if (toVal->size < sizeof(type)) { \ toVal->size = sizeof(type); \ @@ -406,7 +406,7 @@ static XtConvertArgRec xftColorConvertArgs[] = { } \ toVal->size = sizeof(type); \ return True; \ - } + } while (0) static void XmuFreeXftColor (XtAppContext app, XrmValuePtr toVal, XtPointer closure, -- cgit v1.2.3