While compiling Poly/ML with motif support on a Gentoo system with openmotif-2.2.3 installed, I get a huge number of warnings about dereferencing type-punned pointers. They are caused by macro expansions from XmP.h. Trying to reproduce this with minimum overhead, I got these two lines here: #include <Xm/ExtObjectP.h><br />
Boolean IsTextWidget(Widget w) { return XmIsText(w); }
Compiling using "g++ -c -O3 -Wall" I get these errors: motif-aliasing.cc: In function 'Boolean IsTextWidget(_WidgetRec*)':<br /> motif-aliasing.cc:2: warning: dereferencing type-punned pointer will break strict-aliasing rules<br /> motif-aliasing.cc:2: warning: dereferencing type-punned pointer will break strict-aliasing rules<br /> motif-aliasing.cc:2: warning: dereferencing type-punned pointer will break strict-aliasing rules Those type-punning warnings are at least annoying. I don't know enough about gcc internals to judge if they might cause serious trouble, but it would be nice to get rid of the warnings anyway. Is this a problem of the way the application uses these macros? If not, maybe declaring some types with the may_alias type attribute might help. Are there any plans to do so? |
|||
