This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH 2/4] MSP430: Disable exception handling by default for C++
- From: Oleg Endo <oleg dot endo at t-online dot de>
- To: Jozef Lawrynowicz <jozef dot l at mittosystems dot com>, "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 08 Nov 2019 09:07:39 +0900
- Subject: Re: [PATCH 2/4] MSP430: Disable exception handling by default for C++
- References: <20191107213110.0ceea63a@jozef-kubuntu> <20191107213727.731656fe@jozef-kubuntu>
On Thu, 2019-11-07 at 21:37 +0000, Jozef Lawrynowicz wrote:
> The code size bloat added by building C++ programs using libraries containing
> support for exceptions is significant. When using simple constructs such as
> static variables, sometimes many kB from the libraries are unnecessarily
> pulled in.
>
> So this patch disable exceptions by default for MSP430 when compiling for C++,
> by implicitly passing -fno-exceptions unless -fexceptions is passed.
It is extremely annoying when GCC's default standard behavior differs
across different targets. And as a consequence, you have to add a load
of workarounds and disable other things, like fiddling with the
testsuite. It's the same thing as setting "double = float" to get more
"speed" by default.
I would strongly advice against making such non-standard behaviors the
default in the vanilla compiler. C++ normally has exceptions enabled.
If a user doesn't want them and is willing to deal with it all the
consequences, then we already have a mechanism to do that:
--fno-exceptions
Perhaps it's generally more useful to add a global configure option for
GCC to disable exception handling by default. Then you can provide a
turn-key toolchain to your customers as well -- just add an option to
the configure line.
Cheers,
Oleg