Menu

Cppcheck-2.6

2021-08-22
2021-09-27
<< < 1 2 (Page 2 of 2)
  • Daniel Marjamäki

    Please open a new discussion topic if you want to request a new check. The problem here is that we can't be sure if the parameters are intended to be passed that way. It looks like a possible mistake but how can we know it is a mistake. If this is added I think we'll need to carefully test it and probably add some further heuristics..

     
  • Absol

    Absol - 2021-08-30

    cppcheck created for detect only "100% error found" and "possible error" not adding to cppcheck ?

     
    • Daniel Marjamäki

      more about our philosophy.. https://github.com/danmar/cppcheck/blob/main/philosophy.md
      Stylistic checks must have a very low noise ratio. It's not enough that the code looks suspicious.

       
  • Julien

    Julien - 2021-08-30

    I'm not sure this is the right place to post this but I'm having trouble to register and logging into webchat to ask for a TRAC account.

    With latest nighty build I get many : error: Found a exit path from function with non-void return type that has missing return statement [missingReturn] that I did not get on previous version of Cppcheck.

    For Unit test purposes I have to use a defined STATIC in order to test functions as non static on my tests and keep them static on my final code :

    #ifdef TEST
    #define STATIC
    #else
    #define STATIC static
    #endif
    

    The errors are triggered by this kind of functions : STATIC void MyFunction(void)

    Do you think this could/should be solved before next release ?

    Please let me know if I should create another topic for this.*

    EDIT :

    My bad, this was related to my folder structure : I had a wrong relative path to the header that define STATIC.
    Sorry for the inconvenience.

     
    👍
    1

    Last edit: Julien 2021-08-30
    • Daniel Marjamäki

      I anyway think that the check could make a more intelligent guess here. It could guess that UNKNOWN_MACRO void f() does not return a value.

       
  • Absol

    Absol - 2021-09-02

    I found false detects from cppcheck engine https://github.com/danmar/cppcheck/pull/3431#issuecomment-911434094

    if (name1==name2)
    ....
    do something with name1 or name2
    ...
    if (name1==name2)
    cppcheck writing something like
    "name1==name2" always false

     

    Last edit: Absol 2021-09-02
    • Daniel Marjamäki

      I don't want that we report random bugs in this discussion "cppcheck-2.6". If it's a regression in cppcheck-2.6 fine! Or something that is totally broken and have to be fixed.
      Please feel free to open new discussion topics to report random bugs..

       

      Last edit: Daniel Marjamäki 2021-09-02
      • Absol

        Absol - 2021-09-02

        I don't know how to open new discussion on sourceforge

         
  • Absol

    Absol - 2021-09-10

    I got false detect with cppcheck:
    warning: Return value of function logf() is not used. [ignoredReturnValue]
    But function void logf(const char* format, ...)

     
  • Absol

    Absol - 2021-09-10

    I got false positive with simple enum:
    In 'main' branch cppcheck from github.

    enum enumname {
        WARNING = -1,
        ERROR = 0,
        CPPCHECK = 1,
        FALSE_POSITIVE = 2
    };
    

    error: syntax error: 0 = [syntaxError]
    WARNING = -1,

     

    Last edit: Absol 2021-09-11
  • Absol

    Absol - 2021-09-10

    I found another false positive in one opensource code.

    style: Variable 'end' is assigned a value that is never used. [unreadVariable]

    Keyval::Keyval(std::string line)
    {
        int begin = -1;
        int end;
    
        key.clear();
        value.clear();
        int comment = 0;
    
        for (uint i = 0; i < line.length(); i++)
        {
            if (line[i] == '/')
            {
                if (++comment >= 2)
                {
                    key.clear();
                    value.clear();
                    break;
                }
            }
            else
                comment = 0;
            if (line[i] == '"')
            {
                if (begin == -1)
                    begin = i + 1;
                else
                {
                    end = i;
                    if (key.length() == 0)
                    {
                        key = line.substr(begin,end-begin);
                        begin = end = -1;
                    }
                    else
                    {
                        value = line.substr(begin,end-begin);
                        break;
                    }
                }
            }
        }
    }
    
     

    Last edit: Absol 2021-09-10
  • Absol

    Absol - 2021-09-12

    I think second false detect (with enum) only in Windows

     
  • Daniel Marjamäki

    I believe that Cppcheck is sufficiently stable now.

    I suggest that I make a release candidate for Cppcheck-2.6 tomorrow. Or does anybody want more time?

    Do you see some bugs that you think are critical to fixed?

    We can wait a week or two if there is a good reason..

     
    • orbitcowboy

      orbitcowboy - 2021-09-25

      Thanks Daniel. The only issue that bothers me at the moment is a misra.py bailout, described here: https://trac.cppcheck.net/ticket/10481
      But I don't know if its worth to delay the release. It's up to you...

       
      • Daniel Marjamäki

        That seems critical I will fix that.

         
  • john borland

    john borland - 2021-09-26

    I did run a flame graph with match compiler on and a release build but it isn't very useful. The function you would want to know the name of is showing up as unknown. I will dig through the flags and see if I can get more useful data. I will do a follow up in a new thread.

     
  • Daniel Marjamäki

     
    • Paul Fultz

      Paul Fultz - 2021-09-26

      Do you think its possible to move the release notes into the git repo? This will allow others to contribute the release notes(just in case you missed something).

      Ideally we could build the file incrementally as new features are added instead of accounting for features at release time. This is similar to clang-tidy's release notes which are updated as changes are made:

      https://github.com/llvm/llvm-project/blob/main/clang-tools-extra/docs/ReleaseNotes.rst

      What do you think?

       
      • Daniel Marjamäki

        That sounds good to me. I'd still assume we need to tweak this during release but then the community has the possibility to edit it during development.

         
        • Julien

          Julien - 2021-09-26

          That would be nice to also add the new misra rules on this file or another one to check which new rules are added. I sometimes compare on your sourceforge page but there is no history there.

           
          • Daniel Marjamäki

            The release notes will definitely mention misra this time. They will say something like:

             All misra C 2012 rules have been implemented except 1.1 , 1.2 and 17.3. Including the rules in amendment 1 and amendment 2.
             The rules 1.1 and 1.2 must be checked with a compiler.
             The rule 17.3 can be checked by a compiler, for instance GCC.
            

            For rule 17.3 I am not sure if we will implement that in the addon. I rather not require that real system headers are included in the analysis. I guess we can implement a rough analysis though without system headers.

             
        • Paul Fultz

          Paul Fultz - 2021-09-26

          Sure, sounds good. Are you able to push the current release notes you have? And then others can contribute more as they see fit.

           
          • Daniel Marjamäki

            I have not started writing the release notes.

             
            • Daniel Marjamäki

              I have added the file: cppcheck/releasenotes.txt
              in main branch => release notes for 2.7
              in 2.6.x branch => release notes for 2.6

              feel free to contribute.

               
<< < 1 2 (Page 2 of 2)

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.