Questions tagged [warnings]

A warning is often issued on recognizing a potential high-risk situation, a probable misunderstanding, degraded service or imminent failure.

A warning-level error message shown by a compiler indicates a piece of code which the compiler recognizes as being potentially a problem, but which is syntactically correct such that the compiler is able to continue.

The seriousness of warning may vary from basically an error to something that could be considered just as bad programming style. Most of compilers provide keys to disable default warnings and may provide keys to enable warnings that are disabled by default (e.g. -Wall, -Wextra, -Werror).

5829 questions
210
votes
8 answers

In Python, how does one catch warnings as if they were exceptions?

A third-party library (written in C) that I use in my python code is issuing warnings. I want to be able to use the try except syntax to properly handle these warnings. Is there a way to do this?
Boris Gorelik
  • 29,945
  • 39
  • 128
  • 170
203
votes
11 answers

"No newline at end of file" compiler warning

What is the reason for the following warning in some C++ compilers? No newline at end of file Why should I have an empty line at the end of a source/header file?
LeChuck2k
203
votes
4 answers

Mockito: List Matchers with generics

Mockito offers: when(mock.process(Matchers.any(List.class))); How to avoid warning if process takes a List instead?
Philippe Blayo
  • 10,610
  • 14
  • 48
  • 65
193
votes
19 answers

Warning :-Presenting view controllers on detached view controllers is discouraged

In my app, I am using a navigation controller. Later on in some view I am using presentViewController for showing a zoomed image. Also I am not using a Storyboard or nib. I am getting this error in iOS 7 only. It works fine in iOS 6 and…
Gagan Joshi
  • 3,347
  • 2
  • 21
  • 32
187
votes
13 answers

warning: Insecure world writable dir /usr/local/bin in PATH, mode 040777

Every time I run this command rails server: warning: Insecure world writable dir /usr/local/bin in PATH, mode 040777 I searched for a solution here and they said to type: chmod go-w /usr/local/bin But I get this error: chmod: Unable to change…
Xandman
  • 1,933
  • 2
  • 13
  • 8
174
votes
16 answers

Visual Studio warning: "Some of the properties associated with the solution could not be read"

When I open my solution, I get a dialog with this warning. The solution (one web app, one class project) builds without errors. How can I determine what properties are causing the problem, and resolve the error?
chris
  • 36,094
  • 53
  • 157
  • 237
165
votes
10 answers

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 ) or includes from certain paths? I'd like to use…
AdSR
  • 2,097
  • 3
  • 15
  • 9
154
votes
10 answers

How do I fix "The expression of type List needs unchecked conversion...'?

In the Java snippet: SyndFeedInput fr = new SyndFeedInput(); SyndFeed sf = fr.build(new XmlReader(myInputStream)); List entries = sf.getEntries(); the last line generates the warning "The expression of type List needs unchecked…
user46277
  • 1,739
  • 2
  • 13
  • 10
153
votes
11 answers

Disable single warning error

Is there a way to disable just a single warning line in a cpp file with visual studio? For example, if I catch an exception and don't handle it, I get error 4101 (unreferenced local variable). Is there a way to ignore this just in that function, but…
Cookie
  • 12,004
  • 13
  • 54
  • 83
149
votes
3 answers

In Xcode, how to suppress all warnings in specific source files?

In my application I use 3rd party code that triggers some warnings. I reviewed them and they can be safely ignored. Now I want to "mark" a file somehow, so Xcode won't show any warnings for the code in that file. How should I do that?
Bobrovsky
  • 13,789
  • 19
  • 80
  • 130
149
votes
6 answers

Why does PyCharm warn about mutable default arguments? How can I work around them?

I am using PyCharm (Python 3) to write a Python function which accepts a dictionary as an argument with attachment={}. def put_object(self, parent_object, connection_name, **data): ... def put_wall_post(self, message, attachment={},…
bin
  • 1,625
  • 3
  • 12
  • 10
149
votes
4 answers

Missing support for Firebase App Indexing (android lint)

I receive this lint warning when analysing my code (Analyse > Inspect Codes) on Android studios. App is not indexable by Google Search; consider adding at least one Activity with an ACTION-VIEW intent-filler. See issue explanation for more…
148
votes
9 answers

logging.info doesn't show up on console but warn and error do

When I log an event with logging.info, it doesn't appear in the Python terminal. import logging logging.info('I am info') # no output In contrast, events logged with logging.warn do appear in the terminal. import logging logging.warn('I am…
daydreamer
  • 87,243
  • 191
  • 450
  • 722
145
votes
10 answers

Suppressing deprecated warnings in Xcode

With all the SDKs floating around, it's handy to be able to build for multiple SDKs and platforms. However, bouncing from 3.2 to 3.0 and even occasionally 2.x, I frequently get deprecated warnings involving methods that have changed or been…
Ben Gottlieb
  • 85,404
  • 22
  • 176
  • 172
145
votes
5 answers

Warning message: In `...` : invalid factor level, NA generated

I don't understand why I got this warning message. > fixed <- data.frame("Type" = character(3), "Amount" = numeric(3)) > fixed[1, ] <- c("lunch", 100) Warning message: In `[<-.factor`(`*tmp*`, iseq, value = "lunch") : invalid factor level, NA…
ihm
  • 1,833
  • 2
  • 18
  • 23