compiler-warnings

SQlite C warnings

I am using the sqlite3.c library. It compiles with 140 something conversion warnings. What's wrong with my set-up? Thanks. sqlite3.c c:\Projects\Lib\sqlite3.c(11311) : warning C4244: '=' : conversion from 'double' to 'int', possible loss of data c:\Projects\Lib\sqlite3.c(11312) : warning C4244: '=' : conversion from 'double' to 'in...

Conditionally disable warnings with qmake/gcc?

Hello, I am involved with a software project written in Qt and built with qmake and gcc on Linux. We have to link to a third-party library that is of fairly low quality and spews tons of warnings. I would like to use -W -Wall on our source code, but pass -w to the nasty third-party library to keep the console free of noise and clutter...

Eliminating Javac warnings for JSPs in Jasper generated Java source files?

When pre-compiling JSPs with the Jasper compiler (using Tomcat), and then the Java compiler I see javac warnings like this (I have javac's -Xlint flag enabled): warning: [unchecked] unchecked call to add(E) as a member of the raw type java.util.List _jspx_dependants.add("/some-jsp.jspf"); Now, it's "just a warning," but I like clean b...

What does "Warning: return makes integer from pointer without a cast" mean in C?

I'm writing a simple function in C whose purpose is to take a 6 bit number, work out the first 3 bits, and based on that, return a "r", "w" or "o". However, when I compile I get this warning: 'return makes integer from pointer without a cast'. Then, when I run the program, I find that the function is returning a weird character that def...

Warning when using function pointers in C

Hi all! This is actually a non-critical question, but I get this warning most of the time I use function pointers and still couldn't figure out why on my own. Consider the following prototype: typedef void * Pointer; void tree_destroyLineage(Tree greatest_parent, void *dataDestructor(Pointer data)); And so far I can compile my thousan...

Is there any way to get the current unit's name from an include file?

I'm porting some code from one framework library to another, which requires me to comment out large sections of code just to get it to compile, and then carefully restore them. In the meantime, I get tons of warnings because of all the commented-out code. So I decided to write a quick include file to suppress them: {$MESSAGE WARN 'War...

Eclipse - @SuppressWarnings("javadoc") does not work

Hi, I have my Eclipse configured to show warnings on missing javadoc comments and tags for public elements. That comes very usefull for me in order to keep my code well documented. But sometimes I have a class, where I have several constants describing for example states of DFA or something.. theres no need to document theese constant...

In C++, when can two variables of the same name be visible in the same scope?

This code illustrates something that I think should be treated as bad practice, and elicit warnings from a compiler about redefining or masking a variable: #include <iostream> int *a; int* f() { int *a = new int; return a; } int main() { std::cout << a << std::endl << f() << std::endl; return 0; } Its output (compiled with ...

VC++ Compiler: How to determine the current warning level or overrides?

I've got a project where I've just discovered that warning C4244 (possible loss of data) is being suppressed. I strongly suspect that some crummy MS header is suppressing this warning and leaving it suppressed for all translation units that include said header, but I've not determined which of their myriad headers may be at fault. So, ...

odd "warning C4127: conditional expression is constant" under VS2005

I'm trying to compile LightZPng with warnings on level 4. I get a lot of C4127 on lines that are clearly not worthy of this warning. An example: #define MAX_BITS 15 int values_per_bitlen[ MAX_BITS + 1 ]; for ( int i = 0; i <= MAX_BITS; ++i ) // C4127 is here values_per_bitlen[ i ] = 0; How can this code be changed to avoid the ...

Custom Generic.IEqualityComparer(Of T) - Compiler Errors

I am trying to implement a simple IEqulityComparer to use with LINQ collections. I have written the following code which is reduced to its simplest form for discussion purposes... Public Structure bob Dim SiteID As Integer Dim fred As String End Structure Public Class insCompare Implements System.Collections.Generic.IEqual...

Syntax hilighting for gcc warnings in bash

Is there a way to enable a hilighting scheme for gcc/g++ warning output? I'd like a simple way to spot (bright red?) warnings from my compiler as the messages are streaming by. ...

Compiler warnings

Suppose I have this (C++ or maybe C) code: vector<int> my_vector; for (int i = 0; i < my_vector.size(); i++) { my_vector[i] = 0; } I don't care if it's done right. The important part is in the for-loop declaration. The compiler gives a signed/unsigned mismatch for this, since size() returns an unsigned int, not a signed one. How i...

Dangerous ways of removing compiler warnings?

I like to force a policy of no warnings when I check someone's code. Any warnings that appear have to be explicitly documented as sometimes it's not easy to remove some warnings or might require too many cycles or memory etc. But there is a down-side to this policy and that is removing warnings in ways that are potentially dangerous, i....

How do I get more warnings from javac?

I want the Java compiler to give me the highest level of warnings possible. Currently I compile with -Xlint. Is there anyway for me to get more warnings? The warnings provided by Xlint seem paltry. I just compiled this code with -Xlint and got no warnings: double x = 22/7; double y = 22/7; if(x == y) { System.err.println("They are e...

disable specific warnings in gcc

On microsoft compilers, specific warnings can be disabled with a #pragma, without disabling other warnings. This is an extremely useful feature if the compiler warns over something that "has to be done". Does GCC at this point have a similar feature? It seems like an obvious enough feature that its unimaginable that it wouldn't have t...

Can Visual Studio warn me when I forget to dispose an IDisposable object?

Can Visual Studio 2008 be configured to give me a warning when I forget to dispose an object that implements IDisposable? ...

How do I get rid of "[some event] never used" compiler warnings in VS2008?

For example, I get this compiler warning, "The event 'Company.SomeControl.SearchClick' is never used." But I know that it's used because commenting it out throws me like 20 new warnings of XAML pages that are trying to use this event! What gives? Is there a trick to get rid of this warning? ...

"Call Stack" for C++ errors in Visual Studio 2005

Is there a "call stack" for compiler errors in Visual Studio 2005 (C++)? For example, I am using a boost::scoped_ptr as the value in a QHash. This is however causing the following compile error: 1>c:\qt\include\qtcore\../../src/corelib/tools/qhash.h(743) : error C2248: 'boost::scoped_ptr<T>::operator =' : cannot access private member d...

Visualize compiler warnings

I'm looking for a way to visualize compiler warnings and remarks, by annotating or otherwise showing which lines cause a report. This is much like a modern IDE like NetBeans or Eclipse already does, but I'd like to take output from several compilers (and other static code analysis tools) at once, and create one single annotation in ord...