[PROJ] false positive of cppcheck?

Even Rouault even.rouault at spatialys.com
Mon Jul 6 08:50:39 PDT 2026


Hi Laurențiu

thanks for the reproducer. Posted at 
https://trac.cppcheck.net/ticket/14895 with a bisection to the commit 
that introduced the regression

I've tried to rework slightly the case to avoid the false positive, but 
didn't manage

Even

Le 06/07/2026 à 11:54, Laurențiu Nicola via PROJ a écrit :
> Hi Javier,
>
> It looks like a regression in cppcheck 2.22-dev (2.21 works). I 
> minimized it to:
>
> extern bool f();
> int main() {
>     bool datumAdded = false;
>     if (f()) {
>         if (f()) return 1;
>         if (f()) datumAdded = true;
>     }
>     if (datumAdded); // style: Condition 'datumAdded' is always false
> }
>
> I wanted to report it, but I honestly don't feel like dealing with 
> their registration process (see what I mean about the OSGeo mantra, 
> strk?).
>
> Daniel, please take a look at the snippet above or, if not, create an 
> account for me:
>
> lnicola:$2y$10$K2I2FWFyLHMGZh/CYsMaTO4g3N1PzeN37JAo85616xmwMCnb7HiyW
>
> Laurentiu
>
> On Mon, Jul 6, 2026, at 10:26, Javier Jimenez Shaw via PROJ wrote:
>> After updating my repo to upstream, I get this error
>>
>> https://github.com/jjimenezshaw/PROJ/actions/runs/28773629301/job/85312573467
>>
>> Cppcheck 2.22 dev
>> Running cppcheck on /home/runner/work/PROJ/PROJ/./scripts/../src... 
>> (can be long)
>> /home/runner/work/PROJ/PROJ/src/iso19111/io.cpp:7259,style,knownConditionTrueFalse,Condition 
>> '!datumAdded' is always true
>> knownConditionTrueFalse check failed
>>
>> Is it a false positive?
>>
>> In 
>> https://github.com/OSGeo/PROJ/actions/runs/28773631888/job/85312581973 
>> the failure is there, but the test is green.
>>
>> Am I missing anything?
>>
>> Thank you
>> Javier
>> _______________________________________________
>> PROJ mailing list
>> PROJ at lists.osgeo.org
>> https://lists.osgeo.org/mailman/listinfo/proj
>>
>
>
> _______________________________________________
> PROJ mailing list
> PROJ at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/proj

-- 
http://www.spatialys.com
My software is free, but my time generally not.
LLMs contribute to global warming and brain rot
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/proj/attachments/20260706/9ebedff7/attachment.htm>


More information about the PROJ mailing list