1.4 Language compliance

The compiler provides several command-line options for either enforcing or relaxing compliance with the available source languages.

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 nonstrict C++.
  • C99-style designated initializers are available when the source language is either C90 or nonstrict C++.
To compile in GNU mode, use the compiler option --gnu.

Note

Some GNU extensions are also available when you are in a nonstrict mode.

Examples

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++03.
  • 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.
Related reference
7.74 --gnu
7.156 --strict, --no_strict
8.45 GNU extensions to the C and C++ languages
2.7 Filename suffixes recognized by the compiler
Chapter 14 Summary Table of GNU Language Extensions
Non-ConfidentialPDF file icon PDF versionARM DUI0375F
Copyright © 2007, 2008, 2011, 2012, 2014 ARM. All rights reserved.