Cleanup.

User avatar
SteveBaker
Posts: 127
Joined: Sun Aug 13, 2006 4:41 pm
Location: Cedar Hill, Texas

Cleanup.

Post by SteveBaker »

I see there are a bazillion compile warnings when I build under Linux/g++/gcc. I'm of the "treat all warnings as errors" school of programming! Is there any problem with me cleaning them up so Bullet bulds cleanly?

Many of them are trivial things like missing newlines on the ends of files, unused variables, switch statements without defaults, variables that might not be initialised.

Some are more serious - virtual classes without virtual destructor functions, order of initialisations of member variables, use of 'char' variables (which, remember may or may not be unsigned) to index into 0..255 arrays. There are some 'static' variables declared in a header file.

Lots and lots and *LOTS* of junk.
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: Cleanup.

Post by Erwin Coumans »

SteveBaker wrote:I see there are a bazillion compile warnings when I build under Linux/g++/gcc. I'm of the "treat all warnings as errors" school of programming! Is there any problem with me cleaning them up so Bullet bulds cleanly?

Many of them are trivial things like missing newlines on the ends of files, unused variables, switch statements without defaults, variables that might not be initialised.

Some are more serious - virtual classes without virtual destructor functions, order of initialisations of member variables, use of 'char' variables (which, remember may or may not be unsigned) to index into 0..255 arrays. There are some 'static' variables declared in a header file.

Lots and lots and *LOTS* of junk.
Hi Steve,

Thanks for offering. It would be good to deal with that indeed. If you can keep the changes fairly minimum, to what you mentioned, please give it a go. Just to avoid potential conflicts etc.

Please leave the interfaces, methods and names and other coding style issues as they are ;-)

Also, it's better not to touch most of the 'Extras' folder. Especially COLLADA_DOM and libxml, but also quickstep and Solid are external, and I prefer not to touch them if not strictly necessary. COLLADA_DOM and libxml give a lot of warnings unfortunately, but they are not really part of the core libraries. Core is Bullet/Bullet and Bullet/BulletDynamics and Bullet/LinearMath.

Thanks,
Erwin
User avatar
SteveBaker
Posts: 127
Joined: Sun Aug 13, 2006 4:41 pm
Location: Cedar Hill, Texas

Re: Cleanup.

Post by SteveBaker »

Erwin Coumans wrote: Thanks for offering. It would be good to deal with that indeed. If you can keep the changes fairly minimum, to what you mentioned, please give it a go. Just to avoid potential conflicts etc.
The changes are individually very simple - but there are a heck of a lot of them!
Please leave the interfaces, methods and names and other coding style issues as they are ;-)
Sure - I'm not trying to improve clarity or style or anything - just to get rid of the dumbest of the warnings so the thing mostly compiles clean.
Also, it's better not to touch most of the 'Extras' folder. Especially COLLADA_DOM and libxml,
Those two actually compile fairly cleanly already. LibXML is horrible inside - really ugly coding - but the only warnings I get about it are complaints about pointer aliassing problems that are not at all easy to fix. In fact, those are probably the only warnings that aren't trivial to fix.

I'll try to commit something later tonight.
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Post by Erwin Coumans »

Thanks a lot Steve!

On a side note, I just fixed 2 bugs in latest version related to removing objects. Introduced by some recent optimizations. Bullet 2.0f bugfix release is uploaded.

Erwin
User avatar
SteveBaker
Posts: 127
Joined: Sun Aug 13, 2006 4:41 pm
Location: Cedar Hill, Texas

Post by SteveBaker »

OK - I've committed that set of changes.

There are still a few warnings, in Extras/LibXML there are about a dozen occurrances of:
warning: dereferencing type-punned pointer will break strict-aliasing rules
...it's not easy to see how to fix these - the code in libXML is really ugly - employing every nasty coding trick in the book, there are also files with 20,000 lines of source code in one file!!

The other problem I couldn't see how to fix is that most of the demos link with a cryptic message:
/usr/lib/gcc-lib/i586-suse-linux/3.3.5/../../../../i586-suse-linux/bin/ld: `.L244' referenced in section `.rodata' of ./out/linuxx86/optimize/libs/libbullet.a(BoxShape.o): defined in discarded section `.gnu.linkonce.t._ZNK8BoxShape16GetPlaneEquationER11SimdVector4i' of ./out/linuxx86/optimize/libs/libbullet.a(BoxShape.o)
Anyway - I got rid of over 500 warning messages - so this is much better than it was.

There were quite a few cases where unused variables were initialised from external function calls - the compiler can't optimise those out because it doesn't know whether they have side-effects or not. In terms of realtime performance, it's quite important to clear these out as you work.
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Post by Erwin Coumans »

Thanks a lot Steve,

Please ignore libxml and collada. Every time a new version comes out, we might need to copy that over. Unless you want to contribute those changes back to COLLADA-DOM and libxml repositories ;-)

I will check out that linker warning,
Erwin
User avatar
SteveBaker
Posts: 127
Joined: Sun Aug 13, 2006 4:41 pm
Location: Cedar Hill, Texas

Post by SteveBaker »

I didn't have to touch any of the COLLADA files - they all compiled 100% clean out of the box.

There was just two changes I made to LibXML. schematron.c contains two unused static functions that I commented out. It's not the end of the world if that gets overwritten in a subsequent release...but I'll fling a complaint to the libXML guys.

All of the other changes were in Bullet files.
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Post by Erwin Coumans »

by the way, on the libxml thing, I think I removed some files that I considered not useful, perhaps that caused the warning.

I wanted an easy compile-out-of-the-box libxml, working under Linux, windows, Mac etc. I had to cheat, and run 'configure' and provide a config_win32.h and a config.h for non win32. For other exotic platforms, you can still re-run configure in the libxml folder.