Clang static analysis builds should use C runtime directly.

This is a little macro magic to use malloc() directly instead of SDL_malloc(),
 etc, so static analysis tests that know about the C runtime can function
 properly, and understand that we are dealing with heap allocations, etc.

This changed our static analysis report from 5 outstanding bugs to 30.

5x as many bugs were hidden by SDL_malloc() not being recognized as malloc()
 by the static analyzer!
This commit is contained in:
Ryan C. Gordon 2015-01-05 01:41:42 -05:00
parent ec5859009e
commit db239776a8
7 changed files with 63 additions and 5 deletions

View file

@ -18,6 +18,11 @@
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#if defined(__clang_analyzer__) && !defined(SDL_DISABLE_ANALYZE_MACROS)
#define SDL_DISABLE_ANALYZE_MACROS 1
#endif
#include "../SDL_internal.h"
/* This file contains portable string manipulation functions for SDL */