2.3.6. Setting preprocessor options

These options are used for controlling aspects of the preprocessor. (See Pragmas for descriptions of other preprocessor options that can be set by pragmas.)

-E

Executes only the preprocessor phase of the compiler. By default, output from the preprocessor is sent to the standard output stream and can be redirected to a file using standard MS-DOS notation, for example:


armcc -E source.c > raw.c

You can also use the -o option to specify a file for the preprocessed output (see Specifying output format). By default, comments are stripped from the output. The preprocessor accepts source files with any extension (for example, .o, .s, and .txt). See also the -C option.

-C

Retains comments in preprocessor output when used in conjunction with -E, and must be specified after -E. The -C option does not request preprocessing output when used alone.

This option differs from the -c (lowercase) option that suppresses the link step. See Specifying output format for a description of the -c option.

-M

Executes only the preprocessor phase of the compiler (see the -E option). This option produces a list of make file dependency lines suitable for use by a make utility. By default, output is on the standard output stream. You can redirect output to a file by using standard MS-DOS notation, for example:


armcc -M source.c > Makefile

If you specify multiple source files, a single dependency file is created.

If you specify the -o filename option (see Specifying output format), the dependency lines generated on standard output refer to filename.o, and not to source.o. However, no object file is produced with the combination of -M -o filename.

Use the --md option to generate dependency lines and object files for each source file.

-Dname [ (parm-list) ] [ =def ]

Defines a macro name as def. If =def is omitted, the compiler defines name to expand as the value 1. You can define function-style macros by appending a macro parameter list to name. The compiler defines macro names based on the command-line options. For a list, see Predefined macros.

-Uname

Removes any initial definition of the macro name. This has the same effect as the text #undef name at the head of the source file. You can repeat this option.

Ordering macro definitions

Where you specify macro options, the compiler defines and undefines macros in the following order:

  1. compiler predefined macros (see Predefined macros).

  2. macros defined explicitly, using -Dname.

  3. macros explicitly undefined, using -Uname.

Copyright © 2005 ARM Limited. All rights reserved.ARM DUI 0282B
Non-Confidential