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
Filter by
Sorted by
Tagged with
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 ...
Framester's user avatar
  • 34.3k
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=...
Patryk's user avatar
  • 23.4k
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?
jojo's user avatar
  • 13.7k
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("").
Ron Tuffin's user avatar
  • 54.3k
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:...
LK__'s user avatar
  • 6,655
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 ...
bigbug's user avatar
  • 57.7k
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?
Ben S's user avatar
  • 68.8k
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() { ...
knownasilya's user avatar
  • 6,085
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....
AdSR's user avatar
  • 2,137
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?
Ed Mazur's user avatar
  • 3,072
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?
TheTeaMan's user avatar
  • 2,413
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 ...
learner's user avatar
  • 1,935
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 ...
kdbdallas's user avatar
  • 4,543
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 ...
AnthonyWJones's user avatar
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 ...
Chris Conway's user avatar
  • 55.6k
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")
Praveenkumar's user avatar
  • 24.3k
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 ...
Johannes Schaub - litb's user avatar
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 ...
Dominik Antal's user avatar
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 ...
John Andreas Westman's user avatar
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 ...
Wen_CSE's user avatar
  • 1,275
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 ...
overcomer's user avatar
  • 2,274
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; ...
Ruslan's user avatar
  • 18.6k
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 ...
lofidevops's user avatar
  • 16.1k
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 ...
Bob Whiteman's user avatar
  • 2,491
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, ...
Micah Hainline's user avatar
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 ...
Sebastian's user avatar
  • 5,901
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("...
Ali Bdeir's user avatar
  • 4,370
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 { ...
Edd's user avatar
  • 8,510
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\...
Tom Nguyen's user avatar
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); } ...
user avatar
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 ...
tadzik's user avatar
  • 1,330
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-...
bdhar's user avatar
  • 22.2k
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-...
gustaf's user avatar
  • 776
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 ...
ililit's user avatar
  • 1,329
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 ...
BenjaminJackman's user avatar
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' (...
iseeall's user avatar
  • 3,401
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 ...
Sumit's user avatar
  • 2,992
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 ...
Jyotman Singh's user avatar
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 ...
user342495's user avatar
  • 1,463
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: @...
eold's user avatar
  • 6,012
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 ...
Gabriele Petronella's user avatar
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")...
user3239558's user avatar
  • 1,807
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?...
Beto's user avatar
  • 3,438
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: ...
AR.'s user avatar
  • 40.1k
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?
sawa's user avatar
  • 167k
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 @...
Kousha's user avatar
  • 34.6k
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 @...
user avatar
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 ...
Jonathan M Davis's user avatar
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 ...
ChaseMedallion's user avatar
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") ...
blahdiblah's user avatar
  • 33.5k

1
2 3 4 5
17