New Defects reported by Coverity Scan for LibreOffice

Caolán McNamara caolanm at redhat.com
Mon Feb 2 01:39:30 PST 2015


On Fri, 2015-01-30 at 10:47 -0800, scan-admin at coverity.com wrote:
> ________________________________________________________________________________________________________
> *** CID 1267636:  Logically dead code  (DEADCODE)
> /sw/source/core/doc/textboxhelper.cxx: 242 in SwTextBoxHelper::getByIndex(SdrPage *, int, std::set<const SwFrmFmt *, std::less<const SwFrmFmt *>, std::allocator<const SwFrmFmt *>> &)()
> 236                 pRet = pPage->GetObj(i);
> 237                 break;
> 238             }
> 239             ++nCount;
> 240         }
> 241         assert(pRet);
> >>>     CID 1267636:  Logically dead code  (DEADCODE)
> >>>     Execution cannot reach this statement: "<temporary>.Any();".
> 242         return pRet ? uno::makeAny(uno::Reference<drawing::XShape>(pRet->getUnoShape(), uno::UNO_QUERY)) : uno::Any();
> 243     }
> 244     
> 245     sal_Int32 SwTextBoxHelper::getOrdNum(const SdrObject* pObject, std::set<const SwFrmFmt*>& rTextBoxes)
> 246     {
> 247         if (const SdrPage* pPage = pObject->GetPage())

So, if we show coverity the asserts it removes a pile of warnings, but
introduces another pile of deadcode given the way we have stacks of
defensive "this shouldn't happen, but if it does" code :-) We either
ifdef off NDEBUG, just go back to hiding asserts from coverity, or
bravely claim that all our assert conditions never happen in release
mode.

C.



More information about the LibreOffice mailing list