Re: (Potential bug) Useless warning that shouldn't exist?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thanks for the quick reply.

Turns out there was a macro, the compiler saw:
static const float (__builtin_inff());

The library must have compiled because INFINITY isn't defined, curious that the use does, but my IDE didn't spot that INFINITY was a macro, it doesn't surprise me that somewhere in the vast wxWidgets headers it's there. This isn't a complaint; fear not.

Sorry to waste time. Thanks Jon.

Alec

On 11/07/13 12:36, Jonathan Wakely wrote:
On 11 July 2013 12:33, Alec Teal <a.teal@xxxxxxxxxxxxx> wrote:
Hey guys,

I'm really not sure what's wrong with this, I think it may be a bug but I am
not sure. Hence posting it here first. These are from a shared library, that
compiles fine with -Wall -Wextra, the header file is available to things
that use the library. Particularly this has nothing to do with a  function,
so why is it talking of a return type of a function?
See, I was also confused about the function thing, I'd have to be pretty sure before firing off an email.

Header file:
namespace sr {

class Framebuffer;

class Depthbuffer {
public:
*static const float INFINITY;*<--this line is what the warning is referring
to.
...

Implementation file:
namespace sr {

const float Depthbuffer::INFINITY = 1.0f;
....

However when compiling a program that uses the library:

if ! g++ -Isrc -MM src/Renderer.cpp >> build/Renderer.o.d ; then rm
build/Renderer.o.d ; exit 1 ; fi
g++ -Wall -Wextra -g -O0 -std=c++0x -gdwarf-2 -Wno-write-strings -I../libsr
-I/usr/lib/x86_64-linux-gnu/wx/include/gtk2-unicode-release-2.8
-I/usr/include/wx-2.8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D__WXGTK__
-pthread -Isrc -c src/Renderer.cpp -o build/Renderer.o
In file included from ./libsr/libsr.h:12:0,
                  from src/Renderer.h:11,
                  from src/Renderer.cpp:8:
./libsr/Framebuffer.h:17:21: warning: type qualifiers ignored on function
return type [-Wignored-qualifiers]

The line it doesn't like is the one in bold, static const float INFINITY;

What is GCC warning me about? What's wrong?
GCC 4.7.3
That line is not a function, so there shouldn't be a warning about
"function return type" -- are you sure that's the line it's referring
too?  Is INFINITY a macro defined in some header so that you're not
ompiling what you think you are?
EXACTLY, that isn't a function.

Please provide a complete reproducable example, not snippets of code
with "..." that noone else can test.

Overkill as a first step surely? I may have missed something trivial, I did miss something trivial.





[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux