Question about scanning C/C++ and build-wrapper


I have a general question about the integration with GitHub. The build-wrapper complicates some of our build processes. We were wondering if the integration with github no longer requires build-wrapper to scan C/C++ code. Really, we’re just looking at what our options are to scan C/C++ code without using build-wrapper. I know this has come up in the past, but I couldn’t find out whether or not the github integration removes the need for the build-wrapper.

Hello @Blake_Kizer,

The build wrapper is required to analyze C or C++ code, no matter what integration you use.

When analyzing one of our project, we don’t think that using the build wrapper significantly complicates the process. Could you share what is the problem you have?

Hello @JolyLoic, thanks for the quick response.

The question of whether build wrapper was required came up in a discussion of building for multiple OSes from the same source code, and whether we could avoid scanning the same code more than once by scanning a code repository instead of a following the output of a build.

The build wrapper purpose is to capture the exact configuration of the code. If your code is build for different OSes, different macros will be defined, different #if will be enabled, and the build wrapper tracks this information. As a consequence, the same code may contain some issues with some Os that are not present for some others.

Therefore, I see basically two strategies:

  • You want to analyze all variants of your code, on all OSes. For that, you will have to create different projects, one per OS, with one build wrapper per project (this usually happens quite naturally, because one will be generated on each build machine, and can only become a concern if you do cross compilation). Note that in that case the projects will be totally independent: Lines of code are counted for each project, issues have to be closed on each project…
  • You consider that the code is similar enough on different platforms that you’d rather not pay the costs associated with several projects. In that case, you should run the build wrapper only for one OS, and not for the other ones.

Hope this helps!