Commit c19cda6d authored by Jeremy Huddleston's avatar Jeremy Huddleston Committed by Ulrich Sibiller

Silence clang static analysis warnings for SetReqLen

This provides a simplified version of the SetReqLen macro when using clang for static analysis. Prior to this change, we would see many Idempotent operation warnings inside this macro due to the common case of calling with arg2 and arg3 being the same variable. This has no effect on code produced during compilation, but it silences a number of false positives in static analysis. XIPassiveGrab.c:170:5: warning: Assigned value is always the same as the existing value SetReqLen(req, num_modifiers, num_modifiers); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from XIPassiveGrab.c:26: .../nx-X11/lib/X11/Xlibint.h:580:8: note: instantiated from: n = badlen; \ ^ Signed-off-by: 's avatarJeremy Huddleston <jeremyhu@apple.com> Backported-to-NX-by: 's avatarUlrich Sibiller <uli42@gmx.de>
parent c300a430
......@@ -558,6 +558,7 @@ extern void *_XGetRequest(Display *dpy, CARD8 type, size_t len);
* Do not use SetReqLen if "req" does not already have data after the
* xReq header. req->length must already be >= 2.
*/
#ifndef __clang_analyzer__
#define SetReqLen(req,n,badlen) \
if ((req->length + n) > (unsigned)65535) { \
if (dpy->bigreq_size) { \
......@@ -568,6 +569,10 @@ extern void *_XGetRequest(Display *dpy, CARD8 type, size_t len);
} \
} else \
req->length += n
#else
#define SetReqLen(req,n,badlen) \
req->length += n
#endif
#define SyncHandle() \
if (dpy->synchandler) (*dpy->synchandler)(dpy)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment