[PATCH] Replace gnu::unique_ptr with std::unique_ptr

Jakub Jelinek jakub@redhat.com
Fri Dec 10 18:49:30 GMT 2021


On Tue, Nov 09, 2021 at 05:51:27PM +0000, Jonathan Wakely via Gcc-patches wrote:
> Now that GCC is compiled as C++11 there is no need to keep the C++03
> implementation of gnu::unique_ptr.
> 
> This removes the unique-ptr.h header and replaces it with <memory> in
> system.h, and changes the INCLUDE_UNIQUE_PTR macro to INCLUDE_MEMORY.
> Uses of gnu::unique_ptr and gnu::move can be replaced with
> std::unique_ptr and std::move. There are no uses of unique_xmalloc_ptr
> or xmalloc_deleter in GCC.
> 
> 
> Bootstrapped and tested on powerpc64le-linux. OK for trunk?
> 
> 
> 
> gcc/analyzer/ChangeLog:
> 
> 	* engine.cc: Define INCLUDE_MEMORY instead of INCLUDE_UNIQUE_PTR.
> 
> gcc/c-family/ChangeLog:
> 
> 	* known-headers.cc: Define INCLUDE_MEMORY instead of
> 	INCLUDE_UNIQUE_PTR.
> 	* name-hint.h: Likewise.
> 	(class name_hint): Use std::unique_ptr instead of gnu::unique_ptr.
> 
> gcc/c/ChangeLog:
> 
> 	* c-decl.c: Define INCLUDE_MEMORY instead of INCLUDE_UNIQUE_PTR.
> 	* c-parser.c: Likewise.
> 
> gcc/cp/ChangeLog:
> 
> 	* error.c: Define INCLUDE_MEMORY instead of
> 	INCLUDE_UNIQUE_PTR.
> 	* lex.c: Likewise.
> 	* name-lookup.c: Likewise.
> 	(class namespace_limit_reached): Use std::unique_ptr instead of
> 	gnu::unique_ptr.
> 	(suggest_alternatives_for): Use std::move instead of gnu::move.
> 	(suggest_alternatives_in_other_namespaces): Likewise.
> 	* parser.c: Define INCLUDE_MEMORY instead of INCLUDE_UNIQUE_PTR.
> 
> gcc/ChangeLog:
> 
> 	* Makefile.in: Remove unique-ptr-tests.o.
> 	* selftest-run-tests.c (selftest::run_tests): Remove
> 	unique_ptr_tests_cc_tests.
> 	* selftest.h (unique_ptr_tests_cc_tests): Remove.
> 	* system.h: Check INCLUDE_MEMORY instead of INCLUDE_UNIQUE_PTR
> 	and include <memory> instead of "unique-ptr.h".
> 	* unique-ptr-tests.cc: Removed.
> 
> include/ChangeLog:
> 
> 	* unique-ptr.h: Removed.

LGTM.

	Jakub



More information about the Gcc-patches mailing list