Since inactive regions of the code can contain just about anything, by default the code is completely skipped by the parser.
The most common reason to want to analyze inactive code is for metrics calculations, i.e. wanting the total number of Lines of Code instead of just the active lines of code. The metrics that begin with “Alt” contain the inactive lines as well as active, so in this case the metric AltCountLineCode would return the desired result. If your primary interest in inactive code is the metrics, than the Alt metrics should suffice.
Alternatively, the option “Create references in inactive code” in Project->Configure-> C++ Options causes the parser to do a text only search of the inactive code and tries to find matches to existing objects. No parsing occurs, simply a text match. If the object is not used previously in active code, then there will be no existing object to match against, so the reference will not be recorded. Additionally, if a reference is found, it won’t show up as a declare or define, it will show up as an “inactive use”. Make sure you have this option turned on, and see if it meets your needs, since it is much safer.
Finally, there is a hidden option to activate all code, but since treating all code as active can quickly lead to improperly parsed code and lots of problems, we keep that option hidden. For example, consider the following code:
#ifdef MACRO1 void somefunction(int a){ #else int somefunction(varchar b){ #endif int c=1; }
which would yield the following (very invalid) code:
void somefunction(int a){ int somefunctions(varchar b){ int c=1; }
This is a very trivial example, but you end up with an improperly formatted function with two conflicting header definitions, which will cause parsing problems and invalid metrics as well as navigation problems when you try to jump to the source definition, etc.
To enable this (risky) option use the following syntax from the command line:
und -db myproject.udb settings -c++IgnorePreprocessorConditionals on analyze
This will reparse the project with inactive references enabled. To disable, run the same command with the off parameter.
This only works with the Fuzzy parser.