GCC Bugzilla has been upgraded from version 4.4.9 to 5.0rc3. If you see any problem, please report it to bug 64968.
Bug 43863 - Unused recursive_init_error class defined with -fno-exceptions
Summary: Unused recursive_init_error class defined with -fno-exceptions
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: libstdc++ (show other bugs)
Version: 4.5.0
: P3 enhancement
Target Milestone: 4.6.0
Assignee: Jonathan Wakely
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-04-23 06:53 UTC by Sebastian Huber
Modified: 2011-02-09 23:24 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2010-06-24 13:44:10


Attachments
Proposed changes. (466 bytes, patch)
2010-04-23 06:55 UTC, Sebastian Huber
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Sebastian Huber 2010-04-23 06:53:53 UTC
You can use the configure option

--enable-cxx-flags=-fno-exceptions

to create a C++ compiler without exceptions for the standard C++ library and the built in new/delete operators.

In some cases you want this to save code space.  Unfortunately this goal cannot be achieved.  In guard.cc the class __gnu_cxx::recursive_init_error is defined which pulls in pure.cc via std::exception which depends on the IO libary.
Comment 1 Sebastian Huber 2010-04-23 06:55:19 UTC
Created attachment 20468 [details]
Proposed changes.

An alternative is to define this class in a separate file.
Comment 2 Jonathan Wakely 2010-04-23 09:09:35 UTC
In Bug 43852 I thought you meant building with -fno-exceptions fails, but it works for me ... do you just mean the resulting library is not as small as it could be?
Comment 3 Sebastian Huber 2010-04-23 09:28:16 UTC
(In reply to comment #2)
> In Bug 43852 I thought you meant building with -fno-exceptions fails, but it
> works for me ... do you just mean the resulting library is not as small as it
> could be?
> 

Sorry for the misunderstanding.  The build works fine, but the library is not as small as it could be.  This is due to the inclusion of the unused __gnu_cxx::recursive_init_error class.  For small target systems this is dramatic.
Comment 4 Jonathan Wakely 2010-04-23 09:36:22 UTC
confirmed as an enhancement request
Comment 5 Jonathan Wakely 2010-04-23 10:02:18 UTC
Simply removing this class now would break the ABI, which is not acceptable.
If Bug 43852 was resolved by adding a "quiet" mode, would that make this enhancement unnecessary?  That mode would also change the ABI, but would have to be explicitly requested by users, and would be documented as changing the ABI.

Am I right in thinking that putting recursive_init_error in a separate file would only help when using static linking?
Comment 6 Sebastian Huber 2010-04-23 10:59:41 UTC
(In reply to comment #5)
> Simply removing this class now would break the ABI, which is not acceptable.
> If Bug 43852 was resolved by adding a "quiet" mode, would that make this
> enhancement unnecessary?  That mode would also change the ABI, but would have
> to be explicitly requested by users, and would be documented as changing the
> ABI.
> 
> Am I right in thinking that putting recursive_init_error in a separate file
> would only help when using static linking?
> 

Yes, it helps only if you use static linking.

From my point of view moving this class implementation into a separate compilation unit would help in case size really matters.  In these situations you likely use static linking, because otherwise you need a runtime infrastructure for dynamic linking which is also not that trivial.

If you suppose that users who care about size always choose the "quiet" mode then this change is virtually unnecessary, but not optimal.
Comment 7 Jonathan Wakely 2011-01-11 16:54:05 UTC
I'll get this done asap ...
Comment 8 Jonathan Wakely 2011-02-09 23:22:31 UTC
Author: redi
Date: Wed Feb  9 23:22:27 2011
New Revision: 169989

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=169989
Log:
2011-02-09  Jonathan Wakely  <jwakely.gcc@gmail.com>

	PR libstdc++/43863
	* libsupc++/guard.cc (recursive_init_error::~recursive_init_error):
	Move to ...
	* libsupc++/guard_error.cc: ... new file.
	* libsupc++/Makefile.am: Update.
	* libsupc++/Makefile.in: Regenerate.

Added:
    trunk/libstdc++-v3/libsupc++/guard_error.cc
Modified:
    trunk/libstdc++-v3/ChangeLog
    trunk/libstdc++-v3/libsupc++/Makefile.am
    trunk/libstdc++-v3/libsupc++/Makefile.in
    trunk/libstdc++-v3/libsupc++/guard.cc
Comment 9 Jonathan Wakely 2011-02-09 23:24:19 UTC
Sorry for taking so long - this is done for 4.6.0