[cfe-users] Making analyzer understand VC assert

David Blaikie dblaikie at gmail.com
Mon Nov 11 08:12:31 PST 2013


+Jordan - do you know much about the NoReturnFunctionChecker and whether it
would make sense to handle _wassert there? Is there some other solution
that would properly handle this implementation of 'assert' in the static
analyzer?


On Mon, Nov 11, 2013 at 3:01 AM, Anders Montonen <Anders.Montonen at iki.fi>wrote:

> Hi,
>
> I'm trying to use Clang's static analyzer with a Visual Studio project,
> but I'm running into the problem that in Microsoft's headers the _wassert
> function is not declared as noreturn, which leads to lots of false
> positives. The assert declaration looks like so:
>
> #undef  assert
>
> #define assert(_Expression) (void)( (!!(_Expression)) ||
> (_wassert(_CRT_WIDE(#_Expression), _CRT_WIDE(__FILE__), __LINE__), 0) )
>
> _CRTIMP void __cdecl _wassert(_In_z_ const wchar_t * _Message, _In_z_
> const wchar_t *_File, _In_ unsigned _Line);
>
> Looking through the source code there seems to be an "--assert=" flag, but
> it also seems not to be used.
>
> Any advice how to handle this? Since the mingw headers (where the function
> is properly annotated) differ enough from Microsoft's that it would require
> modifications in the source code, I would prefer to not have to include
> them in the mix.
>
> I noticed that there's a number of hardcoded function names in the static
> analyzer's NoReturnFunctionChecker, should _wassert be added to this list?
>
> -a
>
> _______________________________________________
> cfe-users mailing list
> cfe-users at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-users/attachments/20131111/5c5ac67d/attachment.html>


More information about the cfe-users mailing list