How to handle conditional compiler code?

SonarQube Enterprise 8.9.9 edition.

How does SQ handle conditional compiled code? For example, we may have a file that is included in all three flavors of the COM (let’s say it’s called MyFile.cpp), however, inside MyFile.cpp we may have code like this:

#ifdef COMv3
…some code here for the COMv3 only…
…some code here for COMv1 & COMv2

Our Makefile for the COMv3 would pass in a #define (-DoCOMv3) which tells the compiler to include the first chunk of code above. If 'COMv3 is not defined (i.e., the Makefile does not pass in ‘-DoCOMv3’) then the second chunk of code is compiled.

Can SQ handle traversing the proper code path based on if it’s scanning for COMv1 , COMv2 or COMv3 ?

I am closing this thread as a duplicate of


Please do not raise duplicate threads. It is against the rules of this community – and quite simply, annoying.