1.3.2. Language compliance

The compiler has several modes in which compliance to a source language is either enforced or relaxed:

Strict mode

In strict mode the compiler enforces compliance with the language standard relevant to the source language. For example, the use of //-style comments results in an error when compiling strict C90.

To compile in strict mode, use the command-line option --strict.

GNU mode

In GNU mode all the GNU compiler extensions to the relevant source language are available. For example, in GNU mode:

  • case ranges in switch statements are available when the source language is any of C90, C99 or non-strict C++

  • C99-style designated initializers are available when the source language is either C90 or non strict C++.

To compile in GNU mode, use the compiler option --gnu.

Note

Some GNU extensions are also available when you are in a non-strict mode.

Example

The following examples illustrate combining source language modes with language compliance modes:

  • Compiling a .cpp file with the command-line option --strict compiles Standard C++

  • Compiling a C source file with the command-line option --gnu compiles GNU mode C90

  • Compiling a .c file with the command-line options --strict and --gnu is an error.

See also

Copyright © 2007, 2010 ARM Limited. All rights reserved.ARM DUI 0348A
Non-Confidential