Microsoft extension activated by “/openmp” is not supported

  • Operating system: Windows 10 Pro
  • Visual Studio version: Microsoft Visual Studio Professional 2022 (64-bit) Version 17.9.4
  • SonarLint plugin version: 7.8.0.88494
  • Programming language you’re coding in: C++
  • Is connected mode used: Yes
  • SonarQube version: 10.4.1

And a thorough description of the problem / question:
All our projects need the openmp library and have the /openmp compiler option.
SonarLint is currently not usable for our Windows developers due to the error:
Unsupported configuration: Microsoft extension activated by ‘/openmp’ is not supported.

Is there a way to disable the flag only for the SonarLint extension?
We thought about adding the environmental variable CL=“/openmp-” but it disables openmp for our Visual Studio builds as well.
Is there a way to pass an environmental variable only to SonarLint?
What other options do we have except for disabling openmp from our projects?

Hey @aroubies,

As the error is saying, our C++ analyzer doesn’t support OpenMP.

Is there a way to pass an environmental variable only to SonarLint?

Trying to circumvent this by telling SonarLint that you are not using OpenMP while you are, defeats the point and will lead to inaccurate analysis. This is because the C++ analyzer doesn’t understand OpenMP constructs.

Thanks,

Thanks for the response,

let’s suppose that I don’t mind getting an inaccurate analysis, due to the fact that only few files use the OpenMP constructs.
What would be the proper way to go about this?
I’ve tried using the CL environmental variable but the build is problematic.
I understand that this is low in your plans and currently we don’t have any alternative for using the tool.

@aroubies,

In that case, I suggest removing the /openmp on all files, and only setting it on the few files that actually need it. This way only a few files aren’t going to be analyzed.

I understand that this is low in your plans and currently we don’t have any alternative for using the tool.

I suggest adding your insight here, we might consider supporting OpenMP soon if there is enough traction.

Thanks,