## Macros Tab

C source code is often sprinkled with pre-processor directives providing instructions and options to the C compiler. Directives such as the following affect what the software does and how it should be parsed:

    #define INSTRUMENT_CODE
    #ifdef INSTRUMENT_CODE
    ... statements ...
    #endif

The Macros tab in the Project Configuration dialog (which you open with Project->Configure) allows you to define preprocessor macros that are used when compiling the code.

Macros are often defined with directives (#define) in include files (.h files) or are passed in via the compiler (typically with the -D option).

For Understand for C++ to successfully analyze your software it needs to know what macro definitions should be set.

To define macros, select the Macros tab of the Project Configuration dialog.

The Macros tab lists macros and their optional definitions. Each macro may be edited or deleted. To define a preprocessor value in the Macros tab, type the macro and any value for the macro and click Add.

Note that a macro must have a name, but that the definition is optional. Macros that are defined but have no definition value are commonly used in conjunction with #ifdef pre-processor statements to see if macros are defined.

To change the definition of an existing macro without changing the name, select the macro, modify the definition, and press Add.

To use an existing macro as the basis for a new one, select the macro, edit the definition and the name, and press Add. This creates a new macro.

Tip: If you have a lot of macros or they are generated by another process, you can add macros in bulk by specifying a file prefixed by an @ sign. For example, “@mydefs.txt”. This file should contain macro definitions in any of the following formats:

    #define foo bar
    foo=bar
    foo bar

All of these formats define a macro “foo” to be “bar”.

Note that these files can also be used with the command line analyzer “undc” described in Command Line Processing

Scientific Toolworks, Inc. http://www.scitools.com