[PATCH] Add _wassert to known noreturn functions

Alp Toker alp at nuanti.com
Tue Nov 12 08:48:38 PST 2013


That's reasonable. Please add a comment for the special case given that these are listed noreturn right now.
 


Jordan Rose <jordan_rose at apple.com> wrote:
>Yes, sorry, we discussed this on the cfe-users list: for the analyzer,
>we care more about reading the intent of the code from the assertions
>than from exploring the “continue anyway” case.
>
>Anders, please do add a test. You can add it to
>test/Analysis/NoReturn.m with a forward-declaration of _wassert.
>
>Jordan
>
>
>On Nov 11, 2013, at 19:37 , Reid Kleckner <rnk at google.com> wrote:
>
>> True, I forgot that. However, it's probably useful for the static
>analyzer to consider it noreturn for analysis purposes.
>> 
>> 
>> On Mon, Nov 11, 2013 at 7:32 PM, Alp Toker <alp at nuanti.com> wrote:
>> _wassert can emit a warning and return control depending on the flag
>/
>> dialog input, no?
>> 
>> Alp.
>> 
>> On 12/11/2013 00:55, Reid Kleckner wrote:
>> > Seems reasonable, but can you add a test?
>> >
>> >
>> > On Mon, Nov 11, 2013 at 12:18 PM, Anders Montonen
>> > <Anders.Montonen at iki.fi <mailto:Anders.Montonen at iki.fi>> wrote:
>> >
>> >     Microsoft's library headers do not annotate _wassert as being a
>> >     noreturn function, causing analyzer false positives. Fix by
>adding
>> >     it to NoReturnFunctionChecker's list of known noreturn
>functions.
>> >
>> >     -a
>> >
>> >     diff --git
>> >     a/lib/StaticAnalyzer/Checkers/NoReturnFunctionChecker.cpp
>> >     b/lib/StaticAnalyzer/Checkers/NoReturnFunctionChecker.cpp
>> >     index d7a880c..1367021 100644
>> >     --- a/lib/StaticAnalyzer/Checkers/NoReturnFunctionChecker.cpp
>> >     +++ b/lib/StaticAnalyzer/Checkers/NoReturnFunctionChecker.cpp
>> >     @@ -64,6 +64,7 @@ void
>> >     NoReturnFunctionChecker::checkPostCall(const CallEvent &CE,
>> >                  .Case("assfail", true)
>> >                  .Case("db_error", true)
>> >                  .Case("__assert", true)
>> >     +            .Case("_wassert", true)
>> >                  .Case("__assert_rtn", true)
>> >                  .Case("__assert_fail", true)
>> >                  .Case("dtrace_assfail", true)
>> >     _______________________________________________
>> >     cfe-commits mailing list
>> >     cfe-commits at cs.uiuc.edu <mailto:cfe-commits at cs.uiuc.edu>
>> >     http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>> >
>> >
>> >
>> >
>> > _______________________________________________
>> > cfe-commits mailing list
>> > cfe-commits at cs.uiuc.edu
>> > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>> 
>> --
>> http://www.nuanti.com
>> the browser experts
>> 
>> 
>> _______________________________________________
>> cfe-commits mailing list
>> cfe-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20131112/a595ba5d/attachment.html>


More information about the cfe-commits mailing list