2.3.12. Controlling error messages

The compiler issues errors to indicate serious problems in the code it is attempting to compile. The compiler options described below enable you to:

Caution

These options force the compiler to accept C and C++ source that normally produces errors. If you use any of these options to ignore error messages, it means that your source code does not conform to the appropriate C or C++ standard.

These options can be useful during development, or when importing source code from other environments. However, they might permit code to be produced that does not function correctly. It is generally better to correct the source than to use options to switch off error messages.

The general form of the -E compiler option is:


-E[options][+][options]

where options is a set of one or more of the letters a, c, f, i, l, p, or z as described below.

If the + character is included in the characters following the -E, the error messages corresponding to any following letters are enabled rather than suppressed.

Note

The -E option on its own without any options is the preprocessor switch. See Setting preprocessor options.

You can specify multiple options. For example:


-Eac

turns off the error messages specified by a and c.

The following options are on by default:

-Ea

For C++ only, this option downgrades access control errors to warnings. For example:

class A { void f() {}; };							// private member
A a;
void g() { a.f(); } 							// erroneous access


C3032E: ’A::f’ is a non-public member

-Ec

This option suppresses all implicit cast errors, such as implicit casts of a nonzero int to pointer.


C3029E: ’=’: implicit cast of non-0 int to pointer

-Ef

This option suppresses errors for unclean casts, such as short to pointer.

-Ei

For C++ only, this option downgrades from error to warning the use of implicit int in constructs such as const i;.

C2225W: declaration lacks type/storage-class (assuming 'int'): 'i'
-El

This option suppresses errors about linkage disagreements where functions are implicitly declared as extern and then later redeclared as static.


C2991E: linkage disagreement for ’f’ - treated as ’extern’

-Ep

This option suppresses errors arising as the result of extra characters at the end of a preprocessor line.

-Ez

This option suppresses the errors caused by zero-length arrays.


C3017E: size of a [] array required, treated as [1]

Copyright © 1999-2001 ARM Limited. All rights reserved.ARM DUI 0067D
Non-Confidential