Menu

ConfigurationNotChecked Error

samed
2021-01-19
2021-01-20
  • samed

    samed - 2021-01-19

    Cppcheck throws [ConfigurationNotChecked] error with or without --force flag. I have a simple header:

    #if a
    int a()
    {
    return 0;
    }
    #endif
    #if b
    int b()
    {
    return 0;
    }
    #endif
    

    Cppcheck skips both configs.

     
  • Daniel Marjamäki

    yes this is a case where we want to have explicit configuration with -D. I do not want to guess a concrete value of a macro that is used in the code.

     
  • samed

    samed - 2021-01-19

    Then in which cases does Cppcheck guess value of the macros. Because, while creating dumps, sometimes there were multiple configurations and other times only 1. I don't have access to older codes (because i deleted them) so I cannot reproduce the same behavior. In other terms, how does Cppcheck create configurations (with regards to macros) while creating dumps?

     
  • Daniel Marjamäki

    when the macros are only used in preprocessor directives we can safely guess..:

    #if a
    int foo() {
    return 0;
    }
    #endif
    #if b
    int bar()
    {
    return 0;
    }
    #endif
    

    if cppcheck guess a=1 or a=1000 doesn't matter.

    put a or b somewhere in the code and it's not safe to guess anymore..

    #if a
    int foo() {
        return a;
    }
    #endif
    

    If we guess a=1 and that is never the real value then the analysis might be wrong and there could be false positives.

     

    Last edit: Daniel Marjamäki 2021-01-19
    • Daniel Marjamäki

      if cppcheck guess a=1 or a=1000 doesn't matter.

      well if both a=1 and a=1000 means that the condition is true then it does not matter.

       
  • samed

    samed - 2021-01-20

    I see. I guess same goes for when function name and macro is the same. Why is that though?

     
  • Daniel Marjamäki

    this guess happens before parsing so it is difficult to see how the macro is used. it is just seen in the code and then you get the warning.

    We can guess configurations for most code automatically but this is a case where proper analysis requires proper macro values. Have you tried to use the --project flag? I would suggest that flag.

    Even if Cppcheck determines that it's a function name it's very hard to guess the proper macro value. It could be anything. For instance it could be a=a or a=Foo::bar... we can't know what the proper name is.

     

    Last edit: Daniel Marjamäki 2021-01-20

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.