From 563ddd4ff5575e3f8bbf635cbdc339b09a7e285e Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Sun, 10 Nov 2024 11:09:56 -0800 Subject: BufAlloc: add do { ... } while (0) to avoid -Wextra-semi-stmt warnings Clears 46 warnings from clang of the form: XKB.c:207:69: warning: empty expression statement has no effect; remove unnecessary ';' to silence this warning [-Wextra-semi-stmt] BufAlloc(char *, out, (((size * 2) + (unsigned) 3) / 4) * 4); ^ Signed-off-by: Alan Coopersmith Part-of: --- include/X11/Xlibint.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/include/X11/Xlibint.h b/include/X11/Xlibint.h index b03a2ed1..9f27b229 100644 --- a/include/X11/Xlibint.h +++ b/include/X11/Xlibint.h @@ -668,12 +668,13 @@ extern void _XFlushGCCache(Display *dpy, GC gc); * BufAlloc (xTextElt *, elt, nbytes) */ -#define BufAlloc(type, ptr, n) \ +#define BufAlloc(type, ptr, n) do { \ if (dpy->bufptr + (n) > dpy->bufmax) \ _XFlush (dpy); \ ptr = (type) dpy->bufptr; \ memset(ptr, '\0', (size_t)(n)); \ - dpy->bufptr += (n); + dpy->bufptr += (n); \ +} while (0) #define Data16(dpy, data, len) Data((dpy), (_Xconst char *)(data), (len)) #define _XRead16Pad(dpy, data, len) _XReadPad((dpy), (char *)(data), (len)) -- cgit v1.2.3