summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Huddleston <jeremyhu@apple.com>2011-05-08 09:08:07 -0700
committerJeremy Huddleston <jeremyhu@apple.com>2011-05-08 09:08:07 -0700
commitae39d82b01359b07dd1fe092d867f79ea95a5438 (patch)
treec5e6ea892f8b6fc37c4839fe4b9748943aff84fa
parent130af2bc02090ee2526adb2f9803fc07019b8f1f (diff)
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: .../include/X11/Xlibint.h:580:8: note: instantiated from: n = badlen; \ ^ Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
-rw-r--r--include/X11/Xlibint.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/X11/Xlibint.h b/include/X11/Xlibint.h
index 3266e0d0..ce3d25fa 100644
--- a/include/X11/Xlibint.h
+++ b/include/X11/Xlibint.h
@@ -572,6 +572,7 @@ extern LockInfoPtr _Xglobal_lock;
#endif
#endif
+#ifndef __clang_analyzer__
#define SetReqLen(req,n,badlen) \
if ((req->length + n) > (unsigned)65535) { \
if (dpy->bigreq_size) { \
@@ -582,6 +583,10 @@ extern LockInfoPtr _Xglobal_lock;
} \
} else \
req->length += n
+#else
+#define SetReqLen(req,n,badlen) \
+ req->length += n
+#endif
#define SyncHandle() \
if (dpy->synchandler) (*dpy->synchandler)(dpy)