Gentoo Archives: gentoo-user

From: Florian Philipp <lists@×××××××××××.net>
To: Gentoo User List <gentoo-user@l.g.o>
Subject: Re: [gentoo-user] g++ -fnothrow-opt
Date: Sun, 26 Jan 2014 08:55:37
Message-Id: 52E4CD00.7000006@binarywings.net
In Reply to: [gentoo-user] g++ -fnothrow-opt by Florian Philipp
1 Am 22.01.2014 18:42, schrieb Florian Philipp:
2 > Hi list!
3 >
4 > I'm wondering if anyone tried setting -fnothrow-opt as a CXX_FLAG in
5 > make.conf?
6 >
7 > It makes C++ throw() statements behave like C++11 nothrow. This could
8 > have measurable performance benefits and will reduce code size. The only
9 > downside is that, when a function violates its throw() guarantee,
10 > terminate() will be called instead of unexpected().
11 >
12 > However, neither function is allowed to do anything but terminate the
13 > program. So all you possibly lose is a meaningful error message just
14 > before the program crashes.
15 >
16 > So, what do you think? Safe to enable by default?
17 >
18 > Thanks in advance!
19 > Florian Philipp
20 >
21
22 As a follow-up:
23 I grepped all distfiles to identify candidates for testing this flag.
24 The only package that I have installed (KDE desktop) that makes regular
25 use of throw() statements is LibreOffice. However, since LO already
26 enables the similar -fno-enforce-eh-specs flag, there seems to be no
27 significant advantage in enabling -fnothrow-opt.
28
29 Other packages only use these statements in the rare cases that it is
30 required for STL compatibility (subclassing extensions, specializing
31 templates).
32
33 For now I add -fno-enforce-eh-specs and -fnothrow-opt to my CXXFLAGS but
34 I doubt it will help much.
35
36 Regards,
37 Florian Philipp

Attachments

File name MIME type
signature.asc application/pgp-signature