Harmless Warnings? Topic is solved

Do you have a question about makefiles, a compiler or IDE you are using and need to know how to set it up for wxWidgets or why it doesn't compile but other IDE's do ? Post your questions here.
Post Reply
Kip
Experienced Solver
Experienced Solver
Posts: 61
Joined: Fri Jan 26, 2007 11:11 pm

Harmless Warnings?

Post 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

kip@kip-laptop:~/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
manianis
Experienced Solver
Experienced Solver
Posts: 72
Joined: Mon Jan 15, 2007 11:00 am

Post by manianis »

-Wall : means display all warnings try removing it and recompile your code.
Kip
Experienced Solver
Experienced Solver
Posts: 61
Joined: Fri Jan 26, 2007 11:11 pm

Post 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
Auria
Site Admin
Site Admin
Posts: 6695
Joined: Thu Sep 28, 2006 12:23 am
Contact:

Post 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
Kip
Experienced Solver
Experienced Solver
Posts: 61
Joined: Fri Jan 26, 2007 11:11 pm

Post by Kip »

Sadly it doesn't work under Linux.

Kip
killerbot
Experienced Solver
Experienced Solver
Posts: 75
Joined: Wed Dec 26, 2007 1:13 pm

Post 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.
Hitnrun
Knows some wx things
Knows some wx things
Posts: 27
Joined: Thu Sep 06, 2007 10:34 pm

Post by Hitnrun »

Add

-fno-strict-aliasing

to your gcc compile flags.
hou
Knows some wx things
Knows some wx things
Posts: 34
Joined: Wed Apr 16, 2008 3:14 am

how did you fix it?

Post 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.
My brother is going to go to university.
killerbot
Experienced Solver
Experienced Solver
Posts: 75
Joined: Wed Dec 26, 2007 1:13 pm

Re: how did you fix it?

Post 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
hou
Knows some wx things
Knows some wx things
Posts: 34
Joined: Wed Apr 16, 2008 3:14 am

thank you for your answer.

Post by hou »

Can you tell me why it happen and what's the warning's meaning?
My brother is going to go to university.
Post Reply