From 5062342d464eecc35cd39df7dd303dcda86d57cc Mon Sep 17 00:00:00 2001 From: Jeremy Huddleston Date: Tue, 3 May 2011 09:32:53 -0700 Subject: 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: Jeremy Huddleston Backported-to-NX-by: Ulrich Sibiller --- nx-X11/lib/X11/Xlibint.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nx-X11/lib/X11/Xlibint.h b/nx-X11/lib/X11/Xlibint.h index cd42913f0..603139fd6 100644 --- a/nx-X11/lib/X11/Xlibint.h +++ b/nx-X11/lib/X11/Xlibint.h @@ -367,7 +367,7 @@ extern LockInfoPtr _Xglobal_lock; * define MALLOC_0_RETURNS_NULL. This is necessary because some * 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 Xrealloc(ptr, size) realloc((ptr), ((size) == 0 ? 1 : (size))) -- cgit v1.2.3