Specifying compiler options

Compiler options perform a wide variety of functions, such as setting compiler characteristics, describing the object code and compiler output to be produced, and performing some preprocessor functions. You can specify compiler options in one or more of the following ways:

The compiler uses default settings for the compiler options not explicitly set by you in these listed ways. The defaults can be compiler defaults, installation defaults, or the defaults set by the c89 utility or the xlc utility. The compiler defaults are overridden by installation defaults, which are overridden by the defaults set by the c89 utility or the xlc utility.

When specifying compiler options, it is possible for option conflicts and incompatibilities to occur. z/OS® XL C/C++ resolves most of these conflicts and incompatibilities in a consistent fashion, as follows:

 Source  overrides    Command   overrides   Configuration    overrides   Default
  file  ----------->   line    ---------->      file        -----------> settings

Options that do not follow this scheme are summarized in the following table:

Table 1. Compiler option conflict resolution
Option Conflicting Options Resolution
-qxref -qxref=FULL -qxref=FULL
-qattr -qattr=FULL -qattr=FULL
-E -o -E
-# -v -#
-F -B | -t |-W | -qpath| configuration file settings -B| -t | -W |-qpath
-qpath -B| -t -qpath overrides -B and -t

In general, if more than one variation of the same option is specified (with the exception of xref and attr), the compiler uses the setting of the last one specified. Compiler options specified on the command line must appear in the order you want the compiler to process them.

If a command-line flag is valid for more than one compiler program (for example -B, -W, or -I applied to the compiler, binder, and assembler program names), you must specify it in options, or asopt in the configuration file. The command-line flags must appear in the order that they are to be directed to the appropriate compiler program.

Three exceptions to the rules of conflicting options are the -Idirectory or -I//dataset_name, -llibrary, and -Ldirectory options, which have cumulative effects when they are specified more than once.