On Mon, Jun 06, 2016 at 11:57:49PM +0200, Jakub Jelinek wrote: > On Mon, Jun 06, 2016 at 05:53:50PM -0400, Trevor Saunders wrote: > > > > As far as I can > > > > tell this just involves moving the start of namespace selftest > > > > upwards a > > > > bit in the files where we have tests. > > > > > > Yes, and it does seem cleaner to have all of the selftest code start > > > like this: > > > > > > #if CHECKING_P > > > > What are we gaining by ifdefing this? I would think on reasonable > > systems the compiler would optimize out the call to the selftests in > > release builds and then the linker would gc all the unused functions. > > Do we really care about code size in places that doesn't happen enough > > to go through this? > > Not everyone is building the compiler with LTO, and if you don't, then > how would you optimize that away?
-ffunction-sections -Wl,--gc-sections should be enough I think. I guess we don't use those at the moment though. > And yes, not having the self-tests, especially if they are going to grow > further, in release compilers is desirable, especially if it would be > intermixed with hot code. That's fair, though turning on --gc-sections where we can should further help with that, and that should be more effective with -ffunction-sections -fdata-sections, so its seems to me like the right thing to do is add configure tests to enable those? And then its more of a non issue? Trev > > Jakub