From: Jonathan Wakely
Date: Wed, 1 Dec 2021 17:56:23 +0000 (+0000)
Subject: libstdc++: Fix non-reserved name in std::allocator base class [PR64135]
X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=fe9571a35db53e5203326f854f73e432691d67f6;p=test_jj.git
libstdc++: Fix non-reserved name in std::allocator base class [PR64135]
The possible base classes of std::allocator are new_allocator and
malloc_allocator, which both cause a non-reserved name to be declared in
every program that includes the definition of std::allocator. This is
non-conforming.
This change replaces __gnu_cxx::new_allocator with std::__new_allocator
which is identical except for using a reserved name. The non-standard
extension __gnu_cxx::new_allocator is preserved as a thin wrapper over
std::__new_allocator. There is no problem with the extension using a
non-reserved name now that it's not included by default in other
headers.
The same change could be done to __gnu_cxx::malloc_allocator but as it's
not the default configuration it can wait.
libstdc++-v3/ChangeLog:
PR libstdc++/64135
* config/allocator/new_allocator_base.h: Include
instead of .
(__allocator_base): Use std::__new_allocator instead of
__gnu_cxx::new_allocator.
* doc/xml/manual/allocator.xml: Document new default base class
for std::allocator.
* doc/xml/manual/evolution.xml: Likewise.
* doc/html/*: Regenerate.
* include/Makefile.am: Add bits/new_allocator.h.
* include/Makefile.in: Regenerate.
* include/experimental/memory_resource (new_delete_resource):
Use std::__new_allocator instead of __gnu_cxx::new_allocator.
* include/ext/new_allocator.h (new_allocator): Derive from
std::__new_allocator. Move implementation to ...
* include/bits/new_allocator.h: New file.
* testsuite/20_util/allocator/64135.cc: New test.
---
diff --git a/libstdc++-v3/config/allocator/new_allocator_base.h b/libstdc++-v3/config/allocator/new_allocator_base.h
index 7c52fef..a139f2f 100644
--- a/libstdc++-v3/config/allocator/new_allocator_base.h
+++ b/libstdc++-v3/config/allocator/new_allocator_base.h
@@ -30,7 +30,7 @@
#ifndef _GLIBCXX_CXX_ALLOCATOR_H
#define _GLIBCXX_CXX_ALLOCATOR_H 1
-#include
+#include
#if __cplusplus >= 201103L
namespace std
@@ -38,18 +38,17 @@ namespace std
/**
* @brief An alias to the base class for std::allocator.
*
- * Used to set the std::allocator base class to
- * __gnu_cxx::new_allocator.
+ * Used to set the std::allocator base class to std::__new_allocator.
*
* @ingroup allocators
* @tparam _Tp Type of allocated object.
*/
template
- using __allocator_base = __gnu_cxx::new_allocator<_Tp>;
+ using __allocator_base = __new_allocator<_Tp>;
}
#else
-// Define new_allocator as the base class to std::allocator.
-# define __allocator_base __gnu_cxx::new_allocator
+// Define __new_allocator as the base class to std::allocator.
+# define __allocator_base __new_allocator
#endif
#ifndef _GLIBCXX_SANITIZE_STD_ALLOCATOR
diff --git a/libstdc++-v3/doc/html/manual/api.html b/libstdc++-v3/doc/html/manual/api.html
index 2cc44ae..00701fa 100644
--- a/libstdc++-v3/doc/html/manual/api.html
+++ b/libstdc++-v3/doc/html/manual/api.html
@@ -447,4 +447,7 @@ Dynamic exception specifications should be replaced with noex
The bitmap
, mt
, and pool
options for --enable-libstdcxx-allocator
were removed.
+For the new
option, std::allocator
+no longer derives from __gnu_cxx::new_allocator
;
+they both derive from std::__new_allocator
instead.