Propagating noreturn to the static analyzer

Next question: ! get a bunch of errors about pointers not checked for NULL
in code like this. I tried variations of decorating My_LogAssertFailed
with noreturn, putting the abort directly in the macro etc. How does the
clang static analyzer see there is actually an check against NULL?


#define MY_ASSERT(condition) do { if (!(condition))
My_LogAssertFailed(__FILE__, __LINE__, __FUNCTION__, #condition); } while

My_LogAssertFailed( const char *file, int line, const char *function,
const char *condition ) {

// …

static void SomeFunction(MyContext_h context)
   MY_ASSERT(context != NULL);

   if (context->foo != NULL) { // static analyzer complains here about
potential NULL pointer deference

Marking My_LogAssertFailed as __attribute__((noreturn)) should fix
this, I think.


You're right. Thought I tried it but overlooked the analyzer warnings
warnings not always get regenerated.. Thanks!