2.3.5. Setting preprocessor options

The following command-line options control aspects of the preprocessor. (See Pragmas for descriptions of other preprocessor options that can be set by pragmas.)

-E

This option 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:

compiler-name -E source.c > raw.c

You can also use the -o option to specify a file for the preprocessed output. 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

This option retains comments in preprocessor output when used in conjunction with -E. This option differs from the -c (lowercase) option that suppresses the link step. See Specifying output format for a description of the -c option.

-D, symbol=value

This option defines symbol as a preprocessor macro. This has the same effect as the text #define symbol value at the head of the source file. You can repeat this option.

If you use a quoted string value, for example -DFOO_VALUE="FOO_VALUE", you must delimit the quotes as follows:

  • from the command line, use -DFOO_VALUE=\"FOO_VALUE\"

  • in a via file, use ’-DFOO_VALUE="FOO_VALUE"’ or -DFOO_VALUE=’"FOO_VALUE"’.

-Dsymbol

This option defines symbol as a preprocessor macro. This has the same effect as the text #define symbol at the head of the source file. You can repeat this option. The default value of symbol is 1.

-M

This option executes only the preprocessor phase of the compiler, as with -E. This option produces a list of makefile 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:

compiler-name -M source.c >> Makefile

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

-Usymbol

This option undefines symbol. This has the same effect as the text #undef symbol at the head of the source file. You can repeat this option.

Copyright © 2001, 2002 ARM Limited. All rights reserved.ARM DUI 0171B
Non-Confidential