public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/44647] New: std::nothrow and std::bad_alloc are coupled
@ 2010-06-23 14:35 sebastian dot huber at embedded-brains dot de
2010-06-23 14:57 ` [Bug libstdc++/44647] " redi at gcc dot gnu dot org
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: sebastian dot huber at embedded-brains dot de @ 2010-06-23 14:35 UTC (permalink / raw)
To: gcc-bugs
The definitions of std::nothrow, __new_handler and std::bad_alloc are in the
same file. This is bad since the std::bad_alloc definition pulls in the
exception support. The std::bad_alloc definitions should be placed into a
separate file.
--
Summary: std::nothrow and std::bad_alloc are coupled
Product: gcc
Version: 4.4.4
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: sebastian dot huber at embedded-brains dot de
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44647
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug libstdc++/44647] std::nothrow and std::bad_alloc are coupled
2010-06-23 14:35 [Bug libstdc++/44647] New: std::nothrow and std::bad_alloc are coupled sebastian dot huber at embedded-brains dot de
@ 2010-06-23 14:57 ` redi at gcc dot gnu dot org
2010-06-23 15:02 ` sebastian dot huber at embedded-brains dot de
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: redi at gcc dot gnu dot org @ 2010-06-23 14:57 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from redi at gcc dot gnu dot org 2010-06-23 14:57 -------
(In reply to comment #0)
> The std::bad_alloc definitions should be placed into a
> separate file.
IIUC that wouldn't work, <new> is required to declare bad_alloc, so if
bad_alloc was moved to a separate file, the parts of the library which need
nothrow_t, new_handler and operator new etc. would still have to include <new>,
which would still have to include bad_alloc.
The way to achieve what you want is to put everything except bad_alloc in a
separate file, and include that file instead of <new> when bad_alloc is not
needed.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44647
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug libstdc++/44647] std::nothrow and std::bad_alloc are coupled
2010-06-23 14:35 [Bug libstdc++/44647] New: std::nothrow and std::bad_alloc are coupled sebastian dot huber at embedded-brains dot de
2010-06-23 14:57 ` [Bug libstdc++/44647] " redi at gcc dot gnu dot org
@ 2010-06-23 15:02 ` sebastian dot huber at embedded-brains dot de
2010-06-23 15:14 ` redi at gcc dot gnu dot org
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: sebastian dot huber at embedded-brains dot de @ 2010-06-23 15:02 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from sebastian dot huber at embedded-brains dot de 2010-06-23 15:02 -------
(In reply to comment #1)
> (In reply to comment #0)
> > The std::bad_alloc definitions should be placed into a
> > separate file.
>
> IIUC that wouldn't work, <new> is required to declare bad_alloc, so if
> bad_alloc was moved to a separate file, the parts of the library which need
> nothrow_t, new_handler and operator new etc. would still have to include <new>,
> which would still have to include bad_alloc.
>
> The way to achieve what you want is to put everything except bad_alloc in a
> separate file, and include that file instead of <new> when bad_alloc is not
> needed.
>
There is nothing wrong with <new>. The problem is new_handler.cc.
Suppose you use
#include <new>
int *p = new (std::nothrow) int;
this will use the operator new implementation in new_opnt.cc. This one uses
__new_handler which is now coupled with std::bad_alloc.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44647
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug libstdc++/44647] std::nothrow and std::bad_alloc are coupled
2010-06-23 14:35 [Bug libstdc++/44647] New: std::nothrow and std::bad_alloc are coupled sebastian dot huber at embedded-brains dot de
2010-06-23 14:57 ` [Bug libstdc++/44647] " redi at gcc dot gnu dot org
2010-06-23 15:02 ` sebastian dot huber at embedded-brains dot de
@ 2010-06-23 15:14 ` redi at gcc dot gnu dot org
2010-06-23 15:20 ` sebastian dot huber at embedded-brains dot de
2010-06-23 15:24 ` redi at gcc dot gnu dot org
4 siblings, 0 replies; 6+ messages in thread
From: redi at gcc dot gnu dot org @ 2010-06-23 15:14 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from redi at gcc dot gnu dot org 2010-06-23 15:14 -------
OK, now I understand what you're suggesting.
Confirmed as a valid enhancement request.
--
redi at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Severity|normal |enhancement
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Last reconfirmed|0000-00-00 00:00:00 |2010-06-23 15:14:45
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44647
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug libstdc++/44647] std::nothrow and std::bad_alloc are coupled
2010-06-23 14:35 [Bug libstdc++/44647] New: std::nothrow and std::bad_alloc are coupled sebastian dot huber at embedded-brains dot de
` (2 preceding siblings ...)
2010-06-23 15:14 ` redi at gcc dot gnu dot org
@ 2010-06-23 15:20 ` sebastian dot huber at embedded-brains dot de
2010-06-23 15:24 ` redi at gcc dot gnu dot org
4 siblings, 0 replies; 6+ messages in thread
From: sebastian dot huber at embedded-brains dot de @ 2010-06-23 15:20 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from sebastian dot huber at embedded-brains dot de 2010-06-23 15:20 -------
Created an attachment (id=20987)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=20987&action=view)
Moves std::bad_alloc implementation into new file bad_alloc.cc
I don't know how to regenerate the Makefile.in. A simple automake invocation
changes a lot in the Makefile.in.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44647
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug libstdc++/44647] std::nothrow and std::bad_alloc are coupled
2010-06-23 14:35 [Bug libstdc++/44647] New: std::nothrow and std::bad_alloc are coupled sebastian dot huber at embedded-brains dot de
` (3 preceding siblings ...)
2010-06-23 15:20 ` sebastian dot huber at embedded-brains dot de
@ 2010-06-23 15:24 ` redi at gcc dot gnu dot org
4 siblings, 0 replies; 6+ messages in thread
From: redi at gcc dot gnu dot org @ 2010-06-23 15:24 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from redi at gcc dot gnu dot org 2010-06-23 15:24 -------
leave it to me (apart from not including the re-generated autoconf file, your
patch doesn't update the Copyright dates)
--
redi at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |redi at gcc dot gnu dot org
|dot org |
Status|NEW |ASSIGNED
Last reconfirmed|2010-06-23 15:14:45 |2010-06-23 15:24:06
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44647
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2010-06-23 15:24 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-23 14:35 [Bug libstdc++/44647] New: std::nothrow and std::bad_alloc are coupled sebastian dot huber at embedded-brains dot de
2010-06-23 14:57 ` [Bug libstdc++/44647] " redi at gcc dot gnu dot org
2010-06-23 15:02 ` sebastian dot huber at embedded-brains dot de
2010-06-23 15:14 ` redi at gcc dot gnu dot org
2010-06-23 15:20 ` sebastian dot huber at embedded-brains dot de
2010-06-23 15:24 ` redi at gcc dot gnu dot org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).