Hi, we realize the support of the C++20 modules may still be experimental but we wanted to talk about this issue in case a solution could be found.
Environment:
- SonarQube: Develop Edition 8.9.7.52159 (LTS) installed with a standard Docker image
- No plugin installed
- CFamily plugin version: 6.20.3.42796
- Sonar scanner: installed on a Windows 10 amd64 agent used by GitLab
- Steps to reproduce: analyze a directory containing C++20 modules, most of them cannot be processed successfully
- Workaround: use
sonar.exclusions
to prevent them from being analyzed - Problem: we currently have to keep using the LTS version and cannot upgrade to the latest 9.4 version
Here is a snippet of the logs:
ERROR: Error during SonarScanner execution
java.lang.IllegalStateException:
An error occurred while analyzing the following compilation unit
foo.cpp
...
at com.sonar.cpp.plugin.CFamilySensor.process(CFamilySensor.java:399)
at com.sonar.cpp.plugin.CFamilySensor.execute(CFamilySensor.java:175)
at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:48)
And we used the following command line to analyze our code:
dotnet dotnet-sonarscanner begin -k:"<key>" -d:sonar.login="$SONAR_TOKEN" -d:sonar.host.url="$SONAR_HOST_URL" -d:sonar.cfamily.build-wrapper-output="<out dir>" -d:sonar.cfamily.cpp20=true -d:sonar.cpp.std=c++20
build-wrapper-win-x86-64.exe --out-dir "<same out dir as the previous line>" MSBuild.exe xyz.sln -p:Configuration=Release -t:build
dotnet dotnet-sonarscanner end -d:sonar.login="$SONAR_TOKEN"
We have a dump file called sonar-cfamily-reproducer.zip
that could be useful to you and we may share it with you privately if you need.
The most simple code that crashes the scanner is less than 50 lines long and contains (AFAIK) no complex inheritance or C++20 feature except for being inside a module.
Edit: I see that some bug fixes have been applied to the version 8.9.8 LTS (which we haven’t installed yet). Do you think it could solve our issues with those C++20 modules?
Edit 2: We will upgrade to the version 8.9.8 LTS and get back to you as soon as possible.