Datasheet

C and C++ Compilers
ARM DUI 0067D Copyright © 1999-2001 ARM Limited. All rights reserved. 2-31
2.3.10 Controlling warning messages
The compiler issues warnings about potential portability problems and other hazards.
The compiler options enable you to turn off specific warnings. For example, you can
turn off warnings if you are in the early stages of porting a program written in old-style
C. In general, it is better to check the code than to switch off warnings.
The options are on by default, unless specified otherwise.
See also Specifying additional checks on page 2-35 for descriptions of additional
warning messages.
The general form of the
-W
compiler option is:
-W[options][+][options]
where the
options
field contains zero or more characters.
If the
+
character is included in the characters following the
-W
, the warnings
corresponding to any following letters are enabled rather than suppressed.
You can specify several options at the same time. For example:
-Wad+fg
turns off the warning messages specified by
a
and
d
, and turns on the warning messages
specified by
f
and
g
.
The warning message options are as follows:
-W
This option suppresses all warnings. If one or more letters follow the
option, only the warnings controlled by those letters are suppressed.
-Wa
This option suppresses the warning:
C2961W: Use of the assignment operator in a condition context
This warning is normally given when the compiler finds a statement such
as:
if (a = b) {...
where it is possible that one of the following is intended:
if ((a = b) != 0) {...
if (a == b) {...
-Wb
This option suppresses the warning messages that are issued for
extensions to the ANSI standard. Examples include:
using an unwidened type in an ANSI C assignment
specifying bitfields with a type of
char
,
short
,
long
, or
long long