Remove using-declarations that add std names to __gnu_cxx

Programming / Compilers / GCC - redi [138bc75d-0d04-0410-961f-82ee72b054a4] - 31 May 2019 10:35 EDT

These using-declarations appear to have been added for simplicity when moving the non-standard extensions from namespace std to namespace __gnu_cxx. Dumping all these names into namespace __gnu_cxx allows unportable uses like __gnu_cxx::size_t and __gnu_cxx::pair, which serve no useful purpose.

This patch removes most of the using-declarations from namespace scope, then either qualifies names as needed or adds using-declarations at block scope or typedefs at class scope.

- include/backward/hashtable.h (size_t, ptrdiff_t) (forward_iterator_tag, input_iterator_tag, _Construct, _Destroy) (distance, vector, pair, __iterator_category): Remove using-declarations that add these names to namespace __gnu_cxx.
- include/ext/bitmap_allocator.h (size_t, ptrdiff_t): Likewise.
- include/ext/debug_allocator.h (size_t): Likewise.
- include/ext/functional (size_t, unary_function, binary_function) (mem_fun1_t, const_mem_fun1_t, mem_fun1_ref_t, const_mem_fun1_ref_t): Likewise.
- include/ext/malloc_allocator.h (size_t, ptrdiff_t): Likewise.
- include/ext/memory (ptrdiff_t, pair, __iterator_category): Likewise.
- include/ext/mt_allocator.h (size_t, ptrdiff_t): Likewise.
- include/ext/new_allocator.h (size_t, ptrdiff_t): Likewise.
- include/ext/numeric (iota): Fix outdated comment.
- include/ext/pool_allocator.h (size_t, ptrdiff_t): Likewise.
- include/ext/rb_tree (_Rb_tree, allocator): Likewise.
- include/ext/rope (size_t, ptrdiff_t, allocator, _Destroy): Likewise.
- include/ext/ropeimpl.h (size_t, printf, basic_ostream) (__throw_length_error, _Destroy, std::__uninitialized_fill_n_a): Likewise.
- include/ext/slist (size_t, ptrdiff_t, _Construct, _Destroy) (allocator, __true_type, __false_type): Likewise.

1ff189c5753 Remove using-declarations that add std names to __gnu_cxx
libstdc++-v3/ChangeLog | 25 +++
libstdc++-v3/include/backward/hashtable.h | 79 +++----
libstdc++-v3/include/ext/bitmap_allocator.h | 91 ++++----
libstdc++-v3/include/ext/debug_allocator.h | 4 +-
libstdc++-v3/include/ext/functional | 46 ++--
libstdc++-v3/include/ext/malloc_allocator.h | 11 +-
libstdc++-v3/include/ext/memory | 33 +--
libstdc++-v3/include/ext/mt_allocator.h | 26 +--
libstdc++-v3/include/ext/new_allocator.h | 11 +-
libstdc++-v3/include/ext/numeric | 2 +-
libstdc++-v3/include/ext/pool_allocator.h | 12 +-
libstdc++-v3/include/ext/rb_tree | 9 +-
libstdc++-v3/include/ext/rope | 319 ++++++++++++++--------------
libstdc++-v3/include/ext/ropeimpl.h | 118 +++++-----
libstdc++-v3/include/ext/slist | 32 ++-
15 files changed, 413 insertions(+), 405 deletions(-)

Upstream: gcc.gnu.org


  • Share