Menu

new knownEmptyContainer FPs

Martin
2022-04-07
2022-04-09
  • Martin

    Martin - 2022-04-07

    Hi,

    several new FPs of the following kind appeared in our code due to the most recent commits:

    void foo()
    {
       std::vector< ptr1 > const potentialRoutes = m_RouteData.getPotentialRoutes( id );
       for ( ptr1 const & potentialRoute : potentialRoutes ) {}
    }
    

    -->

    style: Iterating over container 'potentialRoutes' that is always empty. [knownEmptyContainer]
       for ( ptr1 const & potentialRoute : potentialRoutes ) {}
                                           ^
    

    cppcheck can't assume at this point that the container will be empty.

    worked with: 3ba69145635a4ff01d4cec65a0293f5b8ccd13b0
    occured with: 64a7ba3c4c01cf912dfe8617a94cbe6d00667523

    Could you please check?

    Thanks,
    Martin

     
  • CHR

    CHR - 2022-04-07

    Thanks for reporting, ticket is here: https://trac.cppcheck.net/ticket/10951

    Since you report quite often, maybe @danmar could set you up with a trac account?

     
  • Martin

    Martin - 2022-04-07

    I'd use it if I had one, but last time I tried to get one ... mh I don't remember, was some years ago .

     
    • Daniel Marjamäki

      if you send me a htpasswd hash I will create an account for you. for information, there are htpasswd hash generators online.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.