Add gnu::unique_ptr
commitb6b04a7be4a50d58191e89c321ac9bb1dea79d5c
authordmalcolm <dmalcolm@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 16 Oct 2017 20:50:40 +0000 (16 20:50 +0000)
committerdmalcolm <dmalcolm@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 16 Oct 2017 20:50:40 +0000 (16 20:50 +0000)
treee11b3eda93410442b9c1c59e85c5147392d1728b
parentd106f8f5a72093f2cf21663aaf3dbea845cafd62
Add gnu::unique_ptr

This is a version of the patch posted by Trevor Saunders on 2017-07-31,
for which he wrote:
> For most of the history of this see
>   https://sourceware.org/ml/gdb-patches/2016-10/msg00223.html
> The changes are mostly s/gdb/gtl/g

This version was updated by me (dmalcolm) adding these changes:
- renaming of "gtl" to "gnu" (3 letters, and one of the ones Richi
  proposed, and not a match for "*tl")
- renaming of DEFINE_GDB_UNIQUE_PTR to DEFINE_GNU_UNIQUE_PTR
- renaming of xfree_deleter to xmalloc_deleter, and making it
  use "free" rather than "xfree" (which doesn't exist)
- added a gcc/unique-ptr-tests.cc
- implement unique_xmalloc_ptr<T[]> (taken from gdb, but changing
  "xfree" to "free", and adding support for pre-C++-11)

gcc/ChangeLog:

David Malcolm <dmalcolm@redhat.com>

* Makefile.in (OBJS): Add unique-ptr-tests.o.
* selftest-run-tests.c (selftest::run_tests): Call
selftest::unique_ptr_tests_cc_tests.
* selftest.h (selftest::unique_ptr_tests_cc_tests): New decl.
* unique-ptr-tests.cc: New file.

include/ChangeLog:

Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>
David Malcolm <dmalcolm@redhat.com>

* unique-ptr.h: New file.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@253797 138bc75d-0d04-0410-961f-82ee72b054a4
gcc/ChangeLog
gcc/Makefile.in
gcc/selftest-run-tests.c
gcc/selftest.h
gcc/unique-ptr-tests.cc [new file with mode: 0644]
include/ChangeLog
include/unique-ptr.h [new file with mode: 0644]