Re: Patch - Debug builds without optimization
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Florian Pflug <fgp@phlo.org>
Cc: Radosław Smogura <rsmogura@softperience.eu>, PG Hackers <pgsql-hackers@postgresql.org>
Date: 2011-06-16T14:10:49Z
Lists: pgsql-hackers
Florian Pflug <fgp@phlo.org> writes: > On Jun16, 2011, at 14:30 , Radosaw Smogura wrote: >> I'm sending following patch which disables optimization when --enable-debug is passed. It was nasty (for me, at least) that debug build required passing of CFLAGS with -O0 to get nice traceable code. > Unfortunately, with some compilers (gcc, I'm looking at you) you get > considerably fewer warnings with -O0 than with -O1, even if you specify > -Wall. Yes. There is *zero* chance of this being accepted, because it would break a lot of warnings that developers need to see. > I usually use -O1 for debug builds, these are usually still at least > somewhat debuggable with gdb. I tend to do that too, but I still think that folding it into --enable-debug would be a mistake. The normal assumption (at least when using gcc) is that --enable-debug doesn't cost any performance. We would annoy many people, especially packagers, if that stopped being true. I could see providing some other nonstandard configure switch that changed the default -O level ... but realistically, would that do anything that you couldn't already do by setting CFLAGS, ie ./configure CFLAGS="-O0 -g" regards, tom lane