I am familiar with warning suppressing pragmas for GCC and Keil (they are different, but the usage is pretty much the same). For a third-party headers I can do something like this:
#pragma push
#pragma suppress warning
#include "whatever.h"
#pragma pop
But how can I suppress warnings from third-party sources? Both Eclipse+GCC and Keil generate them. The only solution I came up is making whapper .c-file, which will include other .c files, which seems to be very dirty trick.
Are there any other solutions?
If we don't want to fix the warning, then we can suppress it with the @SuppressWarnings annotation. This annotation allows us to say which kinds of warnings to ignore. While warning types can vary by compiler vendor, the two most common are deprecation and unchecked.
Turn off the warning for a project in Visual StudioSelect the Configuration Properties > C/C++ > Advanced property page. Edit the Disable Specific Warnings property to add 4996 . Choose OK to apply your changes.
-Wno-coverage-mismatch can be used to disable the warning or -Wno-error=coverage-mismatch can be used to disable the error. Disabling the error for this warning can result in poorly optimized code and is useful only in the case of very minor changes such as bug fixes to an existing code-base.
Use a #pragma warning (C#) or Disable (Visual Basic) directive to suppress the warning for only a specific line of code.
with gcc , while compiling you can use -w option to suppress warnings.
-w : Inhibit all warning messages.
Example:
gcc -w third_party_sourcefile.c
You may want to use -isystem
instead of -Idir
third party headers. See GCC manual.
If you're ok to edit third party source files, you can use #pragma GCC diagnostic ignored "-Wwarning-to-disable"
see GCC manual.
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