enabling optimizations (-Og) with --enable-debug
Ashod Nakashian
ashnakash at gmail.com
Thu Jan 15 13:47:28 PST 2015
> Any other thoughts on whether this is a good idea to pursue?
It probably is, but with some caveats. My main concern would be unnecessary
code pollution. It's true that these warnings could be really useful. They
might hint at actual issues in some cases (for example an unhandled error
in the unused-result case). But suppressing them can also muddle the code.
I rather 'fix' the cases that might hide real issues rather than
suppress/silence noise just for its own sake.
> 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.
Numbers are always a good reference. If it does slow down the build, it can
go as a special 'pedantic' flag or something. Possibly it could be added
such that (at least for now) it disables -Werror. This could be a good way
to fix the errors without affecting the project.
So, with a special configure flag, this can be used by those who want to
track-down potential issues and fix them without having to resolve every
paranoid warning.
I think the benefits from this flag outweighs the cost of adding it.
(Of course this is my 0.02 Swiss Franc's worth.)
On Thu, Jan 15, 2015 at 7:47 AM, Luke Deller <luke at deller.id.au> 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.
>
> 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?
>
> 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.
>
> (A draft patch is attached to enable -Og if available)
>
> Regards,
> Luke.
>
> _______________________________________________
> LibreOffice mailing list
> LibreOffice at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/libreoffice
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20150115/5a1c439e/attachment.html>
More information about the LibreOffice
mailing list