Not finding cpp files because they are defined via --cpp_file flag and not put as last argument

Hello SonarQube Team,
We are using a Texas Instruments compiler (TMS320C6000 C/C++ CODE GENERATION TOOLS 8.3.3) with cmake (version 3.22.1) and ninja (version 1.11.1) together with your build-wrapper-win-x86 (Version 6.40). A extract of the build-wrapper-dump.json looks like this:

"compiler":"texas",
"executable":"C:\\ti\\ti-cgt-c6000_8.3.3\\bin\\cl6x.exe",
"cmd": [
"C:\\ti\\ti-cgt-c6000_8.3.3\\bin\\cl6x.exe",
"--compile_only",
"--cpp_file=C:\\Users\\Anonym\\Projects\\foo\\src\\Quaternion.cpp",
"--include_path=C:\\ti\\ti-cgt-c6000_8.3.3\\include",
"--include_path=C:\\ti\\xdctools_3_30_06_67_core\\packages",
"--include_path=C:\\ti\\bios_6_42_03_35\\packages",
"--include_path=C:\\ti\\uia_2_00_06_52\\packages",
...
"--mem_model:const=far",
"--preproc_with_compile",
"--preproc_dependency=CMakeFiles\\foo.dir\\src\\Quaternion.cpp.obj.d",
"--output_file=CMakeFiles\\foo.dir\\src\\Quaternion.cpp.obj"]

Notice that there is no file specified at the end of the cmd instead the --cpp_file flag is used. However, your sonar-scanner 4.7.0.2747 expect always the cpp file at the end of the command and when not present, no file is analaysed. Causing the error:

The “build-wrapper-dump.json” file was found but 0 C/C++/Objective-C files were analyzed C++ project

The same problem apears when json compilation data base is used. The corresponding extract from the compile_commands.json looks like this:

{
  "directory": "C:/Users/Anonym/Projects/foo/build",
  "command": "C:\\ti\\ti-cgt-c6000_8.3.3\\bin\\cl6x.exe --compile_only --cpp_file=C:\\Users\\Anonym\\Projects\\foo\\src\\Quaternion.cpp --include_path=C:\\ti\\ti-cgt-c6000_8.3.3\\include --include_path=C:\\ti\\xdctools_3_30_06_67_core\\packages --include_path=C:\\ti\\bios_6_42_03_35\\packages --include_path=C:\\ti\\uia_2_00_06_52\\packages --include_path=C:\\Users\\Anonym\\Projects\\foo\\inc --include_path=C:\\Users\\Anonym\\Projects\\foo\\inc_priv -DBIOS_SYSBIOS6 -D_64P_ -DCHIP_DM6437 -mv64+ --abi=eabi --gen_func_subsections=on --diag_warning=225 --display_error_number --mem_model:data=far --interrupt_threshold=256 --aliased_variables --no_compress --rtti  -g -D_DEBUG --mem_model:const=far --output_file=CMakeFiles\\foo.dir\\src\\Quaternion.cpp.obj",
  "file": "C:\\Users\\Anonym\\Projects\\foo\\src\\Quaternion.cpp"
}

Notice, here again the cpp_file flag is used instead of writing the file at the end of the command. If the flag is removed and the files at the end of the command are written instead, the scanner works again.

It would be nice if you could fix the error by accepting/interpreting the cpp_file flag in accordance with Texas Instruments compiler support.

Kind regards

Chris

Hello @cblankenburg, and welcome to the community,

Thank you for the report and the detailed explanation. I have noted this in our tracker: [CPP-4088] - Jira.

Regards,
Alejandro.