platform_external_selinux/libsemanage
Nicolas Iooss 120681c1a3 libsepol, libsemanage: add a macro to silence static analyzer warnings in tests
Several static analyzers (clang's one, Facebook Infer, etc.) warn about
NULL pointer dereferences after a call to CU_ASSERT_PTR_NOT_NULL_FATAL()
in the test code written using CUnit framework. This is because this
CUnit macro is too complex for them to understand that the pointer
cannot be NULL: it is translated to a call to CU_assertImplementation()
with an argument as TRUE in order to mean that the call is fatal if the
asserted condition failed (cf.
http://cunit.sourceforge.net/doxdocs/group__Framework.html).

A possible solution could consist in replacing the
CU_ASSERT_..._FATAL() calls by assert() ones, as most static analyzers
know about assert(). Nevertheless this seems to go against CUnit's API.

An alternative solution consists in overriding CU_ASSERT_..._FATAL()
macros in order to expand to assert() after a call to the matching
CU_ASSERT_...() non-fatal macro. This appears to work fine and to remove
many false-positive warnings from various static analyzers.

As this substitution should only occur when using static analyzer, put
it under #ifdef __CHECKER__, which is the macro used by sparse when
analyzing the Linux kernel.

Signed-off-by: Nicolas Iooss <nicolas.iooss@m4x.org>
2019-09-30 08:43:41 -04:00
..
example Author: Daniel J Walsh 2008-09-15 09:25:33 -04:00
include Fix many misspellings 2019-09-18 22:47:35 +02:00
man libsemanage: optionally optimize policy on rebuild 2019-06-25 10:11:00 -04:00
src Switch last 2 files using /usr/bin/env to /usr/bin/python3 2019-09-26 08:32:18 -04:00
tests libsepol, libsemanage: add a macro to silence static analyzer warnings in tests 2019-09-30 08:43:41 -04:00
utils Always use /usr/bin/python3 in Python scripts 2019-02-20 16:43:27 +01:00
.gitignore Add subdirectory .gitignore files. 2009-10-20 21:25:55 -04:00
COPYING initial import from svn trunk revision 2950 2008-08-19 15:30:36 -04:00
Makefile libsemanage: semanage store migration script 2014-08-26 08:03:31 -04:00
VERSION Update VERSIONs to 2.9 for release. 2019-03-15 11:32:30 +01:00