| |||
| Home > Using the ARM Compiler > Command syntax > 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_cfeEnables 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.
--cppEnables
compilation of ISO/IEC C++. This is the default for *.cpp files.
--c90Enables
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.
--nostrictRelaxes the ISO language conformance. This is the default.
--strict_warnings
--strictEnables 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_anachronismsEnables 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 --c90Compiles ISO standard C. This is the default.
armcc --strictCompiles strict ISO standard C.
armcppCompiles standard C++.
armcpp --c90Compiles normal ISO standard C (C mode of C++).
armcpp --c90 --strictCompiles strict ISO standard C (C mode of C++).
armcpp --strictCompiles strict C++.