Re: Patch - Debug builds without optimization - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Patch - Debug builds without optimization
Date
Msg-id 29585.1308233449@sss.pgh.pa.us
Whole thread Raw
In response to Re: Patch - Debug builds without optimization  (Florian Pflug <fgp@phlo.org>)
Responses Re: Patch - Debug builds without optimization
Re: Patch - Debug builds without optimization
List pgsql-hackers
Florian Pflug <fgp@phlo.org> writes:
> On Jun16, 2011, at 14:30 , Radosław 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


pgsql-hackers by date:

Previous
From: "Ross J. Reedstrom"
Date:
Subject: Re: pg_upgrade using appname to lock out other users
Next
From: Heikki Linnakangas
Date:
Subject: Re: Latch implementation that wakes on postmaster death on both win32 and Unix