This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: Question about std::terminate() in __cxa_pure_virtual()
- From: Tony Liu <mrtoniliu at gmail dot com>
- To: Jonathan Wakely <jwakely dot gcc at gmail dot com>
- Cc: "libstdc++" <libstdc++ at gcc dot gnu dot org>
- Date: Thu, 21 May 2015 19:19:13 +0800
- Subject: Re: Question about std::terminate() in __cxa_pure_virtual()
- Authentication-results: sourceware.org; auth=none
- References: <CAOAAYWADzAaAcfErtRwr0cY3KVsHQuDYhDdxTF3Pk-94QFN+JQ at mail dot gmail dot com> <CAH6eHdQZYkpZ5Nb2c_QBBCoErP13f5xS_CWS37Y0YumgT6M3Ow at mail dot gmail dot com>
Hi Jonathan,
That's quite helpful. Thanks very much.
BR,
Tony
On 21 May 2015 at 17:03, Jonathan Wakely <jwakely.gcc@gmail.com> wrote:
> On 21 May 2015 at 09:28, Tony Liu wrote:
>> Hi,
>>
>> Currently the implementation of __cxa_pure_vitual() function is:
>> extern "C" void
>> __cxxabiv1::__cxa_pure_virtual (void)
>> {
>> writestr ("pure virtual method called\n");
>> std::terminate ();
>> }
>>
>> However this version will result to quite large code size of user
>> programme, if use std::abort() instead of std::terminate(), the code
>> size drops significantly: 47080 vs 3056 in my case.
>> In the embedded system, the size of memory are quite limited. Would it
>> be possible to replace the terminate() by abort(), or replace it just
>> in some cases (e.g. -fno-exceptions enabled while building libstdc++
>> )?
>
> If you build GCC with --disable-libstdcxx-verbose then the terminate
> handler is simply std::abort, are you doing that?