Datasheet
C and C++ Compilers
2-34 Copyright © 1999-2001 ARM Limited. All rights reserved. ARM DUI 0067D
struct Base { virtual void f(); };
struct Derived : Base { void f(); };
generates the following warning:
C2997W: 'Derived::f()' inherits implicit virtual from 'Base::f()'
Adding the
virtual
keyword in the derived class prevents the warning.
-Ws
This option suppresses warnings generated when the compiler inserts
padding in a
struct
. For example:
C2221W: padding inserted in struct 's'
This warning is off by default. It can be enabled with
-W+s
.
-Wt
This option suppresses the unused
this
warning. This warning is issued
when the implicit
this
argument is not used in a non-static member
function. It is applicable to C++ only. The warning can also be avoided
by making the member function a static member function. The default is
off. For example:
struct T {
int f() { return 42; }
};
results in the following warning:
C2924W: 'this' unused in non-static member function
To avoid the warning, use
static int f() ...
-Wu
For C code,
-Wu
suppresses warnings about future compatibility with
C++. Warnings are suppressed by default. You can enable them with
-W+u
.
For example:
int *new(void *p) { return p; }
results in the following warnings:
C2204W: C++ keyword used as identifier: 'new'
C2920W: implicit cast from (void *), C++ forbids
-Wv
This option suppresses warning messages of the type:
C2218W: implicit 'int' return type for 'f' - 'void' intended?
This is usually caused by a return from a function that was assumed to
return
int
, because no other type was specified, but is being used as a void
function. This is widespread in old-style C. Such action always results in
an error in C++.
-Wx
This option suppresses unused declaration warnings such as:
C2870W: variable 'y' declared but not used