Re: [Doxygen-develop] doxygen-1.8.5:doxygen.cpp:3572: possible bad if test ?
Brought to you by:
dimitri
From: Dimitri v. H. <do...@gm...> - 2013-12-17 20:32:15
|
Hi David, On 17 Dec 2013, at 20:20 , David Binderman <dc...@ho...> wrote: > Hello there, > > I just ran the static analyser "cppcheck" over the source > code of doxygen-1.8.5. It said many things, including > > [doxygen.cpp:3572]: (warning) Logical conjunction always evaluates to false: EXPR != -1 && EXPR == -1. > > Source code is > > if (md->getStartBodyLine()!=-1 && md->getStartBodyLine()==-1) > > Suggest code rework. Thanks, I've push this change to GitHub to fix it: https://github.com/doxygen/doxygen/commit/585efafb18dbdc371a46063cbeb272e5bb292628 > > The analyser also said > > [fortranscanner.cpp:1307]: (style) Array index 'i' is used before limits check. > [markdown.cpp:541]: (style) Array index 'i' is used before limits check. > [markdown.cpp:1317]: (style) Array index 'i' is used before limits check. > [markdown.cpp:1323]: (style) Array index 'i' is used before limits check. > > which may also be worth fixing. These appeared to be false positives, all concern an array 'a' with size 's', where the check has the form: if (i<s) { ... if (a[i]==x && i<s-1 && a[i+1]==y) { ... } } cppcheck apparently doesn't see the first guard and is triggered by the second guard, which makes use of the fact that && is evaluated conditionally. Regards, Dimitri |