Questions tagged [suppress-warnings]

Compilers and interpreters commonly warn about miscellaneous conditions. Suppressing some or all of those warnings may help to reduce the 'noise' a compiler emits.

Compilers and interpreters commonly warn about miscellaneous conditions. Suppressing some or all of those warnings may help to reduce the 'noise' a compiler emits.

Common warnings may be deprecation warnings or the use of an undefined value.

790 questions
37
votes
1 answer

Add @SuppressWarnings("unchecked") in generics to single line generates eclipse compiler error

I have stumbled upon a strange behavior that I don't understand. I have to cast a String to a generic and it's producing a warning. Type safety : Unchecked cast from String to T If I add @SuppressWarnings("unchecked")above the method…
user425367
37
votes
3 answers

How do you tell Valgrind to completely suppress a particular .so file?

I'm trying to use Valgrind on a program that I'm working on, but Valgrind generates a bunch of errors for one of the libraries that I'm using. I'd like to be able to tell it to suppress all errors which involve that library. The closest rule that I…
Jonathan M Davis
  • 37,181
  • 17
  • 72
  • 102
36
votes
1 answer

Java: suppress warning "X is marked unstable"

I am using the com.google.common.net.MediaType class from the Google Guava library and it is marked as @Beta. I'd like to suppress warnings that this is marked as unstable. What's the @SuppressWarnings key do I need to use?
Kousha
  • 32,871
  • 51
  • 172
  • 296
34
votes
5 answers

Suppressing "null device" output with R in batch mode

I have a number of bash scripts which invoke R scripts for plotting things. Something like: #!/bin/bash R --vanilla --slave <
blahdiblah
  • 33,069
  • 21
  • 98
  • 152
33
votes
3 answers

How do I get warnings.warn to issue a warning and not ignore the line?

I'm trying to raise a DeprecationWarning, with a code snippet based on the example shown in the docs. http://docs.python.org/2/library/warnings.html#warnings.warn Official def deprecation(message): warnings.warn(message, DeprecationWarning,…
Damgaard
  • 922
  • 1
  • 9
  • 17
33
votes
6 answers

How can I disable a specific warning for a C# project in VS2012?

I am trying to generate partial XML documentation during my build process for a C# project in VS2012. When I check the XML documentation file option in Project->Properties->Build, I get a build warning for each public member that lacks…
ChaseMedallion
  • 20,860
  • 17
  • 88
  • 152
32
votes
2 answers

suppress messages displayed by "print" instead of "message" or "warning" in R

Many R packages I work with involve functions that give all their messages and warnings through commands to print() calls rather than commands to message() or warning(). I'd like to be able to silence these functions progress indicators, etc, but…
cboettig
  • 12,377
  • 13
  • 70
  • 113
31
votes
3 answers

Disabling a specific compiler warning in VS Code

I want to know how to suppress a specific compiler warning within VS Code for the entire project. I have seen this queston: Is it possible to disable specific compiler warnings? but it is for Visual studio, not Visual Studio Code. Here are the…
31
votes
4 answers

Disabling a specific warning in a specific line in Xcode

I'm writing an iPhone app against the Base 4.0 SDK, but I'm targeting OS 3.1.3 so OS 3 users can use the app. I call: [[UIApplication sharedApplication] setStatusBarHidden:YES animated:YES]; which is deprecated in iOS 4.0. I'm aware of this, and…
David Coufal
  • 6,021
  • 5
  • 28
  • 30
31
votes
2 answers

How to suppress FindBugs warnings for fields or local variables?

I would like to suppress FindBugs warnings for specific fields or local variables. FindBugs documents that the Target can be Type, Field, Method, Parameter, Constructor, Package for its edu.umd.cs.findbugs.annotations.SuppressWarning annotation…
Christian Esken
  • 472
  • 1
  • 4
  • 11
31
votes
1 answer

Suppress -Wunknown-pragmas warning in GCC

I try to ignore warnings coming from some 3rd party header files like this: #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wunknown-pragmas" #pragma GCC diagnostic ignored "-Wreorder" #include #pragma GCC…
Robert Hegner
  • 9,014
  • 7
  • 62
  • 98
30
votes
4 answers

How to eliminate external lib/third party warnings in GCC

In the software project I'm working on, we use certain 3rd party libraries which, sadly, produce annoying gcc warnings. We are striving to clean all code of warnings, and want to enable the treat-warnings-as-errors (-Werror) flag in GCC. Is there a…
Michael
  • 2,826
  • 4
  • 25
  • 18
28
votes
5 answers

How to suppress Java compiler warnings for specific functions

We are always taught to make sure we use a break in switch statements to avoid fall-through. The Java compiler warns about these situations to help us not make trivial (but drastic) errors. I have, however, used case fall-through as a feature (we…
26
votes
6 answers

Suppress a warning for all projects in Visual Studio

I've seen answers showing how to suppress a warning for a specific line of code or for a specific project. I don't want that. I want to suppress a specific warning for all of my projects. (If it matters, the warning is IDE0044. And I'm using C#.)
ispiro
  • 26,556
  • 38
  • 136
  • 291
26
votes
6 answers

Disable go vet checks for "composite literal uses unkeyed fields"

I'm running go vet on my CI tool, and started getting the error: composite literal uses unkeyed fields Because I'm instantiating type A struct { *B } like this: A{b} // b is of type *B I don't care for this warning, and want to disable it on…
Matt Joiner
  • 112,946
  • 110
  • 377
  • 526