[cfe-dev] Q_ASSERT and Clang static analyzer

Jordan Rose jordan_rose at apple.com
Tue Aug 20 09:36:37 PDT 2013


I don't see those function names in a quick Google search. In particular, qt_check_pointer seems to be an opaque function called in the true case or the false case, which means simply pretending it's noreturn is the wrong thing to do. qtFatal seems like the normal assertion failure function. http://qt-project.org/doc/qt-5.1/qtcore/qtglobal.html#Q_ASSERT

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.

Jordan


On Aug 20, 2013, at 9:11 , Dmitri Gribenko <gribozavr at gmail.com> wrote:

> Hi Jordan,
> 
> Qt has its own assertion facility which is apparently not recognized
> by the static analyzer.  Qt calls one of the following functions when
> an assertion fails: qt_assert and qt_assert_x, qt_check_pointer,
> qBadAlloc.
> 
> Do you think it is reasonable to add these to list in
> NoReturnFunctionChecker.cpp?
> 
> Dmitri
> 
> -- 
> main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
> (j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/




More information about the cfe-dev mailing list