Re: Static analyzer making unwarranted assumptions about ivars
Re: Static analyzer making unwarranted assumptions about ivars
- Subject: Re: Static analyzer making unwarranted assumptions about ivars
- From: Devin Coughlin <email@hidden>
- Date: Wed, 16 Mar 2016 14:44:34 -0700
On Mar 15, 2016, at 9:57 PM, Jens Alfke < email@hidden> wrote:
On Mar 15, 2016, at 5:53 PM, Devin Coughlin < email@hidden> wrote:
You can get false positives like this if you use custom assertion macros in your project. In this case you would need to annotate the assertion handler (the part of the assertion macro that aborts when the check fails) with __attribute__((analyzer_noreturn)).
I use the more-standard __attribute__((noreturn)) on my assertion-failed handlers.
I notice that the docs you linked to say "currently, clang does not support these attributes on Objective-C methods and C++ methods” — is that still true? I’ve got a couple of C++ methods marked as “[[noreturn]]”:
In C++, both clang and the analyzer honor [[noreturn]] and __attribute__((noreturn)) on methods. There is no [[analyzer_noreturn]], but you can use __attribute__((analyze_noreturn)) on C++ methods.
For Objective-C methods __attribute__((noreturn)) has no effect for either clang or the analyzer but __attribute__((analyzer_noreturn)) is honored by the analyzer.
struct error : public std::exception { ... [[noreturn]] static void _throw(fdb_status); [[noreturn]] static void assertionFailed(const char *func, const char *file, unsigned line, const char *expr); };
For Clang’s sake should I change those into regular functions? And does the analyzer recognize C++11’s “[[noreturn]]” syntax?
There should be no need to turn these into functions.
Devin
|
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden