summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2022-11-12 13:05:24 -0800
committerAlan Coopersmith <alan.coopersmith@oracle.com>2022-11-12 13:05:24 -0800
commitd9ba30a6f56b2bb7e6f1b125a3d2eaa871c96eba (patch)
tree0ee920aa03de51b2b2d525abfb18492eeaf15c8a
parent0be214afe5eeddc6d5e6cdcae9b7242d4e11b3cd (diff)
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 <alan.coopersmith@oracle.com>
-rw-r--r--grid.c12
1 files 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,