Menu

Verification on possible false positives

LukeL
2020-04-24
2020-04-24
  • LukeL

    LukeL - 2020-04-24

    Recently upgraded from cppcheck 1.88 to cppcheck 1.90 and a few new errors have popped up. Can't seem to work out why they're errors. Would like some verification on if the following are false positives or if i need to change something. Thanks!

    typedef SpxBaseLogger& (*SpxLoggerStreamFunction)(SpxBaseLogger&);
    inline SpxBaseLogger& operator<<(SpxBaseLogger& qStream, SpxLoggerStreamFunction qFunction)
    {
        return (*qFunction)(qStream);
    }
    

    returnTempReference - Reference to temporary returned.

    for(const ReadFunc* creater = creaters; creater < &creaters[sizeof(creaters) / sizeof(*creaters)]; ++creater)
    {
        ...
    }
    

    internalAstError - Syntax Error: AST broken, 'for' doesn't have two operands.

     
  • Daniel Marjamäki

    returnTempReference - Reference to temporary returned.

    I believe that is a false positive. I create ticket https://trac.cppcheck.net/ticket/9691. Thanks!

    internalAstError - Syntax Error: AST broken, 'for' doesn't have two operands.

    If you can compile the code then those are always wrong. It's a bug in Cppcheck parser. You can safely ignore it.

    We are trying to fix those so hopefully your problem will be fixed sooner or later. In Cppcheck-2.0 there will also be a new "Clang import" feature, if you have such problems with the Cppcheck parser you might be able to get around it by using "Clang import". However the import is not rock solid yet.. I would say.

     
  • LukeL

    LukeL - 2020-04-24

    Much appreciated! Thank you!

     

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.