Commit 5062342d authored by Jeremy Huddleston's avatar Jeremy Huddleston Committed by Ulrich Sibiller

clang analyzer: Don't warn about Xmalloc(0)

This will prevent a number of false positives in where clang's static analysis reports about calls to malloc(0). Signed-off-by: 's avatarJeremy Huddleston <jeremyhu@apple.com> Backported-to-NX-by: 's avatarUlrich Sibiller <uli42@gmx.de>
parent c19cda6d
...@@ -367,7 +367,7 @@ extern LockInfoPtr _Xglobal_lock; ...@@ -367,7 +367,7 @@ extern LockInfoPtr _Xglobal_lock;
* define MALLOC_0_RETURNS_NULL. This is necessary because some * define MALLOC_0_RETURNS_NULL. This is necessary because some
* Xlib code expects malloc(0) to return a valid pointer to storage. * Xlib code expects malloc(0) to return a valid pointer to storage.
*/ */
#ifdef MALLOC_0_RETURNS_NULL #if defined(MALLOC_0_RETURNS_NULL) || defined(__clang_analyzer__)
# define Xmalloc(size) malloc(((size) == 0 ? 1 : (size))) # define Xmalloc(size) malloc(((size) == 0 ? 1 : (size)))
# define Xrealloc(ptr, size) realloc((ptr), ((size) == 0 ? 1 : (size))) # define Xrealloc(ptr, size) realloc((ptr), ((size) == 0 ? 1 : (size)))
......
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