[cfe-dev] Q_ASSERT and Clang static analyzer

Jordan Rose jordan_rose at apple.com
Fri Aug 23 15:42:49 PDT 2013


On Aug 23, 2013, at 15:40 , Dmitri Gribenko <gribozavr at gmail.com> wrote:

> On Tue, Aug 20, 2013 at 10:00 AM, Jordan Rose <jordan_rose at apple.com> wrote:
>> 
>> On Aug 20, 2013, at 9:50 , Stephen Kelly <steveire at gmail.com> wrote:
>> 
>>> Jordan Rose wrote:
>>>> Obviously, the best case is to get them to start using
>>>> __attribute__((noreturn)) and/or __attribute__((analyzer_noreturn)). I can
>>>> see adding qtFatal to the list, though, since Qt is a fairly widespread
>>>> toolkit.
>>> 
>>> qt_assert is already __attribute__((noreturn)).
>>> 
>>> #ifndef Q_CC_MSVC
>>> Q_NORETURN
>>> #endif
>>> Q_CORE_EXPORT void qt_assert(const char *assertion, const char *file, int
>>> line) Q_DECL_NOTHROW;
>> 
>> Then...why isn't it working? Dmitri, if you have a test case, please file a Bugzilla report, I guess.
> 
> OK, I found why.  Because the noreturn attribute was added to the
> declaration only in Qt 5.  In Qt 4, which will be still relevant for
> at least a few years from now, qt_assert is not marked with noreturn:
> 
> http://qt.gitorious.org/qt/qt/blobs/4.8/src/corelib/global/qglobal.h#line1815

Okay, seems reasonable to me.

Jordan



More information about the cfe-dev mailing list