diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2022-11-20 10:42:59 -0800 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2022-11-20 10:45:08 -0800 |
commit | e8556ab06e03b59e9a512eb02955247efd4c4054 (patch) | |
tree | 3120b029548541fc293308e0b65d1a0bf88b04b0 | |
parent | 67e82cc395f44faddd83ec3d0d21624fe91c6fc0 (diff) |
Wrap Xext*CheckExtension() in do { ... } while(0)
Makes macro expansion safer and eliminates -Wextra-semi-stmt warnings
from clang every time it is called due to semicolon after bracket.
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r-- | include/X11/extensions/extutil.h | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/include/X11/extensions/extutil.h b/include/X11/extensions/extutil.h index b228430..13b6808 100644 --- a/include/X11/extensions/extutil.h +++ b/include/X11/extensions/extutil.h @@ -138,10 +138,12 @@ extern XExtDisplayInfo *XextFindDisplay( ); #define XextHasExtension(i) ((i) && ((i)->codes)) -#define XextCheckExtension(dpy,i,name,val) \ - if (!XextHasExtension(i)) { XMissingExtension (dpy, name); return val; } -#define XextSimpleCheckExtension(dpy,i,name) \ - if (!XextHasExtension(i)) { XMissingExtension (dpy, name); return; } +#define XextCheckExtension(dpy,i,name,val) do { \ + if (!XextHasExtension(i)) { XMissingExtension (dpy, name); return val; } \ +} while (0) +#define XextSimpleCheckExtension(dpy,i,name) do { \ + if (!XextHasExtension(i)) { XMissingExtension (dpy, name); return; } \ +} while (0) /* |