Page 1 of 1

Harmless Warnings?

Posted: Fri Jan 26, 2007 11:15 pm
by Kip
So whenever I try to build my project, it compiles successfully, but I always get warnings issued that appear unrelated to my code, but within the wxWidgets headers themselves.

I am using wxWidgets 2.8.0 under Ubuntu Linux with gcc (GCC) 4.1.2 20070106 (prerelease) (Ubuntu 4.1.1-21ubuntu7).

I know they are probably harmless, but I would like to get rid of them if possible.

Code: Select all

[email protected]:~/Projects/Slither/trunk$ make
if g++ -DHAVE_CONFIG_H -I. -I. -I./src   -I/usr/lib/wx/include/gtk2-unicode-release-2.8 -I/usr/include/wx-2.8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D_LARGEFILE_SOURCE=1 -D__WXGTK__ -Wall -g -O2  -MT SlitherApp.o -MD -MP -MF ".deps/SlitherApp.Tpo" -c -o SlitherApp.o `test -f 'src/SlitherApp.cpp' || echo './'`src/SlitherApp.cpp; \
        then mv -f ".deps/SlitherApp.Tpo" ".deps/SlitherApp.Po"; else rm -f ".deps/SlitherApp.Tpo"; exit 1; fi
/usr/include/wx-2.8/wx/hashmap.h: In member function ‘wxLongToLongHashMap_wxImplementation_HashTable::Node** wxLongToLongHashMap_wxImplementation_HashTable::GetNodePtr(const long int&) const’:
/usr/include/wx-2.8/wx/hashmap.h:714: warning: dereferencing type-punned pointer will break strict-aliasing rules
/usr/include/wx-2.8/wx/clntdata.h: In member function ‘wxShadowObjectMethods_wxImplementation_HashTable::Node** wxShadowObjectMethods_wxImplementation_HashTable::GetNodePtr(const wxString&) const’:
/usr/include/wx-2.8/wx/clntdata.h:20: warning: dereferencing type-punned pointer will break strict-aliasing rules
/usr/include/wx-2.8/wx/clntdata.h: In member function ‘wxShadowObjectFields_wxImplementation_HashTable::Node** wxShadowObjectFields_wxImplementation_HashTable::GetNodePtr(const wxString&) const’:
/usr/include/wx-2.8/wx/clntdata.h:25: warning: dereferencing type-punned pointer will break strict-aliasing rules
/usr/include/wx-2.8/wx/gdicmn.h: In member function ‘wxStringToColourHashMap_wxImplementation_HashTable::Node** wxStringToColourHashMap_wxImplementation_HashTable::GetNodePtr(const wxString&) const’:
/usr/include/wx-2.8/wx/gdicmn.h:540: warning: dereferencing type-punned pointer will break strict-aliasing rules
/usr/include/wx-2.8/wx/image.h: In member function ‘wxImageHistogramBase_wxImplementation_HashTable::Node** wxImageHistogramBase_wxImplementation_HashTable::GetNodePtr(const long unsigned int&) const’:
/usr/include/wx-2.8/wx/image.h:136: warning: dereferencing type-punned pointer will break strict-aliasing rules

Kip

Posted: Sat Jan 27, 2007 11:06 pm
by manianis
-Wall : means display all warnings try removing it and recompile your code.

Posted: Sun Jan 28, 2007 12:06 am
by Kip
While we predicted that would solve the problem, sometimes the warnings are useful for user code, like mine where I neglect to give attention to something in need.

I would very much like to fix the headers, if that is where the problem is, so I resume using -Wall.

Any other suggestions?

--
Kip

Posted: Sun Jan 28, 2007 12:12 am
by Auria
On mac GCC, you can use -Wmost instead of -Wall - it will display warnings but discard those that just seem to be uselessly nitpicking

however i don't know if this option is part of GCC or just in apple's version

Posted: Sun Jan 28, 2007 12:23 am
by Kip
Sadly it doesn't work under Linux.

Kip

Posted: Wed Dec 26, 2007 1:50 pm
by killerbot
a lot of warnings have been fixed in wx287, however the type-punned one is still there, any time frame when this will be fixed, it really polutes a build log.

Posted: Fri Feb 08, 2008 9:22 am
by Hitnrun
Add

-fno-strict-aliasing

to your gcc compile flags.

how did you fix it?

Posted: Tue Jul 08, 2008 6:16 am
by hou
I didn't find the gcc compiler flag "wmost "in "Setting->compiler and debug->compiler flags", how do you fix the ugly warning? Thanks.

Re: how did you fix it?

Posted: Tue Jul 08, 2008 6:57 pm
by killerbot
hou wrote:I didn't find the gcc compiler flag "wmost "in "Setting->compiler and debug->compiler flags", how do you fix the ugly warning? Thanks.
I guess you are talking about Code::Blocks; you can add extra gcc settings that are not in the list of compiler flags in the other options tab

thank you for your answer.

Posted: Wed Jul 09, 2008 1:11 am
by hou
Can you tell me why it happen and what's the warning's meaning?