From: John P. <jwp...@gm...> - 2008-07-08 22:09:32
|
Hi all, Due to interestingly configured mpicxx/mpicc scripts, I recently compiled the entire library in optimized mode with -Wall (by default, libmesh does not use -Wall in optimized mode). There were a lot of warnings about unused variables arising from the fact that we have a lot of code like int foo = something; libmesh_assert(foo); In optimized mode, the assert is "compiled out" and foo is (correctly) determined to be an unused variable. Roy and I decided to go ahead and wrap these variables to avoid the warnings, on the off chance that "something" might be an expensive operation you'd rather not have to do while in optimized mode. So, your previously nice-looking source code above has now been replaced with #ifndef NDEBUG int foo = something; #endif libmesh_assert(foo); or something similar. As I understand it, -DDEBUG does not affect asserts, but when NDEBUG is defined they are off. On a related note, the contributed packages were also built with -Wall, which, between laspack, metis, parmetis, netcdf, and exodusII resulted in around 2000 lines of warnings. I guess we could try to fix these (most of them are your garden variety "may be used uninitialized" and "discards qualifiers" C errors) but it would take awhile. What do you think? -- John |