Resolving conflicting compiler options

In general, if more than one variation of the same option is specified (with the exception of -qxref and -qattr), 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.

Two exceptions to the rules of conflicting options are the -Idirectory and -Ldirectory options, which have cumulative effects when they are specified more than once.

In most cases, the compiler uses the following order in resolving conflicting or incompatible options:

  1. Pragma statements in source code will override compiler options specified on the command line.
  2. Compiler options specified on the command line will override compiler options specified in a configuration file. If conflicting or incompatible compiler options are specified on the command line, the option appearing later on the command line takes precedence.
  3. Compiler options specified in a configuration file will override compiler default settings.

Not all option conflicts are resolved using the above rules. The table below summarizes exceptions and how the compiler handles conflicts between them.

Option Conflicting options Resolution
-qhalt Multiple severities specified by -qhalt Lowest severity specified
-qnoprint -qxref | -qattr | -qsource | -qlistopt | -qlist -qnoprint
-qfloat=rsqrt -qnoignerrno Last option specified
-qxref -qxref=FULL -qxref=FULL
-qattr -qattr=FULL -qattr=FULL
-p | -pg | -qprofile -p | -pg | -qprofile Last option specified
-qhsflt -qrndsngl | -qspnans -qhsflt
-qhssngl -qrndsngl | -qspnans -qhssngl
-E -P | -o | -S -E
-P -c | -o | -S -P
-# -v -#
-F -B | -t | -W | -qpath | configuration file settings -B | -t | -W | -qpath
-qpath -B | -t -qpath overrides -B and -t
-S -c -S

Related information