Most options specified on the command line override both the default settings of the option and options set in the configuration file. Similarly, most options specified on the command line are in turn overridden by options set in the source file. Options that do not follow this scheme are listed in Resolving Conflicting Compiler Options.
There are two kinds of command-line options:
Command-line options in the -qoption_keyword format are similar to on and off switches. If the option is specified more than once, the last instance is recognized by the compiler. For example, -qsource turns on the source option to produce a compiler listing; -qnosource turns off the source option, so no source listing is produced. For example:
xlC -qnosource MyFirstProg.c -qsource MyNewProg.c
would produce a source listing for both MyNewProg.c and MyFirstProg.c because the last source option specified (-qsource) takes precedence.
You can have multiple -qoption_keyword instances in the same command line, but they must be separated by blanks. Option keywords can appear in either uppercase or lowercase, but you must specify the -q in lowercase. You can specify any -qoption_keyword before or after the file name. For example:
xlC -qLIST -qnomaf file.c xlC file.c -qxref -qsource
Some options have suboptions. You specify these with an equal sign following the -qoption. If the option permits more than one suboption, a colon (:) must separate each suboption from the next. For example:
xlC -qflag=w:e -qattr=full file.c
compiles the C source file file.c using the option -qflag to specify the severity level of messages to be reported, the suboptions w (warning) for the minimum level of severity to be reported on the listing, and e (error) for the minimum level of severity to be reported on the terminal. The option -qattr with suboption full will produce an attribute listing of all identifiers in the program.
The compilers available on AIX systems use a number of common conventional flag options. VisualAge C++ supports these flags. Lowercase flags are different from their corresponding uppercase flags. For example, -c and -C are two different compiler options: -c specifies that the compiler should only preprocess and compile and not invoke the linkage editor, while -C can be used with -P or -E to specify that user comments should be preserved.
IBM VisualAge C++ also supports flags directed to other AIX programming tools and utilities (for example, the AIX ld command). The compiler passes on those flags directed to ld at link-edit time.
Some flag options have arguments that form part of the flag. For example:
xlC stem.c -F/home/tools/test3/new.cfg:myc -qproclocal=sort:count
where new.cfg is a custom configuration file.
You can specify flags that do not take arguments in one string. For example:
xlC -Ocv file.c
has the same effect as:
xlC -O -c -v file.c
and compiles the C source file file.c with optimization ( -O) and reports on compiler progress ( -v), but does not invoke the linkage editor ( -c).
A flag option that takes arguments can be specified as part of a single string, but you can only use one flag that takes arguments, and it must be the last option specified. For example, you can use the -o flag (to specify a name for the executable file) together with other flags, only if the -o option and its argument are specified last. For example:
xlC -Ovotest test.c
has the same effect as:
xlC -O -v -otest test.c
Most flag options are a single letter, but some are two letters. Note that -pg (extended profiling) is not the same as -p -g (profiling, -p, and generating debug information, -g). Take care not to specify two or more options in a single string if there is another option that uses that letter combination.
Batch Compiler Options
Invoke the Batch Compiler
Specify Compiler Options in Your Source Program
Specify Batch Compiler Options in a Configuration File
Resolving Conflicting Compiler Options
List of Batch Compiler Options and Their Defaults