From a79d0cf1c95af7bbb916f2e4baa6d87d5dfcaf40 Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Tue, 9 Jun 2026 13:56:08 +0200 Subject: [PATCH] xfree86: parentheses around macro argument symbols For safety, add extra parantheses on each used macro argument. In most cases not strictly necessary, but better have some strict and automatically enforcable policy here than wasting time on judging individual cases. Signed-off-by: Enrico Weigelt, metux IT consult --- hw/xfree86/common/xf86DGA.c | 6 +- hw/xfree86/common/xf86Helper.c | 4 +- hw/xfree86/common/xf86VGAarbiterPriv.h | 10 +- hw/xfree86/common/xf86Xinput.c | 4 +- hw/xfree86/common/xf86cmap.c | 6 +- hw/xfree86/common/xf86xv.c | 2 +- hw/xfree86/ddc/edid_priv.h | 178 +++++++++--------- hw/xfree86/ddc/print_edid.c | 24 +-- hw/xfree86/drivers/video/modesetting/driver.h | 2 +- .../video/modesetting/drmmode_display.h | 2 +- hw/xfree86/fbdevhw/fbdevhw.c | 2 +- hw/xfree86/fbdevhw/fbpriv.h | 2 +- hw/xfree86/int10/generic.c | 42 ++--- hw/xfree86/int10/vbe.c | 6 +- hw/xfree86/os-support/bsd/i386_video.c | 2 +- hw/xfree86/os-support/int10Defines.h | 8 +- hw/xfree86/os-support/linux/int10/linux.c | 2 +- hw/xfree86/os-support/linux/systemd-logind.h | 2 +- hw/xfree86/os-support/xf86_os_support.h | 4 +- hw/xfree86/parser/Configint.h | 2 +- hw/xfree86/parser/scan.c | 6 +- hw/xfree86/ramdac/xf86HWCurs.c | 6 +- hw/xfree86/vgahw/vgaHW.c | 2 +- hw/xfree86/x86emu/ops2.c | 8 +- hw/xfree86/x86emu/validate.c | 12 +- hw/xfree86/x86emu/x86emu/debug.h | 16 +- hw/xfree86/x86emu/x86emu/decode.h | 8 +- hw/xfree86/x86emu/x86emu/fpu_regs.h | 4 +- hw/xfree86/x86emu/x86emu/regs.h | 2 +- hw/xfree86/x86emu/x86emu/x86emui.h | 2 +- hw/xfree86/xext/vidmode.c | 20 +- 31 files changed, 198 insertions(+), 198 deletions(-) diff --git a/hw/xfree86/common/xf86DGA.c b/hw/xfree86/common/xf86DGA.c index 8c163a0ae5..e88c25aa60 100644 --- a/hw/xfree86/common/xf86DGA.c +++ b/hw/xfree86/common/xf86DGA.c @@ -1145,14 +1145,14 @@ typedef struct { } DGAPrivRec, *DGAPrivPtr; #define DGA_GETCLIENT(idx) ((ClientPtr) \ - dixLookupPrivate(&screenInfo.screens[idx]->devPrivates, DGAScreenPrivateKey)) + dixLookupPrivate(&screenInfo.screens[(idx)]->devPrivates, DGAScreenPrivateKey)) #define DGA_SETCLIENT(idx,p) \ - dixSetPrivate(&screenInfo.screens[idx]->devPrivates, DGAScreenPrivateKey, p) + dixSetPrivate(&screenInfo.screens[(idx)]->devPrivates, DGAScreenPrivateKey, (p)) #define DGA_GETPRIV(c) ((DGAPrivPtr) \ dixLookupPrivate(&(c)->devPrivates, DGAClientPrivateKey)) #define DGA_SETPRIV(c,p) \ - dixSetPrivate(&(c)->devPrivates, DGAClientPrivateKey, p) + dixSetPrivate(&(c)->devPrivates, DGAClientPrivateKey, (p)) static void XDGAResetProc(ExtensionEntry * extEntry) diff --git a/hw/xfree86/common/xf86Helper.c b/hw/xfree86/common/xf86Helper.c index 02518201d4..2e86e00617 100644 --- a/hw/xfree86/common/xf86Helper.c +++ b/hw/xfree86/common/xf86Helper.c @@ -350,8 +350,8 @@ xf86AddPixFormat(ScrnInfoPtr pScrn, int depth, int bpp, int pad) */ /* Can the screen handle 32 bpp pixmaps */ -#define DO_PIX32(f) ((f & Support32bppFb) || \ - ((f & Support24bppFb) && (f & SupportConvert32to24))) +#define DO_PIX32(f) (((f) & Support32bppFb) || \ + (((f) & Support24bppFb) && ((f) & SupportConvert32to24))) #ifndef GLOBAL_DEFAULT_DEPTH #define GLOBAL_DEFAULT_DEPTH 24 diff --git a/hw/xfree86/common/xf86VGAarbiterPriv.h b/hw/xfree86/common/xf86VGAarbiterPriv.h index 5e08f2537b..d0f17f717b 100644 --- a/hw/xfree86/common/xf86VGAarbiterPriv.h +++ b/hw/xfree86/common/xf86VGAarbiterPriv.h @@ -44,7 +44,7 @@ #include "mipointrst.h" #include "picturestr.h" -#define WRAP_SCREEN(x,y) {pScreenPriv->x = pScreen->x; pScreen->x = y;} +#define WRAP_SCREEN(x,y) {pScreenPriv->x = pScreen->x; pScreen->x = (y);} #define UNWRAP_SCREEN(x) pScreen->x = pScreenPriv->x @@ -54,11 +54,11 @@ #define SCREEN_EPILOG(x,y) do { \ SCREEN_PRIV()->x = pScreen->x; \ - pScreen->x = y; \ + pScreen->x = (y); \ } while (0) #define WRAP_PICT(x,y) if (ps) {pScreenPriv->x = ps->x;\ - ps->x = y;} + ps->x = (y);} #define UNWRAP_PICT(x) if (ps) {ps->x = pScreenPriv->x;} @@ -66,9 +66,9 @@ ((VGAarbiterScreenPtr)dixLookupPrivate(&(pScreen)->devPrivates, \ &VGAarbiterScreenKeyRec))->field -#define PICTURE_EPILOGUE(field, wrap) ps->field = wrap +#define PICTURE_EPILOGUE(field, wrap) ps->field = (wrap) -#define WRAP_SCREEN_INFO(x,y) do {pScreenPriv->x = pScrn->x; pScrn->x = y;} while(0) +#define WRAP_SCREEN_INFO(x,y) do {pScreenPriv->x = pScrn->x; pScrn->x = (y);} while(0) #define UNWRAP_SCREEN_INFO(x) pScrn->x = pScreenPriv->x diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c index 7da1845fcb..c8944bbe2a 100644 --- a/hw/xfree86/common/xf86Xinput.c +++ b/hw/xfree86/common/xf86Xinput.c @@ -111,9 +111,9 @@ /* Valuator verification macro */ #define XI_VERIFY_VALUATORS(num_valuators) \ - if (num_valuators > MAX_VALUATORS) { \ + if ((num_valuators) > MAX_VALUATORS) { \ LogMessageVerb(X_ERROR, 1, "%s: num_valuator %d is greater than MAX_VALUATORS\n", \ - __func__, num_valuators); \ + __func__, (num_valuators)); \ return; \ } diff --git a/hw/xfree86/common/xf86cmap.c b/hw/xfree86/common/xf86cmap.c index 86f76f0248..dc8c7cbb9a 100644 --- a/hw/xfree86/common/xf86cmap.c +++ b/hw/xfree86/common/xf86cmap.c @@ -56,12 +56,12 @@ #define SCREEN_PROLOGUE(pScreen, field) ((pScreen)->field = \ ((CMapScreenPtr)dixLookupPrivate(&(pScreen)->devPrivates, CMapScreenKey))->field) #define SCREEN_EPILOGUE(pScreen, field, wrapper)\ - ((pScreen)->field = wrapper) + ((pScreen)->field = (wrapper)) #define LOAD_PALETTE(pmap) \ - ((pmap == GetInstalledmiColormap(pmap->pScreen)) && \ + (((pmap) == GetInstalledmiColormap((pmap)->pScreen)) && \ ((pScreenPriv->flags & CMAP_LOAD_EVEN_IF_OFFSCREEN) || \ - xf86ScreenToScrn(pmap->pScreen)->vtSema || pScreenPriv->isDGAmode)) + xf86ScreenToScrn((pmap)->pScreen)->vtSema || pScreenPriv->isDGAmode)) typedef struct _CMapLink { ColormapPtr cmap; diff --git a/hw/xfree86/common/xf86xv.c b/hw/xfree86/common/xf86xv.c index 28b3d6d46a..8346d900ed 100644 --- a/hw/xfree86/common/xf86xv.c +++ b/hw/xfree86/common/xf86xv.c @@ -115,7 +115,7 @@ static unsigned long PortResource = 0; ((XvScreenPtr)dixLookupPrivate(&(pScreen)->devPrivates, XvGetScreenKey())) #define GET_XF86XV_SCREEN(pScreen) \ - ((XF86XVScreenPtr)(dixGetPrivate(&pScreen->devPrivates, &XF86XVScreenPrivateKey))) + ((XF86XVScreenPtr)(dixGetPrivate(&(pScreen)->devPrivates, &XF86XVScreenPrivateKey))) #define GET_XF86XV_WINDOW(pWin) \ ((XF86XVWindowPtr)dixLookupPrivate(&(pWin)->devPrivates, XF86XVWindowKey)) diff --git a/hw/xfree86/ddc/edid_priv.h b/hw/xfree86/ddc/edid_priv.h index 7b904419ac..cda8b6ade7 100644 --- a/hw/xfree86/ddc/edid_priv.h +++ b/hw/xfree86/ddc/edid_priv.h @@ -84,63 +84,63 @@ #error "EDID1 length != 128!" #endif -#define SECTION(x,y) (uint8_t *)(x + y) -#define GET_ARRAY(y) ((uint8_t *)(c + y)) -#define GET(y) *(uint8_t *)(c + y) +#define SECTION(x,y) (uint8_t *)((x) + (y)) +#define GET_ARRAY(y) ((uint8_t *)(c + (y))) +#define GET(y) *(uint8_t *)(c + (y)) /* extract information from vendor section */ -#define _PROD_ID(x) x[0] + (x[1] << 8); -#define _SERIAL_NO(x) x[0] + (x[1] << 8) + (x[2] << 16) + (x[3] << 24) -#define _YEAR(x) (x & 0xFF) + 1990 -#define _L1(x) ((x[0] & 0x7C) >> 2) + '@' -#define _L2(x) ((x[0] & 0x03) << 3) + ((x[1] & 0xE0) >> 5) + '@' -#define _L3(x) (x[1] & 0x1F) + '@'; +#define _PROD_ID(x) (x)[0] + ((x)[1] << 8); +#define _SERIAL_NO(x) (x)[0] + ((x)[1] << 8) + ((x)[2] << 16) + ((x)[3] << 24) +#define _YEAR(x) ((x) & 0xFF) + 1990 +#define _L1(x) (((x)[0] & 0x7C) >> 2) + '@' +#define _L2(x) (((x)[0] & 0x03) << 3) + (((x)[1] & 0xE0) >> 5) + '@' +#define _L3(x) ((x)[1] & 0x1F) + '@'; /* extract information from display section */ -#define _INPUT_TYPE(x) ((x & 0x80) >> 7) -#define _INPUT_VOLTAGE(x) ((x & 0x60) >> 5) -#define _SETUP(x) ((x & 0x10) >> 4) -#define _SYNC(x) (x & 0x0F) -#define _DFP(x) (x & 0x01) -#define _BPC(x) ((x & 0x70) >> 4) -#define _DIGITAL_INTERFACE(x) (x & 0x0F) -#define _GAMMA(x) (x == 0xff ? 0.0 : ((x + 100.0)/100.0)) -#define _DPMS(x) ((x & 0xE0) >> 5) -#define _DISPLAY_TYPE(x) ((x & 0x18) >> 3) -#define _MSC(x) (x & 0x7) +#define _INPUT_TYPE(x) (((x) & 0x80) >> 7) +#define _INPUT_VOLTAGE(x) (((x) & 0x60) >> 5) +#define _SETUP(x) (((x) & 0x10) >> 4) +#define _SYNC(x) ((x) & 0x0F) +#define _DFP(x) ((x) & 0x01) +#define _BPC(x) (((x) & 0x70) >> 4) +#define _DIGITAL_INTERFACE(x) ((x) & 0x0F) +#define _GAMMA(x) ((x) == 0xff ? 0.0 : (((x) + 100.0)/100.0)) +#define _DPMS(x) (((x) & 0xE0) >> 5) +#define _DISPLAY_TYPE(x) (((x) & 0x18) >> 3) +#define _MSC(x) ((x) & 0x7) /* color characteristics */ -#define CC_L(x,y) ((x & (0x03 << y)) >> y) -#define CC_H(x) (x << 2) -#define I_CC(x,y,z) CC_H(y) | CC_L(x,z) +#define CC_L(x,y) (((x) & (0x03 << (y))) >> (y)) +#define CC_H(x) ((x) << 2) +#define I_CC(x,y,z) CC_H((y)) | CC_L((x),(z)) #define F_CC(x) ((x)/1024.0) /* extract information from established timing section */ -#define _VALID_TIMING(x) !(((x[0] == 0x01) && (x[1] == 0x01)) \ - || ((x[0] == 0x00) && (x[1] == 0x00)) \ - || ((x[0] == 0x20) && (x[1] == 0x20)) ) -#define _HSIZE1(x) ((x[0] + 31) * 8) -#define RATIO(x) ((x[1] & 0xC0) >> 6) +#define _VALID_TIMING(x) !((((x)[0] == 0x01) && ((x)[1] == 0x01)) \ + || (((x)[0] == 0x00) && ((x)[1] == 0x00)) \ + || (((x)[0] == 0x20) && ((x)[1] == 0x20)) ) +#define _HSIZE1(x) (((x)[0] + 31) * 8) +#define RATIO(x) (((x)[1] & 0xC0) >> 6) #define RATIO1_1 0 /* EDID Ver. 1.3 redefined this */ #define RATIO16_10 RATIO1_1 #define RATIO4_3 1 #define RATIO5_4 2 #define RATIO16_9 3 -#define _VSIZE1(x,y,r) switch(RATIO(x)){ \ - case RATIO1_1: y = ((v->version > 1 || v->revision > 2) \ - ? (_HSIZE1(x) * 10) / 16 : _HSIZE1(x)); break; \ - case RATIO4_3: y = _HSIZE1(x) * 3 / 4; break; \ - case RATIO5_4: y = _HSIZE1(x) * 4 / 5; break; \ - case RATIO16_9: y = _HSIZE1(x) * 9 / 16; break; \ +#define _VSIZE1(x,y,r) switch(RATIO((x))){ \ + case RATIO1_1: (y) = ((v->version > 1 || v->revision > 2) \ + ? (_HSIZE1((x)) * 10) / 16 : _HSIZE1((x))); break; \ + case RATIO4_3: (y) = _HSIZE1((x)) * 3 / 4; break; \ + case RATIO5_4: (y) = _HSIZE1((x)) * 4 / 5; break; \ + case RATIO16_9: (y) = _HSIZE1((x)) * 9 / 16; break; \ } -#define _REFRESH_R(x) (x[1] & 0x3F) + 60 -#define _ID_LOW(x) x[0] +#define _REFRESH_R(x) ((x)[1] & 0x3F) + 60 +#define _ID_LOW(x) (x)[0] #define ID_LOW _ID_LOW(c) -#define _ID_HIGH(x) (x[1] << 8) +#define _ID_HIGH(x) ((x)[1] << 8) #define ID_HIGH _ID_HIGH(c) #define STD_TIMING_ID (ID_LOW | ID_HIGH) -#define _NEXT_STD_TIMING(x) (x = (x + STD_TIMING_INFO_LEN)) +#define _NEXT_STD_TIMING(x) ((x) = ((x) + STD_TIMING_INFO_LEN)) /* EDID Ver. >= 1.2 */ /** @@ -150,124 +150,124 @@ * Checking the reserved pad fields for zeroes fails on some monitors with * broken empty ASCII strings. Only the first two bytes are reliable. */ -#define _IS_MONITOR_DESC(x) (x[0] == 0 && x[1] == 0) -#define _PIXEL_CLOCK(x) (x[0] + (x[1] << 8)) * 10000 +#define _IS_MONITOR_DESC(x) ((x)[0] == 0 && (x)[1] == 0) +#define _PIXEL_CLOCK(x) ((x)[0] + ((x)[1] << 8)) * 10000 #define PIXEL_CLOCK _PIXEL_CLOCK(c) -#define _H_ACTIVE(x) (x[2] + ((x[4] & 0xF0) << 4)) +#define _H_ACTIVE(x) ((x)[2] + (((x)[4] & 0xF0) << 4)) #define H_ACTIVE _H_ACTIVE(c) -#define _H_BLANK(x) (x[3] + ((x[4] & 0x0F) << 8)) +#define _H_BLANK(x) ((x)[3] + (((x)[4] & 0x0F) << 8)) #define H_BLANK _H_BLANK(c) -#define _V_ACTIVE(x) (x[5] + ((x[7] & 0xF0) << 4)) +#define _V_ACTIVE(x) ((x)[5] + (((x)[7] & 0xF0) << 4)) #define V_ACTIVE _V_ACTIVE(c) -#define _V_BLANK(x) (x[6] + ((x[7] & 0x0F) << 8)) +#define _V_BLANK(x) ((x)[6] + (((x)[7] & 0x0F) << 8)) #define V_BLANK _V_BLANK(c) -#define _H_SYNC_OFF(x) (x[8] + ((x[11] & 0xC0) << 2)) +#define _H_SYNC_OFF(x) ((x)[8] + (((x)[11] & 0xC0) << 2)) #define H_SYNC_OFF _H_SYNC_OFF(c) -#define _H_SYNC_WIDTH(x) (x[9] + ((x[11] & 0x30) << 4)) +#define _H_SYNC_WIDTH(x) ((x)[9] + (((x)[11] & 0x30) << 4)) #define H_SYNC_WIDTH _H_SYNC_WIDTH(c) -#define _V_SYNC_OFF(x) ((x[10] >> 4) + ((x[11] & 0x0C) << 2)) +#define _V_SYNC_OFF(x) (((x)[10] >> 4) + (((x)[11] & 0x0C) << 2)) #define V_SYNC_OFF _V_SYNC_OFF(c) -#define _V_SYNC_WIDTH(x) ((x[10] & 0x0F) + ((x[11] & 0x03) << 4)) +#define _V_SYNC_WIDTH(x) (((x)[10] & 0x0F) + (((x)[11] & 0x03) << 4)) #define V_SYNC_WIDTH _V_SYNC_WIDTH(c) -#define _H_SIZE(x) (x[12] + ((x[14] & 0xF0) << 4)) +#define _H_SIZE(x) ((x)[12] + (((x)[14] & 0xF0) << 4)) #define H_SIZE _H_SIZE(c) -#define _V_SIZE(x) (x[13] + ((x[14] & 0x0F) << 8)) +#define _V_SIZE(x) ((x)[13] + (((x)[14] & 0x0F) << 8)) #define V_SIZE _V_SIZE(c) -#define _H_BORDER(x) (x[15]) +#define _H_BORDER(x) ((x)[15]) #define H_BORDER _H_BORDER(c) -#define _V_BORDER(x) (x[16]) +#define _V_BORDER(x) ((x)[16]) #define V_BORDER _V_BORDER(c) -#define _INTERLACED(x) ((x[17] & 0x80) >> 7) +#define _INTERLACED(x) (((x)[17] & 0x80) >> 7) #define INTERLACED _INTERLACED(c) -#define _STEREO(x) ((x[17] & 0x60) >> 5) +#define _STEREO(x) (((x)[17] & 0x60) >> 5) #define STEREO _STEREO(c) -#define _STEREO1(x) (x[17] & 0x1) +#define _STEREO1(x) ((x)[17] & 0x1) #define STEREO1 _STEREO(c) -#define _SYNC_T(x) ((x[17] & 0x18) >> 3) +#define _SYNC_T(x) (((x)[17] & 0x18) >> 3) #define SYNC_T _SYNC_T(c) -#define _MISC(x) ((x[17] & 0x06) >> 1) +#define _MISC(x) (((x)[17] & 0x06) >> 1) #define MISC _MISC(c) -#define _MONITOR_DESC_TYPE(x) x[3] +#define _MONITOR_DESC_TYPE(x) (x)[3] #define SERIAL_NUMBER 0xFF #define ASCII_STR 0xFE #define MONITOR_RANGES 0xFD -#define _MIN_V_OFFSET(x) ((!!(x[4] & 0x01)) * 255) -#define _MAX_V_OFFSET(x) ((!!(x[4] & 0x02)) * 255) -#define _MIN_H_OFFSET(x) ((!!(x[4] & 0x04)) * 255) -#define _MAX_H_OFFSET(x) ((!!(x[4] & 0x08)) * 255) -#define _MIN_V(x) x[5] +#define _MIN_V_OFFSET(x) ((!!((x)[4] & 0x01)) * 255) +#define _MAX_V_OFFSET(x) ((!!((x)[4] & 0x02)) * 255) +#define _MIN_H_OFFSET(x) ((!!((x)[4] & 0x04)) * 255) +#define _MAX_H_OFFSET(x) ((!!((x)[4] & 0x08)) * 255) +#define _MIN_V(x) (x)[5] #define MIN_V (_MIN_V(c) + _MIN_V_OFFSET(c)) -#define _MAX_V(x) x[6] +#define _MAX_V(x) (x)[6] #define MAX_V (_MAX_V(c) + _MAX_V_OFFSET(c)) -#define _MIN_H(x) x[7] +#define _MIN_H(x) (x)[7] #define MIN_H (_MIN_H(c) + _MIN_H_OFFSET(c)) -#define _MAX_H(x) x[8] +#define _MAX_H(x) (x)[8] #define MAX_H (_MAX_H(c) + _MAX_H_OFFSET(c)) -#define _MAX_CLOCK(x) x[9] +#define _MAX_CLOCK(x) (x)[9] #define MAX_CLOCK _MAX_CLOCK(c) -#define _HAVE_2ND_GTF(x) (x[10] == 0x02) +#define _HAVE_2ND_GTF(x) ((x)[10] == 0x02) #define HAVE_2ND_GTF _HAVE_2ND_GTF(c) -#define _F_2ND_GTF(x) (x[12] * 2) +#define _F_2ND_GTF(x) ((x)[12] * 2) #define F_2ND_GTF _F_2ND_GTF(c) -#define _C_2ND_GTF(x) (x[13] / 2) +#define _C_2ND_GTF(x) ((x)[13] / 2) #define C_2ND_GTF _C_2ND_GTF(c) -#define _M_2ND_GTF(x) (x[14] + (x[15] << 8)) +#define _M_2ND_GTF(x) ((x)[14] + ((x)[15] << 8)) #define M_2ND_GTF _M_2ND_GTF(c) -#define _K_2ND_GTF(x) (x[16]) +#define _K_2ND_GTF(x) ((x)[16]) #define K_2ND_GTF _K_2ND_GTF(c) -#define _J_2ND_GTF(x) (x[17] / 2) +#define _J_2ND_GTF(x) ((x)[17] / 2) #define J_2ND_GTF _J_2ND_GTF(c) -#define _HAVE_CVT(x) (x[10] == 0x04) +#define _HAVE_CVT(x) ((x)[10] == 0x04) #define HAVE_CVT _HAVE_CVT(c) -#define _MAX_CLOCK_KHZ(x) (x[12] >> 2) +#define _MAX_CLOCK_KHZ(x) ((x)[12] >> 2) #define MAX_CLOCK_KHZ (MAX_CLOCK * 10000) - (_MAX_CLOCK_KHZ(c) * 250) -#define _MAXWIDTH(x) ((x[13] == 0 ? 0 : x[13] + ((x[12] & 0x03) << 8)) * 8) +#define _MAXWIDTH(x) (((x)[13] == 0 ? 0 : (x)[13] + (((x)[12] & 0x03) << 8)) * 8) #define MAXWIDTH _MAXWIDTH(c) -#define _SUPPORTED_ASPECT(x) x[14] +#define _SUPPORTED_ASPECT(x) (x)[14] #define SUPPORTED_ASPECT _SUPPORTED_ASPECT(c) #define SUPPORTED_ASPECT_4_3 0x80 #define SUPPORTED_ASPECT_16_9 0x40 #define SUPPORTED_ASPECT_16_10 0x20 #define SUPPORTED_ASPECT_5_4 0x10 #define SUPPORTED_ASPECT_15_9 0x08 -#define _PREFERRED_ASPECT(x) ((x[15] & 0xe0) >> 5) +#define _PREFERRED_ASPECT(x) (((x)[15] & 0xe0) >> 5) #define PREFERRED_ASPECT _PREFERRED_ASPECT(c) #define PREFERRED_ASPECT_4_3 0 #define PREFERRED_ASPECT_16_9 1 #define PREFERRED_ASPECT_16_10 2 #define PREFERRED_ASPECT_5_4 3 #define PREFERRED_ASPECT_15_9 4 -#define _SUPPORTED_BLANKING(x) ((x[15] & 0x18) >> 3) +#define _SUPPORTED_BLANKING(x) (((x)[15] & 0x18) >> 3) #define SUPPORTED_BLANKING _SUPPORTED_BLANKING(c) #define CVT_STANDARD 0x01 #define CVT_REDUCED 0x02 -#define _SUPPORTED_SCALING(x) ((x[16] & 0xf0) >> 4) +#define _SUPPORTED_SCALING(x) (((x)[16] & 0xf0) >> 4) #define SUPPORTED_SCALING _SUPPORTED_SCALING(c) #define SCALING_HSHRINK 0x08 #define SCALING_HSTRETCH 0x04 #define SCALING_VSHRINK 0x02 #define SCALING_VSTRETCH 0x01 -#define _PREFERRED_REFRESH(x) x[17] +#define _PREFERRED_REFRESH(x) (x)[17] #define PREFERRED_REFRESH _PREFERRED_REFRESH(c) #define MONITOR_NAME 0xFC #define ADD_COLOR_POINT 0xFB #define WHITEX F_CC(I_CC((GET(D_BW_LOW)),(GET(D_WHITEX)),2)) #define WHITEY F_CC(I_CC((GET(D_BW_LOW)),(GET(D_WHITEY)),0)) -#define _WHITEX_ADD(x,y) F_CC(I_CC(((*(x + y))),(*(x + y + 1)),2)) -#define _WHITEY_ADD(x,y) F_CC(I_CC(((*(x + y))),(*(x + y + 2)),0)) -#define _WHITE_INDEX1(x) x[5] +#define _WHITEX_ADD(x,y) F_CC(I_CC(((*((x) + (y)))),(*((x) + (y) + 1)),2)) +#define _WHITEY_ADD(x,y) F_CC(I_CC(((*((x) + (y)))),(*((x) + (y) + 2)),0)) +#define _WHITE_INDEX1(x) (x)[5] #define WHITE_INDEX1 _WHITE_INDEX1(c) -#define _WHITE_INDEX2(x) x[10] +#define _WHITE_INDEX2(x) (x)[10] #define WHITE_INDEX2 _WHITE_INDEX2(c) #define WHITEX1 _WHITEX_ADD(c,6) #define WHITEY1 _WHITEY_ADD(c,6) #define WHITEX2 _WHITEX_ADD(c,12) #define WHITEY2 _WHITEY_ADD(c,12) -#define _WHITE_GAMMA1(x) _GAMMA(x[9]) +#define _WHITE_GAMMA1(x) _GAMMA((x)[9]) #define WHITE_GAMMA1 _WHITE_GAMMA1(c) -#define _WHITE_GAMMA2(x) _GAMMA(x[14]) +#define _WHITE_GAMMA2(x) _GAMMA((x)[14]) #define WHITE_GAMMA2 _WHITE_GAMMA2(c) #define ADD_STD_TIMINGS 0xFA #define COLOR_MANAGEMENT_DATA 0xF9 @@ -275,10 +275,10 @@ #define ADD_EST_TIMINGS 0xF7 #define ADD_DUMMY 0x10 -#define _NEXT_DT_MD_SECTION(x) (x = (x + DET_TIMING_INFO_LEN)) +#define _NEXT_DT_MD_SECTION(x) ((x) = ((x) + DET_TIMING_INFO_LEN)) /* Msc stuff EDID Ver > 1.1 */ -#define CVT_SUPPORTED(x) (x & 0x1) +#define CVT_SUPPORTED(x) ((x) & 0x1) struct cea_speaker_block { uint8_t FLR:1; diff --git a/hw/xfree86/ddc/print_edid.c b/hw/xfree86/ddc/print_edid.c index 5503dbcd1c..5ea613b699 100644 --- a/hw/xfree86/ddc/print_edid.c +++ b/hw/xfree86/ddc/print_edid.c @@ -42,9 +42,9 @@ #define DISP_YCRCB422 0x02 /* DPMS features */ -#define DPMS_STANDBY(x) (x & 0x04) -#define DPMS_SUSPEND(x) (x & 0x02) -#define DPMS_OFF(x) (x & 0x01) +#define DPMS_STANDBY(x) ((x) & 0x04) +#define DPMS_SUSPEND(x) ((x) & 0x02) +#define DPMS_OFF(x) ((x) & 0x01) /* input voltage level */ #define V070 0 /* 0.700V/0.300V */ @@ -52,21 +52,21 @@ #define V100 2 /* 1.000V/0.400V */ #define V007 3 /* 0.700V/0.000V */ -#define STD_COLOR_SPACE(x) (x & 0x4) -#define GFT_SUPPORTED(x) (x & 0x1) +#define STD_COLOR_SPACE(x) ((x) & 0x4) +#define GFT_SUPPORTED(x) ((x) & 0x1) #define EDID_WIDTH 16 /* detailed timing misc */ -#define IS_RIGHT_STEREO(x) (x & 0x01) -#define IS_LEFT_STEREO(x) (x & 0x02) -#define IS_4WAY_STEREO(x) (x & 0x03) +#define IS_RIGHT_STEREO(x) ((x) & 0x01) +#define IS_LEFT_STEREO(x) ((x) & 0x02) +#define IS_4WAY_STEREO(x) ((x) & 0x03) /* sync characteristics */ -#define SEP_SYNC(x) (x & 0x08) -#define COMP_SYNC(x) (x & 0x04) -#define SYNC_O_GREEN(x) (x & 0x02) -#define SYNC_SERR(x) (x & 0x01) +#define SEP_SYNC(x) ((x) & 0x08) +#define COMP_SYNC(x) ((x) & 0x04) +#define SYNC_O_GREEN(x) ((x) & 0x02) +#define SYNC_SERR(x) ((x) & 0x01) static void print_vendor(int scrnIndex, struct vendor *c) diff --git a/hw/xfree86/drivers/video/modesetting/driver.h b/hw/xfree86/drivers/video/modesetting/driver.h index 5d5df81811..79e68b339a 100644 --- a/hw/xfree86/drivers/video/modesetting/driver.h +++ b/hw/xfree86/drivers/video/modesetting/driver.h @@ -192,7 +192,7 @@ typedef struct _modesettingRec { #endif } modesettingRec, *modesettingPtr; -#define glamor_finish(screen) ms->glamor.finish(screen) +#define glamor_finish(screen) ms->glamor.finish((screen)) #define modesettingPTR(p) ((modesettingPtr)((p)->driverPrivate)) modesettingEntPtr ms_ent_priv(ScrnInfoPtr scrn); diff --git a/hw/xfree86/drivers/video/modesetting/drmmode_display.h b/hw/xfree86/drivers/video/modesetting/drmmode_display.h index 1168f049e8..b91bea12f3 100644 --- a/hw/xfree86/drivers/video/modesetting/drmmode_display.h +++ b/hw/xfree86/drivers/video/modesetting/drmmode_display.h @@ -310,7 +310,7 @@ typedef struct _msSpritePriv { Bool sprite_visible; } msSpritePrivRec, *msSpritePrivPtr; -#define msGetSpritePriv(dev, ms, screen) dixLookupScreenPrivate(&(dev)->devPrivates, &(ms)->drmmode.spritePrivateKeyRec, screen) +#define msGetSpritePriv(dev, ms, screen) dixLookupScreenPrivate(&(dev)->devPrivates, &(ms)->drmmode.spritePrivateKeyRec, (screen)) extern miPointerSpriteFuncRec drmmode_sprite_funcs; diff --git a/hw/xfree86/fbdevhw/fbdevhw.c b/hw/xfree86/fbdevhw/fbdevhw.c index df715beebd..2487a83614 100644 --- a/hw/xfree86/fbdevhw/fbdevhw.c +++ b/hw/xfree86/fbdevhw/fbdevhw.c @@ -56,7 +56,7 @@ _X_EXPORT XF86ModuleData fbdevhwModuleData = { /* our private data, and two functions to allocate/free this */ #define FBDEVHWPTRLVAL(p) (p)->privates[fbdevHWPrivateIndex].ptr -#define FBDEVHWPTR(p) ((fbdevHWPtr)(FBDEVHWPTRLVAL(p))) +#define FBDEVHWPTR(p) ((fbdevHWPtr)(FBDEVHWPTRLVAL((p)))) static int fbdevHWPrivateIndex = -1; diff --git a/hw/xfree86/fbdevhw/fbpriv.h b/hw/xfree86/fbdevhw/fbpriv.h index aca3ef7b10..f21f70a52d 100644 --- a/hw/xfree86/fbdevhw/fbpriv.h +++ b/hw/xfree86/fbdevhw/fbpriv.h @@ -17,7 +17,7 @@ #define FB_MODES_SHIFT 5 /* 32 modes per framebuffer */ #define FB_NUM_MINORS 256 /* 256 Minors */ #define FB_MAX (FB_NUM_MINORS / (1 << FB_MODES_SHIFT)) -#define GET_FB_IDX(node) (MINOR(node) >> FB_MODES_SHIFT) +#define GET_FB_IDX(node) (MINOR((node)) >> FB_MODES_SHIFT) /* ioctls 0x46 is 'F' */ diff --git a/hw/xfree86/int10/generic.c b/hw/xfree86/int10/generic.c index c37cb54aca..a2f1d299e9 100644 --- a/hw/xfree86/int10/generic.c +++ b/hw/xfree86/int10/generic.c @@ -18,7 +18,7 @@ #include "int10Defines.h" #include "Pci.h" -#define ALLOC_ENTRIES(x) ((V_RAM / x) - 1) +#define ALLOC_ENTRIES(x) ((V_RAM / (x)) - 1) #include /* needed for memmove */ @@ -78,7 +78,7 @@ typedef struct { char *alloc; } genericInt10Priv; -#define INTPriv(x) ((genericInt10Priv*)x->private) +#define INTPriv(x) ((genericInt10Priv*)(x)->private) int10MemRec genericMem = { read_b, @@ -382,38 +382,38 @@ xf86Int10FreePages(xf86Int10InfoPtr pInt, void *pbase, int num) #endif #define SYS(addr) ((addr) >= HIGH_OFFSET) #define V_ADDR(addr) \ - (SYS(addr) ? ((char*)INTPriv(pInt)->sysMem) + (addr - HIGH_BASE) \ - : (((char*)(INTPriv(pInt)->base) + addr))) -#define VRAM_ADDR(addr) (addr - V_RAM) + (SYS((addr)) ? ((char*)INTPriv(pInt)->sysMem) + ((addr) - HIGH_BASE) \ + : (((char*)(INTPriv(pInt)->base) + (addr)))) +#define VRAM_ADDR(addr) ((addr) - V_RAM) #define VRAM_BASE (INTPriv(pInt)->vRam) -#define VRAM(addr) ((addr >= V_RAM) && (addr < (V_RAM + VRAM_SIZE))) +#define VRAM(addr) (((addr) >= V_RAM) && ((addr) < (V_RAM + VRAM_SIZE))) #define V_ADDR_RB(addr) \ - ((VRAM(addr)) ? MMIO_IN8((uint8_t*)VRAM_BASE,VRAM_ADDR(addr)) \ - : *(uint8_t*) V_ADDR(addr)) + ((VRAM((addr))) ? MMIO_IN8((uint8_t*)VRAM_BASE,VRAM_ADDR((addr))) \ + : *(uint8_t*) V_ADDR((addr))) #define V_ADDR_RW(addr) \ - ((VRAM(addr)) ? MMIO_IN16((uint16_t*)VRAM_BASE,VRAM_ADDR(addr)) \ - : ldw_u((void *)V_ADDR(addr))) + ((VRAM((addr))) ? MMIO_IN16((uint16_t*)VRAM_BASE,VRAM_ADDR((addr))) \ + : ldw_u((void *)V_ADDR((addr)))) #define V_ADDR_RL(addr) \ - ((VRAM(addr)) ? MMIO_IN32((uint32_t*)VRAM_BASE,VRAM_ADDR(addr)) \ - : ldl_u((void *)V_ADDR(addr))) + ((VRAM((addr))) ? MMIO_IN32((uint32_t*)VRAM_BASE,VRAM_ADDR((addr))) \ + : ldl_u((void *)V_ADDR((addr)))) #define V_ADDR_WB(addr,val) \ - if(VRAM(addr)) \ - MMIO_OUT8((uint8_t*)VRAM_BASE,VRAM_ADDR(addr),val); \ + if(VRAM((addr))) \ + MMIO_OUT8((uint8_t*)VRAM_BASE,VRAM_ADDR((addr)),(val)); \ else \ - *(uint8_t*) V_ADDR(addr) = val; + *(uint8_t*) V_ADDR((addr)) = (val); #define V_ADDR_WW(addr,val) \ - if(VRAM(addr)) \ - MMIO_OUT16((uint16_t*)VRAM_BASE,VRAM_ADDR(addr),val); \ + if(VRAM((addr))) \ + MMIO_OUT16((uint16_t*)VRAM_BASE,VRAM_ADDR((addr)),(val)); \ else \ - stw_u((val),(void *)(V_ADDR(addr))); + stw_u((val),(void *)(V_ADDR((addr)))); #define V_ADDR_WL(addr,val) \ - if (VRAM(addr)) \ - MMIO_OUT32((uint32_t*)VRAM_BASE,VRAM_ADDR(addr),val); \ + if (VRAM((addr))) \ + MMIO_OUT32((uint32_t*)VRAM_BASE,VRAM_ADDR((addr)),(val)); \ else \ - stl_u(val,(void *)(V_ADDR(addr))); + stl_u((val),(void *)(V_ADDR((addr)))); static uint8_t read_b(xf86Int10InfoPtr pInt, int addr) diff --git a/hw/xfree86/int10/vbe.c b/hw/xfree86/int10/vbe.c index 4cff858e61..283acbe1ad 100644 --- a/hw/xfree86/int10/vbe.c +++ b/hw/xfree86/int10/vbe.c @@ -18,7 +18,7 @@ #include "vbe.h" #include "xf86Bus.h" -#define VERSION(x) VBE_VERSION_MAJOR(x),VBE_VERSION_MINOR(x) +#define VERSION(x) VBE_VERSION_MAJOR((x)),VBE_VERSION_MINOR((x)) #if X_BYTE_ORDER == X_LITTLE_ENDIAN #define B_O16(x) (x) @@ -28,9 +28,9 @@ #define B_O32(x) ((((x) & 0xff) << 24) | (((x) & 0xff00) << 8) \ | (((x) & 0xff0000) >> 8) | (((x) & 0xff000000) >> 24)) #endif -#define L_ADD(x) (B_O32(x) & 0xffff) + ((B_O32(x) >> 12) & 0xffff00) +#define L_ADD(x) (B_O32((x)) & 0xffff) + ((B_O32((x)) >> 12) & 0xffff00) -#define FARP(p) (((unsigned)(p & 0xffff0000) >> 12) | (p & 0xffff)) +#define FARP(p) (((unsigned)((p) & 0xffff0000) >> 12) | ((p) & 0xffff)) #define R16(v) ((v) & 0xffff) static unsigned char *vbeReadEDID(vbeInfoPtr pVbe); diff --git a/hw/xfree86/os-support/bsd/i386_video.c b/hw/xfree86/os-support/bsd/i386_video.c index f7024b2077..4bd939af26 100644 --- a/hw/xfree86/os-support/bsd/i386_video.c +++ b/hw/xfree86/os-support/bsd/i386_video.c @@ -193,7 +193,7 @@ xf86DisableIO(void) #ifdef USE_AMD64_IOPL #ifdef __NetBSD__ -#define amd64_iopl(x) x86_64_iopl(x) +#define amd64_iopl(x) x86_64_iopl((x)) #endif /***************************************************************************/ /* I/O Permissions section */ diff --git a/hw/xfree86/os-support/int10Defines.h b/hw/xfree86/os-support/int10Defines.h index 8ada6ea249..29656858db 100644 --- a/hw/xfree86/os-support/int10Defines.h +++ b/hw/xfree86/os-support/int10Defines.h @@ -33,10 +33,10 @@ #include #define CPU_R(type,name,num) \ - (((type *)&(((struct vm86_struct *)REG->cpuRegs)->regs.name))[num]) -#define CPU_RD(name,num) CPU_R(CARD32,name,num) -#define CPU_RW(name,num) CPU_R(CARD16,name,num) -#define CPU_RB(name,num) CPU_R(CARD8,name,num) + (((type *)&(((struct vm86_struct *)REG->cpuRegs)->regs.name))[(num)]) +#define CPU_RD(name,num) CPU_R(CARD32,(name),(num)) +#define CPU_RW(name,num) CPU_R(CARD16,(name),(num)) +#define CPU_RB(name,num) CPU_R(CARD8,(name),(num)) #define X86_EAX CPU_RD(eax,0) #define X86_EBX CPU_RD(ebx,0) diff --git a/hw/xfree86/os-support/linux/int10/linux.c b/hw/xfree86/os-support/linux/int10/linux.c index baeea01a94..b221f35b27 100644 --- a/hw/xfree86/os-support/linux/int10/linux.c +++ b/hw/xfree86/os-support/linux/int10/linux.c @@ -15,7 +15,7 @@ #else #define DEV_MEM "/dev/mem" #endif -#define ALLOC_ENTRIES(x) ((V_RAM / x) - 1) +#define ALLOC_ENTRIES(x) ((V_RAM / (x)) - 1) #define SHMERRORPTR (void *)(-1) #include diff --git a/hw/xfree86/os-support/linux/systemd-logind.h b/hw/xfree86/os-support/linux/systemd-logind.h index 5c04d0130a..b6316d4ca1 100644 --- a/hw/xfree86/os-support/linux/systemd-logind.h +++ b/hw/xfree86/os-support/linux/systemd-logind.h @@ -38,7 +38,7 @@ void systemd_logind_drop_master(void); #define systemd_logind_init() #define systemd_logind_fini() #define systemd_logind_take_fd(major, minor, path, paus) -1 -#define systemd_logind_release_fd(major, minor, fd) close(fd) +#define systemd_logind_release_fd(major, minor, fd) close((fd)) #define systemd_logind_controls_session() 0 #define systemd_logind_vtenter() #define systemd_logind_drop_master() diff --git a/hw/xfree86/os-support/xf86_os_support.h b/hw/xfree86/os-support/xf86_os_support.h index e6c573d0e8..93001ed078 100644 --- a/hw/xfree86/os-support/xf86_os_support.h +++ b/hw/xfree86/os-support/xf86_os_support.h @@ -21,10 +21,10 @@ #define xf86FatalError(a, b) \ if (dispatchException & DE_TERMINATE) { \ - ErrorF(a, b); \ + ErrorF((a), (b)); \ ErrorF("\n"); \ return; \ - } else FatalError(a, b) + } else FatalError((a), (b)) typedef void (*PMClose) (void); diff --git a/hw/xfree86/parser/Configint.h b/hw/xfree86/parser/Configint.h index d42a4fd0e7..2f2288d27d 100644 --- a/hw/xfree86/parser/Configint.h +++ b/hw/xfree86/parser/Configint.h @@ -89,7 +89,7 @@ extern LexRec xf86_lex_val; #include "configProcs.h" #include -#define TestFree(a) if (a) { free ((void *) a); a = NULL; } +#define TestFree(a) if (a) { free ((void *) (a)); (a) = NULL; } #define parsePrologue(typeptr,typerec) typeptr ptr; \ if( (ptr=calloc(1,sizeof(typerec))) == NULL ) { return NULL; } diff --git a/hw/xfree86/parser/scan.c b/hw/xfree86/parser/scan.c index a7deba46d0..533ebdc718 100644 --- a/hw/xfree86/parser/scan.c +++ b/hw/xfree86/parser/scan.c @@ -551,11 +551,11 @@ xf86pathIsSafe(const char *path) } while (0) #define APPEND_STR(s) do { \ - if (strlen(s) + l > PATH_MAX) { \ + if (strlen((s)) + l > PATH_MAX) { \ BAIL_OUT; \ } else { \ - strcpy(result + l, s); \ - l += strlen(s); \ + strcpy(result + l, (s)); \ + l += strlen((s)); \ } \ } while (0) diff --git a/hw/xfree86/ramdac/xf86HWCurs.c b/hw/xfree86/ramdac/xf86HWCurs.c index bd780a2124..927c68c736 100644 --- a/hw/xfree86/ramdac/xf86HWCurs.c +++ b/hw/xfree86/ramdac/xf86HWCurs.c @@ -38,12 +38,12 @@ xf86ReverseBitOrder(CARD32 v) #define SCANLINE CARD32 #define CUR_BITMAP_SCANLINE_PAD 32 #define CUR_LOG2_BITMAP_PAD 5 -#define REVERSE_BIT_ORDER(w) xf86ReverseBitOrder(w) +#define REVERSE_BIT_ORDER(w) xf86ReverseBitOrder((w)) #else #define SCANLINE CARD64 #define CUR_BITMAP_SCANLINE_PAD BITMAP_SCANLINE_PAD #define CUR_LOG2_BITMAP_PAD LOG2_BITMAP_PAD -#define REVERSE_BIT_ORDER(w) xf86CARD64ReverseBits(w) +#define REVERSE_BIT_ORDER(w) xf86CARD64ReverseBits((w)) static CARD64 xf86CARD64ReverseBits(CARD64 w); static CARD64 @@ -69,7 +69,7 @@ xf86CARD64ReverseBits(CARD64 w) #define SCANLINE CARD32 #define CUR_BITMAP_SCANLINE_PAD BITMAP_SCANLINE_PAD #define CUR_LOG2_BITMAP_PAD LOG2_BITMAP_PAD -#define REVERSE_BIT_ORDER(w) xf86ReverseBitOrder(w) +#define REVERSE_BIT_ORDER(w) xf86ReverseBitOrder((w)) #endif /* BITMAP_SCANLINE_PAD == 64 */ diff --git a/hw/xfree86/vgahw/vgaHW.c b/hw/xfree86/vgahw/vgaHW.c index eddfe5df13..58bac96118 100644 --- a/hw/xfree86/vgahw/vgaHW.c +++ b/hw/xfree86/vgahw/vgaHW.c @@ -73,7 +73,7 @@ /* Use a private definition of this here */ #undef VGAHWPTR #define VGAHWPTRLVAL(p) (p)->privates[vgaHWPrivateIndex].ptr -#define VGAHWPTR(p) ((vgaHWPtr)(VGAHWPTRLVAL(p))) +#define VGAHWPTR(p) ((vgaHWPtr)(VGAHWPTRLVAL((p)))) static int vgaHWPrivateIndex = -1; diff --git a/hw/xfree86/x86emu/ops2.c b/hw/xfree86/x86emu/ops2.c index 848dc51971..374a61eaee 100644 --- a/hw/xfree86/x86emu/ops2.c +++ b/hw/xfree86/x86emu/ops2.c @@ -43,10 +43,10 @@ #include "x86emu/x86emui.h" #undef bswap_32 -#define bswap_32(x) (((x & 0xff000000) >> 24) | \ - ((x & 0x00ff0000) >> 8) | \ - ((x & 0x0000ff00) << 8) | \ - ((x & 0x000000ff) << 24)) +#define bswap_32(x) ((((x) & 0xff000000) >> 24) | \ + (((x) & 0x00ff0000) >> 8) | \ + (((x) & 0x0000ff00) << 8) | \ + (((x) & 0x000000ff) << 24)) /*----------------------------- Implementation ----------------------------*/ diff --git a/hw/xfree86/x86emu/validate.c b/hw/xfree86/x86emu/validate.c index 4c36e1df51..7388bf1085 100644 --- a/hw/xfree86/x86emu/validate.c +++ b/hw/xfree86/x86emu/validate.c @@ -62,8 +62,8 @@ ulong flags,inflags; \ int f,failed = false; \ char buf1[80],buf2[80]; \ - for (d = 0; d < dmax; d += dincr) { \ - for (s = 0; s < smax; s += sincr) { \ + for (d = 0; d < (dmax); d += (dincr)) { \ + for (s = 0; s < (smax); s += (sincr)) { \ M.x86.R_EFLG = inflags = flags = def_flags; \ for (f = 0; f < 2; f++) { @@ -193,9 +193,9 @@ u32 flags,inflags; \ int f,failed = false; \ char buf1[80],buf2[80]; \ - for (d = 0; d < dmax; d += dincr) { \ - for (s = 0; s < smax; s += sincr) { \ - for (shift = 0; shift < maxshift; shift += 1) { \ + for (d = 0; d < (dmax); d += (dincr)) { \ + for (s = 0; s < (smax); s += (sincr)) { \ + for (shift = 0; shift < (maxshift); shift += 1) { \ M.x86.R_EFLG = inflags = flags = def_flags; \ for (f = 0; f < 2; f++) { @@ -261,7 +261,7 @@ u32 flags,inflags; \ int f,failed = false; \ char buf1[80],buf2[80]; \ - for (d = 0; d < max; d += incr) { \ + for (d = 0; d < (max); d += (incr)) { \ M.x86.R_EFLG = inflags = flags = def_flags; \ for (f = 0; f < 2; f++) { diff --git a/hw/xfree86/x86emu/x86emu/debug.h b/hw/xfree86/x86emu/x86emu/debug.h index 98d85e9b95..ead5362a35 100644 --- a/hw/xfree86/x86emu/x86emu/debug.h +++ b/hw/xfree86/x86emu/x86emu/debug.h @@ -104,9 +104,9 @@ #ifdef DEBUG #define DECODE_PRINTF(x) if (DEBUG_DECODE()) \ - x86emu_decode_printf("%s",x) + x86emu_decode_printf("%s",(x)) #define DECODE_PRINTF2(x,y) if (DEBUG_DECODE()) \ - x86emu_decode_printf(x,y) + x86emu_decode_printf((x),(y)) /* * The following allows us to look at the bytes of an instruction. The @@ -116,13 +116,13 @@ */ #define INC_DECODED_INST_LEN(x) \ if (DEBUG_DECODE()) \ - x86emu_inc_decoded_inst_len(x) + x86emu_inc_decoded_inst_len((x)) #define SAVE_IP_CS(x,y) \ if (DEBUG_DECODE() | DEBUG_TRACECALL() | DEBUG_BREAK() \ | DEBUG_IO_TRACE() | DEBUG_SAVE_IP_CS()) { \ - M.x86.saved_cs = x; \ - M.x86.saved_ip = y; \ + M.x86.saved_cs = (x); \ + M.x86.saved_ip = (y); \ } #else #define INC_DECODED_INST_LEN(x) @@ -167,19 +167,19 @@ if (DEBUG_TRACECALLREGS()) \ x86emu_dump_regs(); \ if (DEBUG_TRACECALL()) \ - printk("%04x:%04x: CALL %s%04x:%04x\n", u , v, s, w, x); + printk("%04x:%04x: CALL %s%04x:%04x\n", (u) , (v), (s), (w), (x)); #define RETURN_TRACE(n,u,v) \ if (DEBUG_TRACECALLREGS()) \ x86emu_dump_regs(); \ if (DEBUG_TRACECALL()) \ - printk("%04x:%04x: %s\n",u,v,n); + printk("%04x:%04x: %s\n",(u),(v),(n)); #else #define CALL_TRACE(u,v,w,x,s) #define RETURN_TRACE(n,u,v) #endif #ifdef DEBUG -#define DB(x) x +#define DB(x) (x) #else #define DB(x) #endif diff --git a/hw/xfree86/x86emu/x86emu/decode.h b/hw/xfree86/x86emu/x86emu/decode.h index 49a1f7b540..2a9bace814 100644 --- a/hw/xfree86/x86emu/x86emu/decode.h +++ b/hw/xfree86/x86emu/x86emu/decode.h @@ -43,10 +43,10 @@ /* Instruction Decoding Stuff */ -#define FETCH_DECODE_MODRM(mod,rh,rl) fetch_decode_modrm(&mod,&rh,&rl) -#define DECODE_RM_BYTE_REGISTER(r) decode_rm_byte_register(r) -#define DECODE_RM_WORD_REGISTER(r) decode_rm_word_register(r) -#define DECODE_RM_LONG_REGISTER(r) decode_rm_long_register(r) +#define FETCH_DECODE_MODRM(mod,rh,rl) fetch_decode_modrm(&(mod),&(rh),&(rl)) +#define DECODE_RM_BYTE_REGISTER(r) decode_rm_byte_register((r)) +#define DECODE_RM_WORD_REGISTER(r) decode_rm_word_register((r)) +#define DECODE_RM_LONG_REGISTER(r) decode_rm_long_register((r)) #define DECODE_CLEAR_SEGOVR() M.x86.mode &= ~SYSMODE_CLRMASK /*-------------------------- Function Prototypes --------------------------*/ diff --git a/hw/xfree86/x86emu/x86emu/fpu_regs.h b/hw/xfree86/x86emu/x86emu/fpu_regs.h index 5a780e69c0..47825a13f7 100644 --- a/hw/xfree86/x86emu/x86emu/fpu_regs.h +++ b/hw/xfree86/x86emu/x86emu/fpu_regs.h @@ -108,9 +108,9 @@ struct x86_fpu_registers { #ifdef DEBUG #define DECODE_PRINTINSTR32(t,mod,rh,rl) \ - DECODE_PRINTF(t[(mod<<3)+(rh)]); + DECODE_PRINTF((t)[((mod)<<3)+(rh)]); #define DECODE_PRINTINSTR256(t,mod,rh,rl) \ - DECODE_PRINTF(t[(mod<<6)+(rh<<3)+(rl)]); + DECODE_PRINTF((t)[((mod)<<6)+((rh)<<3)+(rl)]); #else #define DECODE_PRINTINSTR32(t,mod,rh,rl) #define DECODE_PRINTINSTR256(t,mod,rh,rl) diff --git a/hw/xfree86/x86emu/x86emu/regs.h b/hw/xfree86/x86emu/x86emu/regs.h index 7c649755e9..65ba74b74a 100644 --- a/hw/xfree86/x86emu/x86emu/regs.h +++ b/hw/xfree86/x86emu/x86emu/regs.h @@ -203,7 +203,7 @@ struct i386_segment_regs { #define CLEARALL_FLAG(m) (M.x86.R_FLG = 0) #define CONDITIONAL_SET_FLAG(COND,FLAG) \ - if (COND) SET_FLAG(FLAG); else CLEAR_FLAG(FLAG) + if (COND) SET_FLAG((FLAG)); else CLEAR_FLAG((FLAG)) #define F_PF_CALC 0x010000 /* PARITY flag has been calced */ #define F_ZF_CALC 0x020000 /* ZERO flag has been calced */ diff --git a/hw/xfree86/x86emu/x86emu/x86emui.h b/hw/xfree86/x86emu/x86emu/x86emui.h index 1d1decc4cc..4cbae54e40 100644 --- a/hw/xfree86/x86emu/x86emu/x86emui.h +++ b/hw/xfree86/x86emu/x86emu/x86emui.h @@ -57,7 +57,7 @@ #ifdef __cplusplus #define X86EMU_UNUSED(v) #else -#define X86EMU_UNUSED(v) v +#define X86EMU_UNUSED(v) (v) #endif #include "x86emu.h" diff --git a/hw/xfree86/xext/vidmode.c b/hw/xfree86/xext/vidmode.c index becd898985..e52407ae4e 100644 --- a/hw/xfree86/xext/vidmode.c +++ b/hw/xfree86/xext/vidmode.c @@ -71,7 +71,7 @@ typedef struct { #define VM_GETPRIV(c) ((VidModePrivPtr) \ dixLookupPrivate(&(c)->devPrivates, VidModeClientPrivateKey)) #define VM_SETPRIV(c,p) \ - dixSetPrivate(&(c)->devPrivates, VidModeClientPrivateKey, p) + dixSetPrivate(&(c)->devPrivates, VidModeClientPrivateKey, (p)) #ifdef DEBUG #define DEBUG_P(x) DebugF(x"\n") @@ -384,15 +384,15 @@ ProcVidModeGetAllModeLines(ClientPtr client) } #define MODEMATCH(mode,stuff) \ - (VidModeGetModeValue(mode, VIDMODE_H_DISPLAY) == stuff->hdisplay \ - && VidModeGetModeValue(mode, VIDMODE_H_SYNCSTART) == stuff->hsyncstart \ - && VidModeGetModeValue(mode, VIDMODE_H_SYNCEND) == stuff->hsyncend \ - && VidModeGetModeValue(mode, VIDMODE_H_TOTAL) == stuff->htotal \ - && VidModeGetModeValue(mode, VIDMODE_V_DISPLAY) == stuff->vdisplay \ - && VidModeGetModeValue(mode, VIDMODE_V_SYNCSTART) == stuff->vsyncstart \ - && VidModeGetModeValue(mode, VIDMODE_V_SYNCEND) == stuff->vsyncend \ - && VidModeGetModeValue(mode, VIDMODE_V_TOTAL) == stuff->vtotal \ - && VidModeGetModeValue(mode, VIDMODE_FLAGS) == stuff->flags ) + (VidModeGetModeValue((mode), VIDMODE_H_DISPLAY) == (stuff)->hdisplay \ + && VidModeGetModeValue((mode), VIDMODE_H_SYNCSTART) == (stuff)->hsyncstart \ + && VidModeGetModeValue((mode), VIDMODE_H_SYNCEND) == (stuff)->hsyncend \ + && VidModeGetModeValue((mode), VIDMODE_H_TOTAL) == (stuff)->htotal \ + && VidModeGetModeValue((mode), VIDMODE_V_DISPLAY) == (stuff)->vdisplay \ + && VidModeGetModeValue((mode), VIDMODE_V_SYNCSTART) == (stuff)->vsyncstart \ + && VidModeGetModeValue((mode), VIDMODE_V_SYNCEND) == (stuff)->vsyncend \ + && VidModeGetModeValue((mode), VIDMODE_V_TOTAL) == (stuff)->vtotal \ + && VidModeGetModeValue((mode), VIDMODE_FLAGS) == (stuff)->flags ) static int VidModeAddModeLine(ClientPtr client, xXF86VidModeAddModeLineReq* stuff);