There is a pre-processor directive in GCC called #warning, which simply issues a warning at compile time with the string that is attached. The GCC documentation says that this can be disabled with the -Wno-cpp
flag. However, this flag does not seem to function. I am using
GCC 4.4.3.
A simple test case is this:
#include <iostream>
#warning "Hello"
int main() {
}
which results in this:
$ g++ warn.cc
warn.cc:2:2: warning: #warning "Hello"
$ g++ warn.cc -Wno-cpp
warn.cc:2:2: warning: #warning "Hello"
Is the documentation wrong?
Wno-cpp
apparently wasn't added until GCC 4.6.x - it's not in the docs up through those for version 4.5.3: http://gcc.gnu.org/onlinedocs/gcc-4.5.3/gcc/index.html#toc_Invoking-GCC
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With