[PROJ] false positive of cppcheck?

Laurențiu Nicola lnicola at dend.ro
Mon Jul 6 02:54:03 PDT 2026


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
> 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/proj/attachments/20260706/053e8969/attachment.htm>


More information about the PROJ mailing list