Tagged Questions
55
votes
3answers
28k 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 come between the ("") in @SuppressWarnings("").
22
votes
6answers
21k views
How can I hide “defined but not used” warnings in GCC?
I have a bunch of compile time asserts, such as:
CASSERT(isTrue) or CASSERT2(isTrue, prefix_)
When compiling with GCC I get many warnings like 'prefix_LineNumber' defined but not used. Is there a ...
18
votes
5answers
12k views
Visual Studio warning level meanings?
On the build tab in a Web Application project I have a setting called "Warning Level". I can set a value from 0 to 4. What do these values mean? Will a value of 0 be more strict and generate more ...
12
votes
5answers
2k views
The parameter 'foo' should not be assigned — what's the harm?
Compare this method:
void doStuff(String val) {
if (val == null) {
val = DEFAULT_VALUE;
}
// lots of complex processing on val
}
... to this method:
void doStuff(String ...
12
votes
1answer
239 views
Why does `Some(123).isInstanceOf[Option[List[String]]]` *not* give an unchecked warning?
When using .isInstanceOf[GenericType[SomeOtherType]], where GenericType and SomeOtherType are arbitrary types (of suitable kind), the Scala compiler gives an unchecked warning due to type erasure:
...
11
votes
3answers
806 views
How to turn on (literally) ALL of GCC's warnings?
I would like to enable -- literally -- ALL of the warnings that GCC has. (You'd think it would be easy...)
You'd think -Wall might do the trick, but nope! Still need -Wextra.
You'd think -Wextra ...
10
votes
6answers
1k views
Impact on style of GHC -Wall
It is considered good practice to enable GHC warnings with -Wall. However, I've found out that fixing those warnings has a negative effect for some types of code constructs.
Example 1:
Using the ...
9
votes
5answers
12k views
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, ...
9
votes
4answers
5k views
Is using #pragma warning push/pop the right way to temporarily alter warning level?
Once in a while it's difficult to write C++ code that wouldn't emit warnings at all. Having warnings enabled is however a good idea. So it is often necessary to disable warnings around some specific ...
8
votes
4answers
431 views
Are there real life cases when C4930 Visual C++ warning doesn't indicate an error?
Visual C++ can emit C4930 "unused function prototype" warning in the following case:
void SomeUsefulFunction()
{
SomeResourceLock lock(); //C4930 - unused function prototype
//code requiring ...
8
votes
1answer
1k views
C++ - gcc - how to create my own custom compile warnings similar to printf()?
apologies in advance if i use poor terminology.
when i compile a C++ app under gdb and use printf() it gives me awesome warnings relating to the consistency of the format string and the arguments ...
6
votes
3answers
3k views
How do I get missing prototype warnings from g++?
I currently have a project that uses g++ to compile it's code. I'm in the process of cleaning up the code, and I'd like to ensure that all functions have prototypes, to ensure things like const char ...
6
votes
2answers
2k views
How to eliminate warning about ambiguity?
I have this warning:
Warning 3 Ambiguity between method 'Microsoft.Office.Interop.Word._Application.Quit(ref object, ref object, ref object)' and non-method ...
5
votes
2answers
2k views
How do I disable “Add explicit braces to avoid dangling else” in new xCode?
Just updated to latest xCode 4.41 and now I'm getting a ton of warnings about perfectly fine code (see subject line). These warnings are in 3rd party source code that I'm using, I don't feel like ...
5
votes
2answers
464 views
Reducing thousands of compiler warnings
I have just started working with C++ code compiled in Visual Studio 2008. The default warning level on the project was set to 3 and there were no warnings. I turned this up to level 4, and it turns ...