Invoking the preprocessor

Preprocessing manipulates the text of a source file, usually as a first phase of translation that is initiated by a compiler invocation. Common tasks accomplished by preprocessing are macro substitution, testing for conditional compilation directives, and file inclusion. XL C/C++ is an integrated, single-pass compiler, which retains the ability to function as a multiple-pass compiler through the use of compiler options. The XL C/C++ preprocessor is provided as an independent compiler component.

The preprocessor can be invoked separately to process text without compiling. The output is an intermediate file, which can be input for subsequent translation. Preprocessing without compilation can be useful as a debugging aid because it provides a way to see the result of include directives, conditional compilation directives, and complex macro expansions.

The following table lists the options that direct the operation of the preprocessor.

Option Description
E Instructs the compiler to preprocess the source files. #line directives are generated.
P Preprocesses the C or C++ source files specified in the compiler invocation and create an intermediary file with .i file name extension for each source file.
C Preserves comments in preprocessed output.
D Defines a macro name from the command line, as if in a #define directive.
U Undefine a macro name defined by the compiler or by the -D option.