teach clang that _fail() does not return.
cmocka's fail_msg() (_fail() in macro) cannot return. Clang's static analysis has a false null pointer dereference error because it does not know this.
if (result != test->result) {
7
←
Assuming the condition is true
→
8
←
Taking true branch
→
102 fail_msg("# test \"%s\" on line %d: "
103 "expected result %d (%s), got %d (%s)",
104 test->id.description, test->id.lineno,
105 test->result, isc_result_totext(test->result),
106 result, isc_result_totext(result));
107 }
108
109 /*
110 * Check output string if return value indicates success.
111 */
112 if (result == ISC_R_SUCCESS && strcmp(*target, test->output) != 0) {
9
←
Assuming 'result' is equal to 0
→
10
←
Null pointer argument in call to string comparison function
113 fail_msg("# test \"%s\" on line %d: "
114 "expected output \"%s\", got \"%s\"",
115 test->id.description, test->id.lineno,
116 test->output, *target);
117 }