[cfe-users] Making analyzer understand VC assert
Anna Zaks
ganna at apple.com
Mon Nov 11 09:45:31 PST 2013
Anders,
I think this is the right approach. Please, send a patch to cfe-commits list for review.
Anna.
On Nov 11, 2013, at 8:25 AM, Anders Montonen <Anders.Montonen at iki.fi> wrote:
> FWIW I tried adding _wassert to NoReturnFunctionChecker, and it appeared to do the trick.
>
> -a
>
> On Mon, 11 Nov 2013, David Blaikie wrote:
>
>> +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
> _______________________________________________
> cfe-users mailing list
> cfe-users at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-users
More information about the cfe-users
mailing list