You copied the Doc URL to your clipboard.

Order of compiler command-line options

In general, compiler command-line options can appear in any order in a single compiler invocation. However, the effects of some options depend on the order they appear in the command line and how they are combined with other related options, for example, optimization options prefixed by -O, or PreCompiled Header (PCH) options.

The compiler enables you to use multiple options even where these might conflict. This means that you can append new options to an existing command line, for example, in a makefile or a via file.

Where options override previous options on the same command line, the last option specified always takes precedence. For example:

armcc -O1 -O3 -Ospace -Otime ...

is executed by the compiler as:

armcc -O3 -Otime

The environment variable ARMCCn_CCOPT can be used to specify compiler command-line options. Options specified on the command line take precedence over options specified in the environment variable.

To see how the compiler has processed the command line, use the --show_cmdline option. This shows nondefault options that the compiler used. The contents of any via files are expanded. In the example used here, although the compiler executes armcc -O2 -Otime, the output from --show_cmdline does not include -O2. This is because -O2 is the default optimization level, and --show_cmdline does not show options that apply by default.