[cfe-dev] Q_ASSERT and Clang static analyzer

Anna Zaks ganna at apple.com
Mon Aug 26 10:24:11 PDT 2013


On Aug 23, 2013, at 3:42 PM, Jordan Rose <jordan_rose at apple.com> wrote:

> 
> 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.

I am not very keen on modifying the analyzer code to support old versions of Qt...

(If you were to do this, please put in a comment stating that that is temporary and should be removed. )

> 
> Jordan
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130826/89e9ccf0/attachment.html>


More information about the cfe-dev mailing list