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.
suppress-warnings
803
questions
897
votes
14
answers
2.0m
views
How to disable Python warnings?
I am working with code that throws a lot of (for me at the moment) useless warnings using the warnings library. Reading (/scanning) the documentation I only found a way to disable warnings for single ...
567
votes
15
answers
862k
views
Suppress InsecureRequestWarning: Unverified HTTPS request is being made in Python2.6
I am writing scripts in Python2.6 with use of pyVmomi and while using one of the connection methods:
service_instance = connect.SmartConnect(host=args.ip,
user=...
502
votes
11
answers
501k
views
What is SuppressWarnings ("unchecked") in Java?
Sometime when looking through code, I see many methods specify an annotation:
@SuppressWarnings("unchecked")
What does this mean?
325
votes
10
answers
199k
views
What is the list of valid @SuppressWarnings warning names in Java?
What is the list of valid @SuppressWarnings warning names in Java?
The bit that comes in between the ("") in @SuppressWarnings("").
284
votes
7
answers
188k
views
gcc warning" 'will be initialized after'
I am getting a lot of these warnings from 3rd party code that I cannot modify.
Is there a way to disable this warning or at least disable it for certain areas (like #pragma push/pop in VC++)?
Example:...
277
votes
6
answers
374k
views
How to suppress Pandas Future warning?
When I run the program, Pandas gives 'Future warning' like below every time.
D:\Python\lib\site-packages\pandas\core\frame.py:3581:
FutureWarning: rename with inplace=True will return None from ...
217
votes
7
answers
176k
views
Is there a way to ignore a single FindBugs warning?
With PMD, if you want to ignore a specific warning, you can use // NOPMD to have that line be ignored.
Is there something similar for FindBugs?
170
votes
3
answers
69k
views
Combining multiple @SuppressWarnings annotations - Eclipse Indigo
So the issue is being able to combine multple warning suppressions so that each item doesn't need its own @SuppressWarnings annotation.
So for example:
public class Example
public Example() {
...
169
votes
10
answers
67k
views
How to suppress GCC warnings from library headers?
I have a project that uses log4cxx, boost, etc. libraries whose headers generate lots of (repetitive) warnings. Is there a way to suppress warnings from library includes (i.e. #include <some-header....
138
votes
7
answers
101k
views
Suppress deprecated import warning in Java
In Java, if you import a deprecated class:
import SomeDeprecatedClass;
You get this warning: The type SomeDeprecatedClass is deprecated
Is there a way to suppress this warning?
131
votes
4
answers
58k
views
Mark unused parameters in Kotlin
I am defining some functions to be used as callbacks and not all of them use all their parameters.
How can I mark unused parameters so that the compiler won't give me warnings about them?
128
votes
6
answers
72k
views
Disable messages upon loading a package
I have a package in R (ROCR) that I need to load in my R environment. Upon loading the package, a set of messages are printed. This is ordinarily fine, but since the output of my R script is being ...
127
votes
9
answers
90k
views
Is there a way to suppress warnings in Xcode?
Is there a way to suppress warnings in Xcode?
For example I am calling an undocumented method and since the method is not in the header I get a warning on compile. I know I can add it to my header to ...
118
votes
4
answers
77k
views
Suppressing "is never used" and "is never assigned to" warnings in C#
I have a HTTPSystemDefinitions.cs file in C# project which basically describes the older windows ISAPI for consumption by managed code.
This includes the complete set of Structures relevant to the ...
118
votes
13
answers
40k
views
How to suppress Java warnings for specific directories or files such as generated code
I'm using a parser generator that creates somewhat ugly code. As a result my Eclipse project has several dozen warnings emanating from generated source files. I know I can use the @SuppressWarning ...
94
votes
4
answers
121k
views
What do @SuppressWarnings("deprecation") and ("unused") mean in Java?
What do these lines in my Java or Android project mean?
@SuppressWarnings("deprecation")
@SuppressWarnings("unused")
91
votes
5
answers
48k
views
How to disable warnings for particular include files?
I wold like to disable particular warnings for all files that are included, directly or indirectly, by particular include files. For example, I want to disable the warning "you are assigning a string ...
89
votes
3
answers
303k
views
Suppress console output in PowerShell
I have a call to GPG in the following way in a PowerShell script:
$key = & 'gpg' --decrypt "secret.gpg" --quiet --no-verbose > $null
I don't want any output from GPG to be seen on the main ...
86
votes
6
answers
137k
views
How do I suppress shell script error messages?
In my shell script I got these lines:
rm tempfl.txt
rm tempfl2.txt
If these do not exist I get the error messages:
rm: tempfl2.txt: No such file or directory
rm: tempfl.txt: No such file or directory
...
81
votes
7
answers
60k
views
Exclude all permission denied messages from "du"
I am trying to evaluate the disk usage of a number of Unix user accounts.
Simply, I am using the following command:
du -cBM --max-depth=1 | sort -n
But I’ve seen many error message like below. How ...
80
votes
2
answers
68k
views
Ignore divide by 0 warning in NumPy
I have a function for statistic issues:
import numpy as np
from scipy.special import gamma as Gamma
def Foo(xdata):
...
return x1 * (
( #R is a numpy vector
...
77
votes
4
answers
53k
views
What does casting to `void` really do? [duplicate]
An often used statement like (void)x; allows to suppress warnings about unused variable x. But if I try compiling the following, I get some results I don't quite understand:
int main()
{
int x;
...
77
votes
3
answers
37k
views
Can I get PyCharm to suppress a particular warning on a single line?
PyCharm provides some helpful warnings on code style, conventions and logical gotchas. It also provides a notification if I try to commit code with warnings (or errors).
Sometimes I consciously ...
76
votes
5
answers
40k
views
How to suppress warnings in external headers in Visual C++
I'm starting a new BREW project, and I'd like to compile with Warning Level 4 (/W4) to keep the application code nice and clean. The problem is that the BREW headers themselves don't compile cleanly ...
75
votes
5
answers
32k
views
Disable warnings in Xcode from frameworks
I have imported the three20 project into my project, and when I upgraded to Xcode 4.2 with iOS 5, a bunch of warnings appeared in the project.
I don't care about them, but they make a lot of noise, ...
71
votes
3
answers
41k
views
Suppress duplicate warnings in IntelliJ IDEA by annotation
Since version 15, IntelliJ warns me about code duplicates.
In some cases this might be intentional, so I want to ignore/suppress this warning by using the @SuppressWarnings annotation. But what is ...
71
votes
2
answers
24k
views
What value for @SuppressWarnings do I use to suppress the "Can be private" warning?
I keep getting annoyed by the "Can be private" warning, however my FirebaseRecyclerAdapter will not work in that case. So, is there a @SuppressWarnings for that?
What I've tried:
@SuppressWarnings("...
70
votes
5
answers
114k
views
Unnecessary @SuppressWarnings("unused")
I'm getting a compiler warning for the @SuppressWarnings annotation in eclipse for the code:
@Override
public boolean doSomething(@SuppressWarnings("unused") String whatever) throws AnException {
...
69
votes
4
answers
66k
views
How to suppress a third-party warning using warnings.filterwarnings
I am using Paramiko in my python code (for sftp). Everything works fine except that everytime I import or call a paramiko function. This warning would show up:
C:\Python26\lib\site-packages\Crypto\...
66
votes
2
answers
70k
views
Class is a raw type. References to generic type Class<T> should be parameterized
I have the following class (from a simple Spring tutorial)
public class CarValidator implements Validator {
public boolean supports(Class aClass) {
return Car.class.equals(aClass);
}
...
65
votes
3
answers
33k
views
Is it possible to make valgrind ignore certain libraries?
Or preferably all of them instead of just my code? My program uses Gtk, Loudmouth and few other things, and these two (and some behind them, libgcrypto, libssl) are causing so many errors themselves ...
62
votes
7
answers
84k
views
Avoid warning 'Unreferenced Formal Parameter'
I have a super class like this:
class Parent
{
public:
virtual void Function(int param);
};
void Parent::Function(int param)
{
std::cout << param << std::endl;
}
..and a sub-...
62
votes
11
answers
111k
views
Best way to suppress C warning "Unused variable x"? [duplicate]
What is the best/neatest way to suppress a C compiler (for example GCC) like "Unused variable x" warning?
GCC's doumentation explains
-Wunused-variable
Warn whenever a local variable or non-...
59
votes
6
answers
34k
views
Suppress "variable is never assigned" warning in IntelliJ IDEA
We use reflection extensively to set class field values in our code. The fields are accessed in code but they are never assigned except via reflection. So IDEA displays "is never assigned" warning. If ...
59
votes
4
answers
20k
views
Is there an equivalent to SuppressWarnings in Scala?
I was wondering if scala had an equivalent to java's @SuppressWarnings that can be applied to a function or whatever to ignore any deprecation warnings[1] that function emits?
1: Relevant warning in ...
58
votes
5
answers
44k
views
Disable/suppress warning CS0649 in C# for a specific field of class
I have some fields in a C# class which I initialize using reflection. The compiler shows CS0649 warning for them:
Field foo' is never assigned to, and will always have its default
valuenull' (...
56
votes
11
answers
46k
views
Suppress Database Project errors and warnings in visual studio 2010
I have an Database project in my application and want to suppress the errors/warnings thrown by this project.
.first of all is it possible ?
I think I was not clear with my question, by suppressing I ...
56
votes
3
answers
20k
views
Android Studio - remove Security Exception warning
I'm getting the user's location through
Location location = LocationServices.FusedLocationApi.getLastLocation(
mGoogleApiClient);
This line of code is inside a method and before calling ...
54
votes
1
answer
21k
views
Unsupported @SuppressWarnings("PMD.DoNotCallSystemExit")
I need to use System.exit(0) in an application. Eclipse has the PMD plugin installed and complains about this line of code. Adding @SuppressWarnings ("PMD.DoNotCallSystemExit") remove that warning but ...
47
votes
2
answers
60k
views
Java 6: Unsupported @SuppressWarnings("rawtypes") warning
I moved to a new machine which has the latest Sun's Java compiler and noticed some warnings in the existing Java 6 code. The Eclipse IDE, suggested that I annotate the assignment with:
@...
45
votes
2
answers
9k
views
Dynamic forwarding: suppress Incomplete Implementation warning
I have a class exposing some methods, whose implementation is provided by an inner object.
I'm using forward invocation to dispatch at runtime the method calls to the inner object, but XCode is ...
42
votes
1
answer
24k
views
Kotlin: Suppress unused Property?
My source code is as follows:
There are warnings : Property '****' is never used.
I added "@Suppress("UNUSED_PARAMETER")", "@Suppress("UNUSED_PROPERTY_GETTER")", "@Suppress("UNUSED_PROPERTY_SETTER")...
42
votes
7
answers
29k
views
CGContextSaveGState: invalid context 0x0 (Xcode 7 GM)
I have this problem after I compiled my code with Xcode 7 GM.
According to Apple this is a bug, but it still seems to be an issue. Everything works fine, but is it possible to get rid of these errors?...
41
votes
1
answer
65k
views
How do I suppress T-SQL warnings when running a script SQL Server 2005?
Is it possible to suppress warnings generated by T-SQL scripts? If so, how?
I know I can turn of the 'records affected' messages with
SET NOCOUNT ON
but is there an equivalent for warnings?
Eg:
...
39
votes
5
answers
18k
views
How to disable warning for redefining a constant when loading a file
Is there a way to disable warning: already initialized constant when loading particular files?
38
votes
1
answer
13k
views
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 @...
37
votes
1
answer
16k
views
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 @...
37
votes
3
answers
24k
views
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 ...
36
votes
6
answers
28k
views
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 ...
35
votes
5
answers
22k
views
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 <<RSCRIPT
cat("Plotting $1 to $2\n")
input <- read.table("$1")
...