Menu

Issue with final

2019-07-04
2024-11-29
  • Thomas Niederberger

    We have an issue with final classes in our code. The classes are marked as final and have a Macro that resolves to the declspec. With these classes we get information messages in the form of:
    The code 'class x final :' is not handled. You can use -I or --include to add handling of this code. [class_X_Y]

    Then the classes seem to be skipped.
    I tried to look a bit into the code and came up with the following test that I would expect to pass, but currently it fails:

        void final_class_x() {
          const char code[] = "class __declspec(dllexport) x final { };";
          {
            errout.str("");
            Tokenizer tokenizer(&settings, this);
            std::istringstream istr(code);
            tokenizer.tokenize(istr, "test.cpp");
            tokenizer.simplifyTokenList2();
            ASSERT_EQUALS("", errout.str());
          }
        }
    

    Interestingly: If I remove the double underscore in front of declspec then the test passes.
    Any suggestions what we could do about this?

    Cheers,
    niederb

     
  • Thomas Hampson

    Thomas Hampson - 2024-11-29

    Since cppcheck 2.15.0 we are getting a lot of class_X_Y information level defects. See here:
    https://builds.mantidproject.org/job/pull_requests-cppcheck/62171/CppCheck/
    Can someone help me understand how to resolve these?

     
  • CHR

    CHR - 2024-11-29

    Probably there are unknown macros like MANTID_API_DLL, although I couldn't immediately reproduce the issue with the first header.

     

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.