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

Michael Stahl mstahl at redhat.com
Tue Nov 29 11:56:59 UTC 2016


On 01/15/2015 01:47 PM, Luke Deller wrote:
> Hi,
> 
> I saw that gcc-4.8 introduced a new optimization level -Og which enables 
> optimizations that do not interfere with debugging.
> 
> 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.

somebody had the same idea last week... and i've now discovered this old
thread...

> I tried it out and can see that it does indeed break the build if 
> --enable-werror is enabled, eg:
> 
> /home/deller/build/libo/vcl/unx/glxtest.cxx: In function ‘void glxtest()’:
> /home/deller/build/libo/vcl/unx/glxtest.cxx:236:44: error: ignoring 
> return value of ‘ssize_t write(int, const void*, size_t)’, declared with 
> attribute warn_unused_result [-Werror=unused-result]
>     write(write_end_of_the_pipe, buf, length);
> 
> So I guess this means we couldn't incorporate -Og until all these new 
> warnings are fixed right?

i've fixed all spurious warnings from GCC 6.2.1 -Og on master.

> 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.

i've done a few timings, see the commit message of
https://gerrit.libreoffice.org/#/c/31334/

summary: from-scratch make check is a tiny bit slower (75m -O0, 76m -Og)
*but* incremental make check is 20% faster (12m vs. 15m) so for the
average developer it should be a win.

> (A draft patch is attached to enable -Og if available)

thanks, i've taken the configure part of this.

only open question is if it actually works as advertised, i.e. is gdb
confused by the optimized code or not.  anybody want to experiment?


More information about the LibreOffice mailing list