Open h4ck3rm1k3 opened 12 years ago
Sure, one of our goals is to get rid of compiler warnings, patches are heartily welcome. I suggest that you first fix one of these warnings, and if we agree on your change, you propagate it to other source files.
ok great, I have a big list of them. more to come.
Rational, dont convert pointer types on the fly, create temp variables and let the compiler sort them out.
diff --git a/inc/FSD_FileHeader.hxx b/inc/FSD_FileHeader.hxx index 3ea7fdc..c081b51 100644 --- a/inc/FSD_FileHeader.hxx +++ b/inc/FSD_FileHeader.hxx @@ -103,7 +103,9 @@ inline Standard_ShortReal InverseShortReal (const Standard_ShortReal theValue) { Standard_ShortReal aResult; Standard_Integer _i = (StandardInteger) &aResult;
diff --git a/src/FSD/FSD_BinaryFile.cxx b/src/FSD/FSD_BinaryFile.cxx index 83a1a7a..5b12370 100644 --- a/src/FSD/FSD_BinaryFile.cxx +++ b/src/FSD/FSD_BinaryFile.cxx @@ -1083,7 +1083,8 @@ void FSD_BinaryFile::ReadString(TCollection_AsciiString& aString) if (!fread(c,size,1,myStream)) Storage_StreamWriteError::Raise(); c[size] = '\0'; aString = c;
aString = c;
Looks good to me. What do others think about these changes?
I have been making more commits in my branch, ideally we would test them all. Ideally we would have coverage of all lines of code with tests. In any case these are simple changes now, but some of the later ones are more intrusive. mike
On Sun, Oct 14, 2012 at 10:10 PM, Denis Barbier notifications@github.comwrote:
Looks good to me. What do others think about these changes?
— Reply to this email directly or view it on GitHubhttps://github.com/tpaviot/oce/issues/304#issuecomment-9425579.
James Michael DuPont Member of Free Libre Open Source Software Kosova http://flossk.org Saving wikipedia(tm) articles from deletion http://SpeedyDeletion.wikia.com Contributor FOSM, the CC-BY-SA map of the world http://fosm.org Mozilla Rep https://reps.mozilla.org/u/h4ck3rm1k3 Free Software Foundation Europe Fellow http://fsfe.org/support/?h4ck3rm1k3
@h4ck3rm1k3 Hi Mike, can you submit a pull request for these changes? They look good to me as well.
I could, I dont even remember doing this. 2 year ago.... sure I will get around to it some time.
are you interested in me resolving these warnings? see http://stackoverflow.com/questions/3246228/dereferencing-type-punned-pointer-will-break-strict-aliasing-rules cd /home/h4ck3rm1k3/experiments/oce/adm/cmake/TKernel && /usr/bin/c++ -DCSFDB -DHAVE_CONFIG_H -DNDEBUG -DOCC_CONVERT_SIGNALS -DTKernel_EXPORTS -D_OCC64 -std=c++0x -Wall -O3 -DNDEBUG -fPIC -I/hom\ e/h4ck3rm1k3/experiments/oce/build_inc -I/home/h4ck3rm1k3/experiments/oce/inc -I/home/h4ck3rm1k3/experiments/oce/src/StdFail -I/home/h4ck3rm1k3/experiments/oce/drv/StdFail -I/home/h4ck3rm1k3/exper\ iments/oce/src/FSD -I/home/h4ck3rm1k3/experiments/oce/drv/FSD -I/home/h4ck3rm1k3/experiments/oce/src/MMgt -I/home/h4ck3rm1k3/experiments/oce/drv/MMgt -I/home/h4ck3rm1k3/experiments/oce/src/OSD -I/\ home/h4ck3rm1k3/experiments/oce/drv/OSD -I/home/h4ck3rm1k3/experiments/oce/src/Plugin -I/home/h4ck3rm1k3/experiments/oce/drv/Plugin -I/home/h4ck3rm1k3/experiments/oce/src/Quantity -I/home/h4ck3rm1\ k3/experiments/oce/drv/Quantity -I/home/h4ck3rm1k3/experiments/oce/src/Resource -I/home/h4ck3rm1k3/experiments/oce/drv/Resource -I/home/h4ck3rm1k3/experiments/oce/src/SortTools -I/home/h4ck3rm1k3/\ experiments/oce/drv/SortTools -I/home/h4ck3rm1k3/experiments/oce/src/Standard -I/home/h4ck3rm1k3/experiments/oce/drv/Standard -I/home/h4ck3rm1k3/experiments/oce/src/Storage -I/home/h4ck3rm1k3/expe\ riments/oce/drv/Storage -I/home/h4ck3rm1k3/experiments/oce/src/TColStd -I/home/h4ck3rm1k3/experiments/oce/drv/TColStd -I/home/h4ck3rm1k3/experiments/oce/src/TCollection -I/home/h4ck3rm1k3/experime\ nts/oce/drv/TCollection -I/home/h4ck3rm1k3/experiments/oce/src/TShort -I/home/h4ck3rm1k3/experiments/oce/drv/TShort -I/home/h4ck3rm1k3/experiments/oce/src/Units -I/home/h4ck3rm1k3/experiments/oce/\ drv/Units -I/home/h4ck3rm1k3/experiments/oce/src/UnitsAPI -I/home/h4ck3rm1k3/experiments/oce/drv/UnitsAPI -I/home/h4ck3rm1k3/experiments/oce/src/IncludeLibrary -I/home/h4ck3rm1k3/experiments/oce/d\ rv/IncludeLibrary -I/home/h4ck3rm1k3/experiments/oce/src/Dico -I/home/h4ck3rm1k3/experiments/oce/drv/Dico -I/home/h4ck3rm1k3/experiments/oce/src/NCollection -I/home/h4ck3rm1k3/experiments/oce/drv/\ NCollection -I/home/h4ck3rm1k3/experiments/oce/src/Message -I/home/h4ck3rm1k3/experiments/oce/drv/Message -o CMakeFiles/TKernel.dir///__/src/FSD/FSD_BinaryFile.cxx.o -c /home/h4ck3rm1k3/exp\ eriments/oce/src/FSD/FSD_BinaryFile.cxx In file included from /home/h4ck3rm1k3/experiments/oce/inc/FSD_BinaryFile.hxx:20, from /home/h4ck3rm1k3/experiments/oce/drv/FSD/FSD_BinaryFile.jxx:29, from /home/h4ck3rm1k3/experiments/oce/drv/FSD/FSD_BinaryFile.ixx:6, from /home/h4ck3rm1k3/experiments/oce/src/FSD/FSD_BinaryFile.cxx:19: /home/h4ck3rm1k3/experiments/oce/inc/FSD_FileHeader.hxx: In function ‘Standard_ShortReal InverseShortReal(Standard_ShortReal)’: /home/h4ck3rm1k3/experiments/oce/inc/FSD_FileHeader.hxx:106: warning: dereferencing type-punned pointer will break strict-aliasing rules /home/h4ck3rm1k3/experiments/oce/src/FSD/FSD_BinaryFile.cxx: In member function ‘void FSD_BinaryFile::ReadString(TCollection_AsciiString&)’: /home/h4ck3rm1k3/experiments/oce/src/FSD/FSD_BinaryFile.cxx:1086: warning: dereferencing type-punned pointer will break strict-aliasing rules /home/h4ck3rm1k3/experiments/oce/src/FSD/FSD_BinaryFile.cxx: In member function ‘void FSD_BinaryFile::ReadExtendedString(TCollection_ExtendedString&)’: /home/h4ck3rm1k3/experiments/oce/src/FSD/FSD_BinaryFile.cxx:1147: warning: dereferencing type-punned pointer will break strict-aliasing rules /home/h4ck3rm1k3/install/bin/cmake -E cmake_progress_report /home/h4ck3rm1k3/experiments/oce/CMakeFiles