Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions lib/cppcheck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1235,11 +1235,6 @@ unsigned int CppCheck::checkInternal(const FileWithDetails& file, const std::str
ErrorMessage errmsg = ErrorMessage::fromInternalError(e, &tokenizer.list, file.spath());
mErrorLogger.reportErr(errmsg);
}
} catch (const TerminateException &) {
// Analysis is terminated
if (analyzerInformation)
mLogger->setAnalyzerInfo(nullptr);
return mLogger->exitcode();
} catch (const InternalError &e) {
ErrorMessage errmsg = ErrorMessage::fromInternalError(e, nullptr, file.spath());
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we have this InternalError then do we want to abort the loop? Maybe current configuration leads to an InternalError but another configuration is successfully checked?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not understand what you mean. Could you elaborate a bit?

I also did not change the behavior. It was a try-catch inside another try-catch with the same catch handlers.

Copy link
Owner

@danmar danmar Dec 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This try you removed is inside a for loop that starts at line 1088:

      for (const std::string &currCfg : configurations) {
      ....
          try {
              code
          } catch ...
      ....
      }

if the code would throw an exception then that would have been handled in the loop and the loop could continue to process other configurations..
after your changes it seems to me that the exception is handled below the loop and that the loop is aborted as a consequence.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ugh. You are right, of course. But it seems we are lacking testing for this. I was curious why none of the test results changed and still would have added a test which triggers it.

The TerminateException is still redundant though.

So I will restore the InternalError and add tests and more documentation. A follow-up will introduce some noexcept (mostly driven by upcoming clang-tidy improvements).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The removed handler will be reached by encountering #error. So that plays into the --check-config work I am doing.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The removed handler will be reached by encountering #error. So that plays into the --check-config work I am doing.

Turns out that is not the case - the fuzzer triggered a different issue. I have not been able to produce the exception yet. Adding transitive documentation after #8036 might help with figuring it out via a code review.

mErrorLogger.reportErr(errmsg);
Expand Down