codechecker icon indicating copy to clipboard operation
codechecker copied to clipboard

--ctu flag not handled during analysis

Open mcserep opened this issue 1 year ago • 3 comments

Describe the bug The documentation states that Cross Translation Unit Analysis can be enabled with the --ctu flag. Using this flag is also included in the GitLab CI tutorial.

The flag is not recognized, instead the CodeChecker: error: unrecognized arguments: --ctu message is printed.

CodeChecker version 6.23.1

To Reproduce Steps to reproduce the behaviour:

  1. Run command: CodeChecker analyze --ctu -o ./reports ./compile_commands.json
  2. See error

Expected behaviour The Cross Translation Unit Analysis is performed when the --ctu flag is passed.

Desktop

  • OS: Linux
  • Browser: N/A
  • Version: N/A

mcserep avatar May 02 '24 18:05 mcserep

What is the Clang version on the machine? The --ctu flag is conditionally enabled based on the Clang available in the system. You'll need a new enough clang and clang-extdef-mapping in the PATH.

whisperity avatar May 02 '24 19:05 whisperity

Thanks for the quick response @whisperity. That was indeed the source of the issue. (Clang SA was not made properly available on the PATH due to some typo in the CI configuration I am working on.)

In that case I think the given error message is highly misleading, since CodeChecker has a separate error message for cases when clangsa (or any other analyzer) is not found on the PATH. In my opinion in this case that error message should have been printed, instead of stating that a documented flag (--ctu) is not recognized.

mcserep avatar May 02 '24 22:05 mcserep

Yeah the problems is that argparse hijacks the execution to throw a full error from parse_args() before we could detect the actual lack of CTU options... Will have to come up with a solution for this problem.

whisperity avatar May 03 '24 10:05 whisperity