enabling optimizations (-Og) with --enable-debug

Stephan Bergmann sbergman at redhat.com
Fri Jan 16 02:10:29 PST 2015


On 01/15/2015 01:47 PM, Luke Deller wrote:
> Yesterday I floated the idea on IRC of using this with --enable-debug
> rather than -O0 if available, and some feedback was that it enables gcc
> to report extra warnings which would be a good thing.

It /potentially/ enables GCC to emit more (useful) warnings, as some of 
GCC's warnings are known to be only emitted when certain optimizations 
are enabled.  The benefit of having such warnings also emitted during 
debug builds would be that developers would be made aware of them more 
quickly.

(As it turns out, GCC unfortunately also emits some false warnings at 
-Og which it would not emit at neither -O0 nor -O2.  That, of course, is 
not considered useful.)

> So I guess this means we couldn't incorporate -Og until all these new
> warnings are fixed right?

Yes, please get any warning fallout addressed beforehand (and I see 
you're already doing that with 
<https://gerrit.libreoffice.org/#/c/13929/> "Avoid false 
'maybe-uninitialized' warnings").

> Any other thoughts on whether this is a good idea to pursue?  One fear
> was that it might slow down compilation, but it doesn't actually seem to
> slow down "make clean && make" much at all for me.  I'll get some proper
> timing measurements.

My "-Og potentially makes the build time longer, but [...]" was meant in 
direct response to your "to make it run faster, make the build smaller" 
(which, in turn, was a reply to "why would one want to enable 
optimizations in a debug build?").  I would not worry too much if it 
actually does make the build a little slower, but measuring it of course 
can't hurt.


More information about the LibreOffice mailing list