public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/59894] New: Force use of the default new/delete
@ 2014-01-20 21:36 glisse at gcc dot gnu.org
  2014-01-20 21:57 ` [Bug libstdc++/59894] " trippels at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: glisse at gcc dot gnu.org @ 2014-01-20 21:36 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59894

            Bug ID: 59894
           Summary: Force use of the default new/delete
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: glisse at gcc dot gnu.org

Hello,

operator new and operator delete are hidden in libsupc++ so they can be easily
replaced, either directly in the code, or later by interposing a library. Doing
so has a cost, and I have seen people (and done it myself) providing a
definition in their code that was roughly equivalent to the standard one, just
so it could be inlined.

I wonder if we could provide a flag in libstdc++ so that if the user compiles
his code with -D_GLIBCXX_FORCE_DEFAULT_ALLOCATION (a better name would be
welcome), <new> defines inline versions of the operators. We might even want to
skip new_handler in that version, I am not sure.

I didn't think too long about the possible drawbacks, but defining the macro
would be a pretty clear message from the user that he takes full responsibility
for all the consequences.

(we are also using, in the same code, extern "C" __typeof(malloc) malloc
__attribute__((returns_nonnull)); so it really simplifies, but PR 59875 shows
that simplifying operator delete(0) would already be nice)

PR 59893 considers a different path using LTO to inline at link time the
definition from libsupc++.


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-02-24 14:01 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-20 21:36 [Bug libstdc++/59894] New: Force use of the default new/delete glisse at gcc dot gnu.org
2014-01-20 21:57 ` [Bug libstdc++/59894] " trippels at gcc dot gnu.org
2014-01-20 22:07 ` glisse at gcc dot gnu.org
2014-01-21  9:40 ` redi at gcc dot gnu.org
2014-02-24 14:01 ` glisse at gcc dot gnu.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).