2.3.3. Setting the source language

This section describes options that determine the source language variant accepted by the compiler (see also Controlling code generation ).

These options enable you to specify the compilation language used by the compiler, and to determine how strictly the compiler enforces the standards and conventions of that language. By default, the compiler compiles ISO C code. For C++ code, the compiler compiles as much as it can of ISO/IEC C++. For details on the default language assumed by the compiler, based on filename extension, see Invoking the ARM compiler.

The following options are used for setting the source language:

--old_cfe

Enables compilation using the legacy C compiler front-end. See Appendix E Older Compiler Options for more details of the older compiler options that are still supported.

--cpp

Enables compilation of ISO/IEC C++. This is the default for *.cpp files.

--c90

Enables compilation of C rather than C++, specifically the C90 ISO version of C. This is the default for *.c files.

The default mode is a fairly strict ISO compiler, but without some of the inconvenient features of the ISO standard. Some minor extensions are also supported, for example // in comments and $ in identifiers.

--nostrict

Relaxes the ISO language conformance. This is the default.

--strict_warnings --strict

Enables strict ISO mode (ISO/IEC 9899:1990 (E)) and the C++ standard (ISO/IEC 14882:1998 (E)). Diagnostic messages are returned when nonstandard features are used, and features that conflict with ISO C or C++ are disabled. This is compatible in both C and C++ mode.

ISO violations can be issued as either warnings or errors, depending on the command-line option you use. The --strict option causes errors to be issued, whereas the --strict_warnings option produces warnings. The error threshold is set so that the requested diagnostics are returned (see Diagnostic messages).

For example, the following code segment returns an error when compiled with --cpp --strict, but only a warning with --cpp:

static struct T {int i; };

Because no object is declared, static is spurious. Therefore, in the C++ standard, this code segment is invalid.

--anachronisms --no_anachronisms

Enables or disables anachronisms in C++ mode. This option is valid only in C++ mode. See Anachronisms for a complete description of anachronisms.

The default for this option is --no_anachronisms.

You can combine language options:

armcc --c90

Compiles ISO standard C. This is the default.

armcc --strict

Compiles strict ISO standard C.

armcpp

Compiles standard C++.

armcpp --c90

Compiles normal ISO standard C (C mode of C++).

armcpp --c90 --strict

Compiles strict ISO standard C (C mode of C++).

armcpp --strict

Compiles strict C++.

Copyright © 2003, 2004 ARM Limited. All rights reserved.ARM DUI 0232B
Non-Confidential