public inbox for libabigail@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 0/6] Drop C++03 compatibility layer from abg-cxx-compat.h
@ 2020-12-14 23:08 Matthias Maennich
  2020-12-14 23:08 ` [PATCH 1/6] Drop C++03 compatibility layer Matthias Maennich
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: Matthias Maennich @ 2020-12-14 23:08 UTC (permalink / raw)
  To: libabigail; +Cc: dodji, gprocida, kernel-team, maennich

This drops the compatiblity layer and clears out the abg_compat namespace from
definitions that are now provided via the standard. Subsequently, fix up the
necessary imports and use std:: names instead.

While abg-cxx-compat.h remains now empty, there are lined up patches that will
make use it again. Hence leave it empty and the corresponding test untouched as
well.

Matthias Maennich (6):
  Drop C++03 compatibility layer
  Remove <functional> usages from abg_compat
  Remove <memory> usages from abg_compat
  Remove <unordered_map> usages from abg_compat
  Remove <unordered_set> usages from abg_compat
  Drop unneccessary includes of abg-cxx-compat.h

 include/abg-comparison.h         |  7 +--
 include/abg-cxx-compat.h         | 52 -------------------
 include/abg-diff-utils.h         |  8 +--
 include/abg-fwd.h                | 15 +++---
 include/abg-ini.h                | 10 ++--
 include/abg-interned-str.h       | 10 ++--
 include/abg-ir.h                 | 17 ++++---
 include/abg-libxml-utils.h       |  4 +-
 include/abg-libzip-utils.h       |  4 +-
 include/abg-regex.h              |  4 +-
 include/abg-reporter.h           |  4 +-
 include/abg-sptr-utils.h         |  8 +--
 include/abg-suppression.h        |  5 +-
 include/abg-tools-utils.h        | 14 +++---
 include/abg-workers.h            |  4 +-
 src/abg-comp-filter.cc           |  4 +-
 src/abg-comparison-priv.h        |  9 ++--
 src/abg-corpus.cc                |  4 +-
 src/abg-dwarf-reader.cc          | 18 ++++---
 src/abg-hash.cc                  | 86 ++++++++++++++++----------------
 src/abg-ir.cc                    | 28 ++++++-----
 src/abg-reader.cc                | 21 ++++----
 src/abg-suppression.cc           |  4 +-
 src/abg-tools-utils.cc           | 15 +++---
 src/abg-writer.cc                | 17 ++++---
 tests/test-diff-filter.cc        |  7 +--
 tests/test-diff-pkg.cc           |  7 +--
 tests/test-diff-suppr.cc         | 15 +++---
 tests/test-read-dwarf.cc         |  7 +--
 tests/test-read-write.cc         | 10 ++--
 tests/test-types-stability.cc    |  7 +--
 tests/test-write-read-archive.cc |  5 +-
 tools/abicompat.cc               | 10 ++--
 tools/abidiff.cc                 |  7 +--
 tools/abidw.cc                   | 10 ++--
 tools/abilint.cc                 | 10 ++--
 tools/abipkgdiff.cc              | 19 +++----
 37 files changed, 227 insertions(+), 259 deletions(-)

-- 
2.29.2.684.gfbc64c5ab5-goog


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

* [PATCH 1/6] Drop C++03 compatibility layer
  2020-12-14 23:08 [PATCH 0/6] Drop C++03 compatibility layer from abg-cxx-compat.h Matthias Maennich
@ 2020-12-14 23:08 ` Matthias Maennich
  2020-12-14 23:08 ` [PATCH 2/6] Remove <functional> usages from abg_compat Matthias Maennich
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Matthias Maennich @ 2020-12-14 23:08 UTC (permalink / raw)
  To: libabigail; +Cc: dodji, gprocida, kernel-team, maennich

Now with C++11 as minimum standard, we can drop the facilities required
to support earlier standards. Hence purge the use of std::tr1 from the
sources.

	* include/abg-cxx-compat.h: remove compatibility with pre C++11.
	* include/abg-ir.h: Remove mention of std::tr1 from comments.
	* include/abg-sptr-utils.h: Likewise.

Signed-off-by: Matthias Maennich <maennich@google.com>
---
 include/abg-cxx-compat.h | 32 --------------------------------
 include/abg-ir.h         |  4 ++--
 include/abg-sptr-utils.h |  4 ++--
 3 files changed, 4 insertions(+), 36 deletions(-)

diff --git a/include/abg-cxx-compat.h b/include/abg-cxx-compat.h
index 46b2ac3aa564..1d5dab48be75 100644
--- a/include/abg-cxx-compat.h
+++ b/include/abg-cxx-compat.h
@@ -8,26 +8,13 @@
 #ifndef __ABG_CXX_COMPAT_H
 #define __ABG_CXX_COMPAT_H
 
-#if __cplusplus >= 201103L
-
 #include <functional>
 #include <memory>
 #include <unordered_map>
 #include <unordered_set>
 
-#else
-
-#include <tr1/functional>
-#include <tr1/memory>
-#include <tr1/unordered_map>
-#include <tr1/unordered_set>
-
-#endif
-
 namespace abg_compat {
 
-#if __cplusplus >= 201103L
-
 // <functional>
 using std::hash;
 
@@ -43,25 +30,6 @@ using std::unordered_map;
 // <unordered_set>
 using std::unordered_set;
 
-#else
-
-// <functional>
-using std::tr1::hash;
-
-// <memory>
-using std::tr1::shared_ptr;
-using std::tr1::weak_ptr;
-using std::tr1::dynamic_pointer_cast;
-using std::tr1::static_pointer_cast;
-
-// <unordered_map>
-using std::tr1::unordered_map;
-
-// <unordered_set>
-using std::tr1::unordered_set;
-
-#endif
-
 }
 
 #endif  // __ABG_CXX_COMPAT_H
diff --git a/include/abg-ir.h b/include/abg-ir.h
index 165b336aacee..11af6b00647d 100644
--- a/include/abg-ir.h
+++ b/include/abg-ir.h
@@ -35,7 +35,7 @@
 /// How objects' lifetime is handled in libabigail.
 ///
 /// For memory management and garbage collection of libabigail's IR
-/// artifacts, we use std::tr1::shared_ptr and std::tr1::weak_ptr.
+/// artifacts, we use std::shared_ptr and std::weak_ptr.
 ///
 /// When manipulating these IR artifacts, there are a few rules to keep in
 /// mind.
@@ -90,7 +90,7 @@ namespace abigail
 namespace ir
 {
 
-// Inject some std::tr1 types in here.
+// Inject some std types in here.
 using abg_compat::unordered_map;
 
 /// A convenience typedef fo r an ordered set of size_t.
diff --git a/include/abg-sptr-utils.h b/include/abg-sptr-utils.h
index 8259c8e11f21..3f328522a153 100644
--- a/include/abg-sptr-utils.h
+++ b/include/abg-sptr-utils.h
@@ -5,7 +5,7 @@
 
 /// @file
 ///
-/// Utilities to ease the wrapping of C types into std::tr1::shared_ptr
+/// Utilities to ease the wrapping of C types into std::shared_ptr
 
 #ifndef __ABG_SPTR_UTILS_H__
 #define __ABG_SPTR_UTILS_H__
@@ -17,7 +17,7 @@
 namespace abigail
 {
 
-/// Namespace for the utilities to wrap C types into std::tr1::shared_ptr.
+/// Namespace for the utilities to wrap C types into std::shared_ptr.
 namespace sptr_utils
 {
 
-- 
2.29.2.684.gfbc64c5ab5-goog


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

* [PATCH 2/6] Remove <functional> usages from abg_compat
  2020-12-14 23:08 [PATCH 0/6] Drop C++03 compatibility layer from abg-cxx-compat.h Matthias Maennich
  2020-12-14 23:08 ` [PATCH 1/6] Drop C++03 compatibility layer Matthias Maennich
@ 2020-12-14 23:08 ` Matthias Maennich
  2020-12-14 23:08 ` [PATCH 3/6] Remove <memory> " Matthias Maennich
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Matthias Maennich @ 2020-12-14 23:08 UTC (permalink / raw)
  To: libabigail; +Cc: dodji, gprocida, kernel-team, maennich

std::hash is now provided through the language standard, hence remove
the compatibility code for <functional> and adjust all users
accordingly.

	* include/abg-cxx-compat.h: Drop compatibility layer for <functional>.
	* include/abg-interned-str.h: migrate abg_compat use to std.
	* include/abg-ir.h: Likewise.
	* src/abg-hash.cc: Likewise.
	* src/abg-ir.cc: Likewise.

Signed-off-by: Matthias Maennich <maennich@google.com>
---
 include/abg-cxx-compat.h   |  4 --
 include/abg-interned-str.h |  3 +-
 include/abg-ir.h           |  3 +-
 src/abg-hash.cc            | 85 +++++++++++++++++++-------------------
 src/abg-ir.cc              | 19 +++++----
 5 files changed, 57 insertions(+), 57 deletions(-)

diff --git a/include/abg-cxx-compat.h b/include/abg-cxx-compat.h
index 1d5dab48be75..f3c343dfd481 100644
--- a/include/abg-cxx-compat.h
+++ b/include/abg-cxx-compat.h
@@ -8,16 +8,12 @@
 #ifndef __ABG_CXX_COMPAT_H
 #define __ABG_CXX_COMPAT_H
 
-#include <functional>
 #include <memory>
 #include <unordered_map>
 #include <unordered_set>
 
 namespace abg_compat {
 
-// <functional>
-using std::hash;
-
 // <memory>
 using std::shared_ptr;
 using std::weak_ptr;
diff --git a/include/abg-interned-str.h b/include/abg-interned-str.h
index 6967704f1ff4..dc1adf1fb290 100644
--- a/include/abg-interned-str.h
+++ b/include/abg-interned-str.h
@@ -16,6 +16,7 @@
 #ifndef __ABG_INTERNED_STR_H__
 #define __ABG_INTERNED_STR_H__
 
+#include <functional>
 #include <ostream>
 #include <string>
 #include "abg-cxx-compat.h"
@@ -211,7 +212,7 @@ struct hash_interned_string
   size_t
   operator()(const interned_string& s) const
   {
-    abg_compat::hash<size_t> hash_size_t;
+    std::hash<size_t> hash_size_t;
     return hash_size_t(reinterpret_cast<size_t>(s.raw()));
   }
 }; // end struct hash_interned_string
diff --git a/include/abg-ir.h b/include/abg-ir.h
index 11af6b00647d..561d20960ed4 100644
--- a/include/abg-ir.h
+++ b/include/abg-ir.h
@@ -18,6 +18,7 @@
 #include <assert.h>
 #include <stdint.h>
 #include <cstdlib>
+#include <functional>
 #include <set>
 #include "abg-cxx-compat.h"
 #include "abg-fwd.h"
@@ -362,7 +363,7 @@ struct type_or_decl_hash
   operator()(const type_or_decl_base *artifact) const
   {
     string repr =  get_pretty_representation(artifact);
-    abg_compat::hash<string> do_hash;
+    std::hash<string> do_hash;
     return do_hash(repr);
   }
 
diff --git a/src/abg-hash.cc b/src/abg-hash.cc
index 7addb0161fe6..7b54c177379a 100644
--- a/src/abg-hash.cc
+++ b/src/abg-hash.cc
@@ -5,6 +5,7 @@
 
 /// @file
 
+#include <functional>
 #include "abg-cxx-compat.h"
 #include "abg-internal.h"
 // <headers defining libabigail's API go under here>
@@ -94,8 +95,8 @@ using namespace abigail::ir;
 size_t
 type_base::hash::operator()(const type_base& t) const
 {
-  abg_compat::hash<size_t> size_t_hash;
-  abg_compat::hash<string> str_hash;
+  std::hash<size_t> size_t_hash;
+  std::hash<string> str_hash;
 
   size_t v = str_hash(typeid(t).name());
   v = hashing::combine_hashes(v, size_t_hash(t.get_size_in_bits()));
@@ -127,7 +128,7 @@ struct decl_base::hash
   size_t
   operator()(const decl_base& d) const
   {
-    abg_compat::hash<string> str_hash;
+    std::hash<string> str_hash;
 
     size_t v = str_hash(typeid(d).name());
     if (!d.get_linkage_name().empty())
@@ -150,7 +151,7 @@ struct type_decl::hash
   {
     decl_base::hash decl_hash;
     type_base::hash type_hash;
-    abg_compat::hash<string> str_hash;
+    std::hash<string> str_hash;
 
     size_t v = str_hash(typeid(t).name());
     v = hashing::combine_hashes(v, decl_hash(t));
@@ -168,7 +169,7 @@ struct type_decl::hash
 size_t
 scope_decl::hash::operator()(const scope_decl& d) const
 {
-  abg_compat::hash<string> hash_string;
+  std::hash<string> hash_string;
   size_t v = hash_string(typeid(d).name());
   for (scope_decl::declarations::const_iterator i =
 	 d.get_member_decls().begin();
@@ -195,7 +196,7 @@ struct scope_type_decl::hash
   {
     decl_base::hash decl_hash;
     type_base::hash type_hash;
-    abg_compat::hash<string> str_hash;
+    std::hash<string> str_hash;
 
     size_t v = str_hash(typeid(t).name());
     v = hashing::combine_hashes(v, decl_hash(t));
@@ -212,7 +213,7 @@ struct qualified_type_def::hash
   {
     type_base::hash type_hash;
     decl_base::hash decl_hash;
-    abg_compat::hash<string> str_hash;
+    std::hash<string> str_hash;
 
     size_t v = str_hash(typeid(t).name());
     v = hashing::combine_hashes(v, type_hash(t));
@@ -227,7 +228,7 @@ struct pointer_type_def::hash
   size_t
   operator()(const pointer_type_def& t) const
   {
-    abg_compat::hash<string> str_hash;
+    std::hash<string> str_hash;
     type_base::hash type_base_hash;
     decl_base::hash decl_hash;
     type_base::shared_ptr_hash hash_type_ptr;
@@ -245,7 +246,7 @@ struct reference_type_def::hash
   size_t
   operator()(const reference_type_def& t)
   {
-    abg_compat::hash<string> hash_str;
+    std::hash<string> hash_str;
     type_base::hash hash_type_base;
     decl_base::hash hash_decl;
     type_base::shared_ptr_hash hash_type_ptr;
@@ -266,7 +267,7 @@ struct array_type_def::subrange_type::hash
   size_t
   operator()(const array_type_def::subrange_type& s) const
   {
-    abg_compat::hash<int> hash_size_t;
+    std::hash<int> hash_size_t;
     size_t v = hash_size_t(hash_size_t(s.get_lower_bound()));
     v = hashing::combine_hashes(v, hash_size_t(s.get_upper_bound()));
     return v;
@@ -278,7 +279,7 @@ struct array_type_def::hash
   size_t
   operator()(const array_type_def& t)
   {
-    abg_compat::hash<string> hash_str;
+    std::hash<string> hash_str;
     type_base::hash hash_type_base;
     decl_base::hash hash_decl;
     type_base::shared_ptr_hash hash_type_ptr;
@@ -305,10 +306,10 @@ struct enum_type_decl::hash
   size_t
   operator()(const enum_type_decl& t) const
   {
-    abg_compat::hash<string> str_hash;
+    std::hash<string> str_hash;
     decl_base::hash decl_hash;
     type_base::shared_ptr_hash type_ptr_hash;
-    abg_compat::hash<size_t> size_t_hash;
+    std::hash<size_t> size_t_hash;
 
     size_t v = str_hash(typeid(t).name());
     v = hashing::combine_hashes(v, decl_hash(t));
@@ -330,7 +331,7 @@ struct typedef_decl::hash
   size_t
   operator()(const typedef_decl& t) const
   {
-    abg_compat::hash<string> str_hash;
+    std::hash<string> str_hash;
     type_base::hash hash_type;
     decl_base::hash decl_hash;
     type_base::shared_ptr_hash type_ptr_hash;
@@ -356,10 +357,10 @@ struct typedef_decl::hash
 size_t
 var_decl::hash::operator()(const var_decl& t) const
 {
-  abg_compat::hash<string> hash_string;
+  std::hash<string> hash_string;
   decl_base::hash hash_decl;
   type_base::shared_ptr_hash hash_type_ptr;
-  abg_compat::hash<size_t> hash_size_t;
+  std::hash<size_t> hash_size_t;
 
   size_t v = hash_string(typeid(t).name());
   v = hashing::combine_hashes(v, hash_decl(t));
@@ -395,10 +396,10 @@ var_decl::hash::operator()(const var_decl* t) const
 size_t
 function_decl::hash::operator()(const function_decl& t) const
 {
-  abg_compat::hash<int> hash_int;
-  abg_compat::hash<size_t> hash_size_t;
-  abg_compat::hash<bool> hash_bool;
-  abg_compat::hash<string> hash_string;
+  std::hash<int> hash_int;
+  std::hash<size_t> hash_size_t;
+  std::hash<bool> hash_bool;
+  std::hash<string> hash_string;
   decl_base::hash hash_decl_base;
   type_base::shared_ptr_hash hash_type_ptr;
 
@@ -440,8 +441,8 @@ function_decl::parameter::hash::operator()
   (const function_decl::parameter& p) const
 {
   type_base::shared_ptr_hash hash_type_ptr;
-  abg_compat::hash<bool> hash_bool;
-  abg_compat::hash<unsigned> hash_unsigned;
+  std::hash<bool> hash_bool;
+  std::hash<unsigned> hash_unsigned;
   size_t v = hash_type_ptr(p.get_type());
   v = hashing::combine_hashes(v, hash_unsigned(p.get_index()));
   v = hashing::combine_hashes(v, hash_bool(p.get_variadic_marker()));
@@ -464,7 +465,7 @@ struct method_type::hash
   size_t
   operator()(const method_type& t) const
   {
-    abg_compat::hash<string> hash_string;
+    std::hash<string> hash_string;
     type_base::shared_ptr_hash hash_type_ptr;
     function_decl::parameter::hash hash_parameter;
 
@@ -500,7 +501,7 @@ struct method_type::hash
 size_t
 function_type::hash::operator()(const function_type& t) const
 {
-  abg_compat::hash<string> hash_string;
+  std::hash<string> hash_string;
   type_base::shared_ptr_hash hash_type_ptr;
   function_decl::parameter::hash hash_parameter;
 
@@ -544,7 +545,7 @@ function_type::hash::operator()(const function_type_sptr t) const
 size_t
 member_base::hash::operator()(const member_base& m) const
 {
-  abg_compat::hash<int> hash_int;
+  std::hash<int> hash_int;
   return hash_int(m.get_access_specifier());
 }
 
@@ -553,9 +554,9 @@ class_decl::base_spec::hash::operator()(const base_spec& t) const
 {
   member_base::hash hash_member;
   type_base::shared_ptr_hash hash_type_ptr;
-  abg_compat::hash<size_t> hash_size;
-  abg_compat::hash<bool> hash_bool;
-  abg_compat::hash<string> hash_string;
+  std::hash<size_t> hash_size;
+  std::hash<bool> hash_bool;
+  std::hash<string> hash_string;
 
   size_t v = hash_string(typeid(t).name());
   v = hashing::combine_hashes(v, hash_member(t));
@@ -569,10 +570,10 @@ size_t
 member_function_template::hash::operator()
   (const member_function_template& t) const
 {
-  abg_compat::hash<bool> hash_bool;
+  std::hash<bool> hash_bool;
   function_tdecl::hash hash_function_tdecl;
   member_base::hash hash_member;
-  abg_compat::hash<string> hash_string;
+  std::hash<string> hash_string;
 
   size_t v = hash_member(t);
   string n = t.get_qualified_name();
@@ -589,7 +590,7 @@ member_class_template::hash::operator()
 {
   member_base::hash hash_member;
   class_tdecl::hash hash_class_tdecl;
-  abg_compat::hash<string> hash_string;
+  std::hash<string> hash_string;
 
   size_t v = hash_member(t);
   string n = t.get_qualified_name();
@@ -627,7 +628,7 @@ class_or_union::hash::operator()(const class_or_union& t) const
 
   ABG_ASSERT(!t.get_is_declaration_only());
 
-  abg_compat::hash<string> hash_string;
+  std::hash<string> hash_string;
   scope_type_decl::hash hash_scope_type;
   var_decl::hash hash_data_member;
   member_function_template::hash hash_member_fn_tmpl;
@@ -706,7 +707,7 @@ class_decl::hash::operator()(const class_decl& t) const
 
   ABG_ASSERT(!t.get_is_declaration_only());
 
-  abg_compat::hash<string> hash_string;
+  std::hash<string> hash_string;
   class_decl::base_spec::hash hash_base;
   class_or_union::hash hash_class_or_union;
 
@@ -755,8 +756,8 @@ struct template_parameter::hash
 
     t.set_hashing_has_started(true);
 
-    abg_compat::hash<unsigned> hash_unsigned;
-    abg_compat::hash<std::string> hash_string;
+    std::hash<unsigned> hash_unsigned;
+    std::hash<std::string> hash_string;
     template_decl::hash hash_template_decl;
 
     size_t v = hash_string(typeid(t).name());
@@ -786,7 +787,7 @@ struct template_parameter::shared_ptr_hash
 size_t
 template_decl::hash::operator()(const template_decl& t) const
 {
-  abg_compat::hash<string> hash_string;
+  std::hash<string> hash_string;
   template_parameter::shared_ptr_hash hash_template_parameter;
 
   size_t v = hash_string(typeid(t).name());
@@ -807,7 +808,7 @@ struct type_tparameter::hash
   size_t
   operator()(const type_tparameter& t) const
   {
-    abg_compat::hash<string> hash_string;
+    std::hash<string> hash_string;
     template_parameter::hash hash_template_parameter;
     type_decl::hash hash_type;
 
@@ -828,7 +829,7 @@ size_t
 non_type_tparameter::hash::operator()(const non_type_tparameter& t) const
 {
   template_parameter::hash hash_template_parameter;
-  abg_compat::hash<string> hash_string;
+  std::hash<string> hash_string;
   type_base::shared_ptr_hash hash_type;
 
   size_t v = hash_string(typeid(t).name());
@@ -853,7 +854,7 @@ struct template_tparameter::hash
   size_t
   operator()(const template_tparameter& t) const
   {
-    abg_compat::hash<string> hash_string;
+    std::hash<string> hash_string;
     type_tparameter::hash hash_template_type_parm;
     template_decl::hash hash_template_decl;
 
@@ -891,7 +892,7 @@ operator()(const template_parameter* t) const
 size_t
 type_composition::hash::operator()(const type_composition& t) const
 {
-  abg_compat::hash<string> hash_string;
+  std::hash<string> hash_string;
   type_base::dynamic_hash hash_type;
 
   size_t v = hash_string(typeid(t).name());
@@ -912,7 +913,7 @@ size_t
 function_tdecl::hash::
 operator()(const function_tdecl& t) const
 {
-  abg_compat::hash<string> hash_string;
+  std::hash<string> hash_string;
   decl_base::hash hash_decl_base;
   template_decl::hash hash_template_decl;
   function_decl::hash hash_function_decl;
@@ -941,7 +942,7 @@ size_t
 class_tdecl::hash::
 operator()(const class_tdecl& t) const
 {
-  abg_compat::hash<string> hash_string;
+  std::hash<string> hash_string;
   decl_base::hash hash_decl_base;
   template_decl::hash hash_template_decl;
   class_decl::hash hash_class_decl;
diff --git a/src/abg-ir.cc b/src/abg-ir.cc
index 7b060a005bd4..aa91dd3eb3b6 100644
--- a/src/abg-ir.cc
+++ b/src/abg-ir.cc
@@ -10,12 +10,13 @@
 /// Definitions for the Internal Representation artifacts of libabigail.
 
 #include <cxxabi.h>
-#include <vector>
-#include <utility>
 #include <algorithm>
+#include <functional>
 #include <iterator>
-#include <typeinfo>
 #include <sstream>
+#include <typeinfo>
+#include <utility>
+#include <vector>
 
 #include "abg-cxx-compat.h"
 #include "abg-internal.h"
@@ -23276,7 +23277,7 @@ hash_type_or_decl(const type_or_decl_base *tod)
 	  ABG_ASSERT(v->get_type());
 	  size_t h = hash_type_or_decl(v->get_type());
 	  string repr = v->get_pretty_representation();
-	  abg_compat::hash<string> hash_string;
+	  std::hash<string> hash_string;
 	  h = hashing::combine_hashes(h, hash_string(repr));
 	  result = h;
 	}
@@ -23285,7 +23286,7 @@ hash_type_or_decl(const type_or_decl_base *tod)
 	  ABG_ASSERT(f->get_type());
 	  size_t h = hash_type_or_decl(f->get_type());
 	  string repr = f->get_pretty_representation();
-	  abg_compat::hash<string> hash_string;
+	  std::hash<string> hash_string;
 	  h = hashing::combine_hashes(h, hash_string(repr));
 	  result = h;
 	}
@@ -23293,8 +23294,8 @@ hash_type_or_decl(const type_or_decl_base *tod)
 	{
 	  type_base_sptr parm_type = p->get_type();
 	  ABG_ASSERT(parm_type);
-	  abg_compat::hash<bool> hash_bool;
-	  abg_compat::hash<unsigned> hash_unsigned;
+	  std::hash<bool> hash_bool;
+	  std::hash<unsigned> hash_unsigned;
 	  size_t h = hash_type_or_decl(parm_type);
 	  h = hashing::combine_hashes(h, hash_unsigned(p->get_index()));
 	  h = hashing::combine_hashes(h, hash_bool(p->get_variadic_marker()));
@@ -23303,8 +23304,8 @@ hash_type_or_decl(const type_or_decl_base *tod)
       else if (class_decl::base_spec *bs = is_class_base_spec(d))
 	{
 	  member_base::hash hash_member;
-	  abg_compat::hash<size_t> hash_size;
-	  abg_compat::hash<bool> hash_bool;
+	  std::hash<size_t> hash_size;
+	  std::hash<bool> hash_bool;
 	  type_base_sptr type = bs->get_base_class();
 	  size_t h = hash_type_or_decl(type);
 	  h = hashing::combine_hashes(h, hash_member(*bs));
-- 
2.29.2.684.gfbc64c5ab5-goog


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

* [PATCH 3/6] Remove <memory> usages from abg_compat
  2020-12-14 23:08 [PATCH 0/6] Drop C++03 compatibility layer from abg-cxx-compat.h Matthias Maennich
  2020-12-14 23:08 ` [PATCH 1/6] Drop C++03 compatibility layer Matthias Maennich
  2020-12-14 23:08 ` [PATCH 2/6] Remove <functional> usages from abg_compat Matthias Maennich
@ 2020-12-14 23:08 ` Matthias Maennich
  2020-12-14 23:08 ` [PATCH 4/6] Remove <unordered_map> " Matthias Maennich
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Matthias Maennich @ 2020-12-14 23:08 UTC (permalink / raw)
  To: libabigail; +Cc: dodji, gprocida, kernel-team, maennich

std::shared_ptr, std::weak_ptr, std::dynamic_pointer_cast,
std::static_pointer_cast are now provided through the language standard,
hence remove the compatibility code for <memory> and adjust all users
accordingly.

	* include/abg-cxx-compat.h: Drop compatibility layer for <memory>.
	* include/abg-diff-utils.h: migrate abg_compat use to std.
	* include/abg-fwd.h: Likewise.
	* include/abg-ini.h: Likewise.
	* include/abg-interned-str.h: Likewise.
	* include/abg-libxml-utils.h: Likewise.
	* include/abg-libzip-utils.h: Likewise.
	* include/abg-regex.h: Likewise.
	* include/abg-reporter.h: Likewise.
	* include/abg-sptr-utils.h: Likewise.
	* include/abg-tools-utils.h: Likewise.
	* include/abg-workers.h: Likewise.
	* src/abg-comp-filter.cc: Likewise.
	* src/abg-comparison-priv.h: Likewise.
	* src/abg-dwarf-reader.cc: Likewise.
	* src/abg-ir.cc: Likewise.
	* src/abg-reader.cc: Likewise.
	* src/abg-suppression.cc: Likewise.
	* src/abg-tools-utils.cc: Likewise.
	* src/abg-writer.cc: Likewise.
	* tests/test-diff-filter.cc: Likewise.
	* tests/test-diff-pkg.cc: Likewise.
	* tests/test-diff-suppr.cc: Likewise.
	* tests/test-read-dwarf.cc: Likewise.
	* tests/test-read-write.cc: Likewise.
	* tests/test-types-stability.cc: Likewise.
	* tests/test-write-read-archive.cc: Likewise.
	* tools/abicompat.cc: Likewise.
	* tools/abidiff.cc: Likewise.
	* tools/abidw.cc: Likewise.
	* tools/abilint.cc: Likewise.
	* tools/abipkgdiff.cc: Likewise.

Signed-off-by: Matthias Maennich <maennich@google.com>
---
 include/abg-cxx-compat.h         |  7 -------
 include/abg-diff-utils.h         |  7 ++++---
 include/abg-fwd.h                | 11 ++++++-----
 include/abg-ini.h                |  9 +++++----
 include/abg-interned-str.h       |  3 ++-
 include/abg-libxml-utils.h       |  3 ++-
 include/abg-libzip-utils.h       |  3 ++-
 include/abg-regex.h              |  3 ++-
 include/abg-reporter.h           |  3 ++-
 include/abg-sptr-utils.h         |  3 ++-
 include/abg-tools-utils.h        | 13 +++++++------
 include/abg-workers.h            |  3 ++-
 src/abg-comp-filter.cc           |  3 ++-
 src/abg-comparison-priv.h        |  5 +++--
 src/abg-dwarf-reader.cc          | 11 ++++++-----
 src/abg-ir.cc                    |  5 +++--
 src/abg-reader.cc                | 15 ++++++++-------
 src/abg-suppression.cc           |  3 ++-
 src/abg-tools-utils.cc           | 14 +++++++-------
 src/abg-writer.cc                | 13 +++++++------
 tests/test-diff-filter.cc        |  7 ++++---
 tests/test-diff-pkg.cc           |  7 ++++---
 tests/test-diff-suppr.cc         | 11 ++++++-----
 tests/test-read-dwarf.cc         |  7 ++++---
 tests/test-read-write.cc         |  9 +++++----
 tests/test-types-stability.cc    |  7 ++++---
 tests/test-write-read-archive.cc |  5 +++--
 tools/abicompat.cc               |  9 +++++----
 tools/abidiff.cc                 |  7 ++++---
 tools/abidw.cc                   |  9 +++++----
 tools/abilint.cc                 |  9 +++++----
 tools/abipkgdiff.cc              | 15 ++++++++-------
 32 files changed, 131 insertions(+), 108 deletions(-)

diff --git a/include/abg-cxx-compat.h b/include/abg-cxx-compat.h
index f3c343dfd481..2d3b2b036a37 100644
--- a/include/abg-cxx-compat.h
+++ b/include/abg-cxx-compat.h
@@ -8,18 +8,11 @@
 #ifndef __ABG_CXX_COMPAT_H
 #define __ABG_CXX_COMPAT_H
 
-#include <memory>
 #include <unordered_map>
 #include <unordered_set>
 
 namespace abg_compat {
 
-// <memory>
-using std::shared_ptr;
-using std::weak_ptr;
-using std::dynamic_pointer_cast;
-using std::static_pointer_cast;
-
 // <unordered_map>
 using std::unordered_map;
 
diff --git a/include/abg-diff-utils.h b/include/abg-diff-utils.h
index 06e953c41913..89eee495282d 100644
--- a/include/abg-diff-utils.h
+++ b/include/abg-diff-utils.h
@@ -21,13 +21,14 @@
 #ifndef __ABG_DIFF_UTILS_H__
 #define __ABG_DIFF_UTILS_H__
 
-#include <stdexcept>
 #include <cassert>
 #include <cstdlib>
+#include <memory>
 #include <ostream>
+#include <sstream>
+#include <stdexcept>
 #include <string>
 #include <vector>
-#include <sstream>
 #include "abg-cxx-compat.h"
 #include "abg-fwd.h"
 
@@ -42,7 +43,7 @@ namespace abigail
 namespace diff_utils
 {
 
-using abg_compat::shared_ptr;
+using std::shared_ptr;
 
 // Inject the names from std:: below into this namespace
 using std::string;
diff --git a/include/abg-fwd.h b/include/abg-fwd.h
index a8d99acbcee6..0eba77175636 100644
--- a/include/abg-fwd.h
+++ b/include/abg-fwd.h
@@ -9,14 +9,15 @@
 #define __ABG_IRFWD_H__
 
 #include <stdint.h>
-#include <cstdlib>
 #include <cstddef>
+#include <cstdlib>
 #include <list>
-#include <vector>
+#include <memory>
+#include <ostream>
 #include <string>
 #include <typeinfo>
 #include <utility> // for std::rel_ops, at least.
-#include <ostream>
+#include <vector>
 #include "abg-cxx-compat.h"
 #include "abg-interned-str.h"
 #include "abg-hash.h"
@@ -48,8 +49,8 @@ namespace abigail
 */
 
 // Inject some types.
-using abg_compat::shared_ptr;
-using abg_compat::weak_ptr;
+using std::shared_ptr;
+using std::weak_ptr;
 using abg_compat::unordered_map;
 using std::string;
 using std::vector;
diff --git a/include/abg-ini.h b/include/abg-ini.h
index f96c85860370..665cdcd3d664 100644
--- a/include/abg-ini.h
+++ b/include/abg-ini.h
@@ -13,10 +13,11 @@
 #ifndef __ABG_INI_H__
 #define __ABG_INI_H__
 
-#include <string>
-#include <vector>
 #include <istream>
+#include <memory>
 #include <ostream>
+#include <string>
+#include <vector>
 #include "abg-cxx-compat.h"
 
 namespace abigail
@@ -25,8 +26,8 @@ namespace abigail
 namespace ini
 {
 // Inject some standard types in this namespace.
-using abg_compat::shared_ptr;
-using abg_compat::dynamic_pointer_cast;
+using std::shared_ptr;
+using std::dynamic_pointer_cast;
 using std::string;
 using std::vector;
 using std:: pair;
diff --git a/include/abg-interned-str.h b/include/abg-interned-str.h
index dc1adf1fb290..ed6499090c43 100644
--- a/include/abg-interned-str.h
+++ b/include/abg-interned-str.h
@@ -17,6 +17,7 @@
 #define __ABG_INTERNED_STR_H__
 
 #include <functional>
+#include <memory>
 #include <ostream>
 #include <string>
 #include "abg-cxx-compat.h"
@@ -26,7 +27,7 @@ namespace abigail
 {
 // Inject some std types into this namespace.
 using abg_compat::unordered_set;
-using abg_compat::shared_ptr;
+using std::shared_ptr;
 using std::string;
 using std::ostream;
 
diff --git a/include/abg-libxml-utils.h b/include/abg-libxml-utils.h
index a8afff9f1705..081bd8f2e908 100644
--- a/include/abg-libxml-utils.h
+++ b/include/abg-libxml-utils.h
@@ -11,6 +11,7 @@
 #include <libxml/xmlreader.h>
 
 #include <istream>
+#include <memory>
 
 #include "abg-sptr-utils.h"
 #include "abg-cxx-compat.h"
@@ -23,7 +24,7 @@ namespace xml
 {
 
 using sptr_utils::build_sptr;
-using abg_compat::shared_ptr;
+using std::shared_ptr;
 
 /// A convenience typedef for a shared pointer of xmlTextReader.
 typedef shared_ptr<xmlTextReader> reader_sptr;
diff --git a/include/abg-libzip-utils.h b/include/abg-libzip-utils.h
index 998b36b8c54c..82378fa18f25 100644
--- a/include/abg-libzip-utils.h
+++ b/include/abg-libzip-utils.h
@@ -9,6 +9,7 @@
 #define __ABG_LIBZIP_UTILS_H__
 
 #include <zip.h>
+#include <memory>
 #include "abg-cxx-compat.h"
 
 namespace abigail
@@ -17,7 +18,7 @@ namespace abigail
 namespace zip_utils
 {
 
-using abg_compat::shared_ptr;
+using std::shared_ptr;
 using std::string;
 
 /// @brief Functor passed to shared_ptr constructor during
diff --git a/include/abg-regex.h b/include/abg-regex.h
index c0b8e330707a..477ebbb94a3d 100644
--- a/include/abg-regex.h
+++ b/include/abg-regex.h
@@ -12,6 +12,7 @@
 
 #include <regex.h>
 
+#include <memory>
 #include <string>
 #include <vector>
 
@@ -26,7 +27,7 @@ namespace regex
 {
 
 /// A convenience typedef for a shared pointer of regex_t.
-typedef abg_compat::shared_ptr<regex_t> regex_t_sptr;
+typedef std::shared_ptr<regex_t> regex_t_sptr;
 
 /// A delete functor for a shared_ptr of regex_t.
 struct regex_t_deleter
diff --git a/include/abg-reporter.h b/include/abg-reporter.h
index 006020cff4e7..22d4d4258322 100644
--- a/include/abg-reporter.h
+++ b/include/abg-reporter.h
@@ -13,6 +13,7 @@
 #ifndef __ABG_REPORTER_H__
 #define __ABG_REPORTER_H__
 
+#include <memory>
 #include <ostream>
 #include <string>
 #include "abg-cxx-compat.h"
@@ -20,7 +21,7 @@
 namespace abigail
 {
 
-using abg_compat::shared_ptr;
+using std::shared_ptr;
 
 namespace comparison
 {
diff --git a/include/abg-sptr-utils.h b/include/abg-sptr-utils.h
index 3f328522a153..65def7d2f4f7 100644
--- a/include/abg-sptr-utils.h
+++ b/include/abg-sptr-utils.h
@@ -11,6 +11,7 @@
 #define __ABG_SPTR_UTILS_H__
 
 #include <regex.h>
+#include <memory>
 
 #include "abg-cxx-compat.h"
 
@@ -21,7 +22,7 @@ namespace abigail
 namespace sptr_utils
 {
 
-using abg_compat::shared_ptr;
+using std::shared_ptr;
 
 /// This is to be specialized for the diverse C types that needs
 /// wrapping in shared_ptr.
diff --git a/include/abg-tools-utils.h b/include/abg-tools-utils.h
index 1bab78e6d8af..14781a456301 100644
--- a/include/abg-tools-utils.h
+++ b/include/abg-tools-utils.h
@@ -8,11 +8,12 @@
 #ifndef __ABG_TOOLS_UTILS_H
 #define __ABG_TOOLS_UTILS_H
 
-#include <string>
-#include <set>
-#include <ostream>
-#include <istream>
 #include <iostream>
+#include <istream>
+#include <memory>
+#include <ostream>
+#include <set>
+#include <string>
 #include "abg-cxx-compat.h"
 #include "abg-suppression.h"
 
@@ -27,7 +28,7 @@ using std::istream;
 using std::ifstream;
 using std::string;
 using std::set;
-using abg_compat::shared_ptr;
+using std::shared_ptr;
 
 const char* get_system_libdir();
 const char* get_anonymous_struct_internal_name_prefix();
@@ -303,7 +304,7 @@ bool
 file_is_kernel_debuginfo_package(const string& file_path,
 				 file_type file_type);
 
-abg_compat::shared_ptr<char>
+std::shared_ptr<char>
 make_path_absolute(const char*p);
 
 char*
diff --git a/include/abg-workers.h b/include/abg-workers.h
index f923a751ec6d..4cbff8308e42 100644
--- a/include/abg-workers.h
+++ b/include/abg-workers.h
@@ -16,10 +16,11 @@
 #ifndef __ABG_WORKERS_H__
 #define __ABG_WORKERS_H__
 
+#include <memory>
 #include <vector>
 #include "abg-cxx-compat.h"
 
-using abg_compat::shared_ptr;
+using std::shared_ptr;
 
 namespace abigail
 {
diff --git a/src/abg-comp-filter.cc b/src/abg-comp-filter.cc
index 7d44419f7e89..a3320091c309 100644
--- a/src/abg-comp-filter.cc
+++ b/src/abg-comp-filter.cc
@@ -12,6 +12,7 @@
 
 #include "abg-cxx-compat.h"
 #include "abg-internal.h"
+#include <memory>
 // <headers defining libabigail's API go under here>
 ABG_BEGIN_EXPORT_DECLARATIONS
 
@@ -28,7 +29,7 @@ namespace comparison
 namespace filtering
 {
 
-using abg_compat::dynamic_pointer_cast;
+using std::dynamic_pointer_cast;
 
 /// Walk the diff sub-trees of a a @ref corpus_diff and apply a filter
 /// to the nodes visted.  The filter categorizes each node, assigning
diff --git a/src/abg-comparison-priv.h b/src/abg-comparison-priv.h
index ef98d0a1f53e..1f04f3cbb61a 100644
--- a/src/abg-comparison-priv.h
+++ b/src/abg-comparison-priv.h
@@ -19,6 +19,7 @@
 #include "abg-cxx-compat.h"
 #include "abg-internal.h"
 // <headers defining libabigail's API go under here>
+#include <memory>
 ABG_BEGIN_EXPORT_DECLARATIONS
 
 #include "abg-hash.h"
@@ -42,8 +43,8 @@ using namespace abigail::suppr;
 
 // Inject types from outside in here.
 using std::vector;
-using abg_compat::dynamic_pointer_cast;
-using abg_compat::static_pointer_cast;
+using std::dynamic_pointer_cast;
+using std::static_pointer_cast;
 using abigail::sptr_utils::noop_deleter;
 
 /// Convenience typedef for a pair of decls or types.
diff --git a/src/abg-dwarf-reader.cc b/src/abg-dwarf-reader.cc
index 5cd839e577d3..e8f43bc6ab57 100644
--- a/src/abg-dwarf-reader.cc
+++ b/src/abg-dwarf-reader.cc
@@ -19,16 +19,17 @@
 #include <libgen.h>
 #include <assert.h>
 #include <limits.h>
-#include <cstring>
-#include <cmath>
 #include <elfutils/libdwfl.h>
 #include <dwarf.h>
 #include <algorithm>
-#include <stack>
+#include <cmath>
+#include <cstring>
 #include <deque>
 #include <list>
+#include <memory>
 #include <ostream>
 #include <sstream>
+#include <stack>
 
 #include "abg-cxx-compat.h"
 #include "abg-ir-priv.h"
@@ -62,8 +63,8 @@ using std::cerr;
 namespace dwarf_reader
 {
 
-using abg_compat::dynamic_pointer_cast;
-using abg_compat::static_pointer_cast;
+using std::dynamic_pointer_cast;
+using std::static_pointer_cast;
 using abg_compat::unordered_map;
 using abg_compat::unordered_set;
 using std::stack;
diff --git a/src/abg-ir.cc b/src/abg-ir.cc
index aa91dd3eb3b6..4fbbc6a3a211 100644
--- a/src/abg-ir.cc
+++ b/src/abg-ir.cc
@@ -13,6 +13,7 @@
 #include <algorithm>
 #include <functional>
 #include <iterator>
+#include <memory>
 #include <sstream>
 #include <typeinfo>
 #include <utility>
@@ -117,8 +118,8 @@ using std::string;
 using std::list;
 using std::vector;
 using abg_compat::unordered_map;
-using abg_compat::dynamic_pointer_cast;
-using abg_compat::static_pointer_cast;
+using std::dynamic_pointer_cast;
+using std::static_pointer_cast;
 
 /// Convenience typedef for a map of string -> string*.
 typedef unordered_map<string, string*> pool_map_type;
diff --git a/src/abg-reader.cc b/src/abg-reader.cc
index 32808bc1bca0..c89e3ccd29d6 100644
--- a/src/abg-reader.cc
+++ b/src/abg-reader.cc
@@ -11,14 +11,15 @@
 /// native XML format is named "abixml".
 
 #include "config.h"
-#include <cstring>
-#include <cstdlib>
+#include <assert.h>
+#include <libxml/xmlreader.h>
+#include <libxml/xmlstring.h>
 #include <cerrno>
+#include <cstdlib>
+#include <cstring>
 #include <deque>
-#include <assert.h>
+#include <memory>
 #include <sstream>
-#include <libxml/xmlstring.h>
-#include <libxml/xmlreader.h>
 
 #include "abg-cxx-compat.h"
 #include "abg-suppression-priv.h"
@@ -50,9 +51,9 @@ namespace xml_reader
 {
 using std::string;
 using std::deque;
-using abg_compat::shared_ptr;
+using std::shared_ptr;
 using abg_compat::unordered_map;
-using abg_compat::dynamic_pointer_cast;
+using std::dynamic_pointer_cast;
 using std::vector;
 using std::istream;
 #ifdef WITH_ZIP_ARCHIVE
diff --git a/src/abg-suppression.cc b/src/abg-suppression.cc
index 2cfa25fce312..4b955da7647b 100644
--- a/src/abg-suppression.cc
+++ b/src/abg-suppression.cc
@@ -14,6 +14,7 @@
 
 #include "abg-cxx-compat.h"
 #include "abg-internal.h"
+#include <memory>
 
 // <headers defining libabigail's API go under here>
 ABG_BEGIN_EXPORT_DECLARATIONS
@@ -34,7 +35,7 @@ namespace abigail
 namespace suppr
 {
 
-using abg_compat::dynamic_pointer_cast;
+using std::dynamic_pointer_cast;
 using regex::regex_t_sptr;
 
 // <parsing stuff>
diff --git a/src/abg-tools-utils.cc b/src/abg-tools-utils.cc
index 5bb3c7ca0f17..7df3da5ffbfc 100644
--- a/src/abg-tools-utils.cc
+++ b/src/abg-tools-utils.cc
@@ -30,19 +30,19 @@
 #include <sys/time.h>
 #include <dirent.h>
 #include <time.h>
-#include <algorithm>
-#include <cstdlib>
-#include <cstring>
-#include <iterator>
 #include <ctype.h>
 #include <errno.h>
 #include <libgen.h>
 
+#include <algorithm>
+#include <cstdlib>
+#include <cstring>
 #include <fstream>
 #include <iostream>
+#include <iterator>
+#include <memory>
 #include <sstream>
 
-
 #include "abg-dwarf-reader.h"
 #include "abg-internal.h"
 #include "abg-cxx-compat.h"
@@ -1709,10 +1709,10 @@ struct malloced_char_star_deleter
 /// @param p the path to turn into an absolute path.
 ///
 /// @return a shared pointer to the resulting absolute path.
-abg_compat::shared_ptr<char>
+std::shared_ptr<char>
 make_path_absolute(const char*p)
 {
-  using abg_compat::shared_ptr;
+  using std::shared_ptr;
 
   shared_ptr<char> result;
 
diff --git a/src/abg-writer.cc b/src/abg-writer.cc
index aed145cea4c4..494847b8635b 100644
--- a/src/abg-writer.cc
+++ b/src/abg-writer.cc
@@ -12,13 +12,14 @@
 
 #include "config.h"
 #include <assert.h>
+#include <algorithm>
+#include <fstream>
 #include <iomanip>
 #include <iostream>
-#include <fstream>
+#include <memory>
 #include <sstream>
-#include <vector>
 #include <stack>
-#include <algorithm>
+#include <vector>
 
 #include "abg-cxx-compat.h"
 #include "abg-tools-utils.h"
@@ -46,9 +47,9 @@ ABG_END_EXPORT_DECLARATIONS
 namespace abigail
 {
 using std::cerr;
-using abg_compat::shared_ptr;
-using abg_compat::dynamic_pointer_cast;
-using abg_compat::static_pointer_cast;
+using std::shared_ptr;
+using std::dynamic_pointer_cast;
+using std::static_pointer_cast;
 using std::ofstream;
 using std::ostream;
 using std::ostringstream;
diff --git a/tests/test-diff-filter.cc b/tests/test-diff-filter.cc
index 6148cab24cfc..f378fa23e157 100644
--- a/tests/test-diff-filter.cc
+++ b/tests/test-diff-filter.cc
@@ -18,10 +18,11 @@
 
 #include <sys/wait.h>
 #include <cassert>
-#include <string>
+#include <cstdlib>
 #include <fstream>
 #include <iostream>
-#include <cstdlib>
+#include <memory>
+#include <string>
 #include "abg-workers.h"
 #include "abg-tools-utils.h"
 #include "test-utils.h"
@@ -869,7 +870,7 @@ int
 main()
 {
   using std::vector;
-  using abg_compat::dynamic_pointer_cast;
+  using std::dynamic_pointer_cast;
   using abigail::workers::queue;
   using abigail::workers::task;
   using abigail::workers::task_sptr;
diff --git a/tests/test-diff-pkg.cc b/tests/test-diff-pkg.cc
index 97c1dc9d90c5..0df7005b825a 100644
--- a/tests/test-diff-pkg.cc
+++ b/tests/test-diff-pkg.cc
@@ -20,10 +20,11 @@
 #include "config.h"
 #include <sys/wait.h>
 #include <cassert>
-#include <cstring>
-#include <string>
 #include <cstdlib>
+#include <cstring>
 #include <iostream>
+#include <memory>
+#include <string>
 #include <vector>
 #include "abg-workers.h"
 #include "test-utils.h"
@@ -813,7 +814,7 @@ int
 main()
 {
   using std::vector;
-  using abg_compat::dynamic_pointer_cast;
+  using std::dynamic_pointer_cast;
   using abigail::workers::queue;
   using abigail::workers::task;
   using abigail::workers::task_sptr;
diff --git a/tests/test-diff-suppr.cc b/tests/test-diff-suppr.cc
index 32800d46ae22..f6548d066391 100644
--- a/tests/test-diff-suppr.cc
+++ b/tests/test-diff-suppr.cc
@@ -16,11 +16,12 @@
 /// one.
 
 #include <sys/wait.h>
+#include <cstdlib>
 #include <cstring>
-#include <string>
 #include <fstream>
 #include <iostream>
-#include <cstdlib>
+#include <memory>
+#include <string>
 #include "abg-cxx-compat.h"
 #include "abg-tools-utils.h"
 #include "abg-workers.h"
@@ -2169,7 +2170,7 @@ main(int argc, char *argv[])
 
   for (InOutSpec* s = in_out_specs; s->in_elfv0_path; ++s)
     {
-      abg_compat::shared_ptr<test_task> t(
+      std::shared_ptr<test_task> t(
 	  new test_task(*s, in_base_path, out_base_path));
       ABG_ASSERT(task_queue.schedule_task(t));
     }
@@ -2189,8 +2190,8 @@ main(int argc, char *argv[])
        ti != completed_tasks.end();
        ++ti)
     {
-      abg_compat::shared_ptr<test_task> t =
-	  abg_compat::dynamic_pointer_cast<test_task>(*ti);
+      std::shared_ptr<test_task> t =
+	  std::dynamic_pointer_cast<test_task>(*ti);
       if (!t->is_ok)
 	{
 	  is_ok = false;
diff --git a/tests/test-read-dwarf.cc b/tests/test-read-dwarf.cc
index df5368d23e38..1212e11c0663 100644
--- a/tests/test-read-dwarf.cc
+++ b/tests/test-read-dwarf.cc
@@ -9,11 +9,12 @@
 /// files and diff the corpus files against reference XML corpus
 /// files.
 
-#include <string>
+#include <cstdlib>
 #include <fstream>
 #include <iostream>
+#include <memory>
+#include <string>
 #include <vector>
-#include <cstdlib>
 #include "abg-ir.h"
 #include "abg-dwarf-reader.h"
 #include "abg-workers.h"
@@ -25,7 +26,7 @@ using std::vector;
 using std::string;
 using std::ofstream;
 using std::cerr;
-using abg_compat::dynamic_pointer_cast;
+using std::dynamic_pointer_cast;
 using abigail::tests::get_build_dir;
 using abigail::dwarf_reader::read_corpus_from_elf;
 using abigail::dwarf_reader::read_context;
diff --git a/tests/test-read-write.cc b/tests/test-read-write.cc
index 188441284fac..1cddc0ea9220 100644
--- a/tests/test-read-write.cc
+++ b/tests/test-read-write.cc
@@ -7,11 +7,12 @@
 /// save it back and diff the resulting XML file against the input
 /// file.  They should be identical.
 
-#include <string>
-#include <fstream>
-#include <iostream>
 #include <cstdlib>
 #include <cstring>
+#include <fstream>
+#include <iostream>
+#include <memory>
+#include <string>
 #include <vector>
 #include "abg-cxx-compat.h"
 #include "abg-ir.h"
@@ -26,7 +27,7 @@ using std::vector;
 using std::ofstream;
 using std::cerr;
 
-using abg_compat::dynamic_pointer_cast;
+using std::dynamic_pointer_cast;
 
 using abigail::tools_utils::file_type;
 using abigail::tools_utils::check_file;
diff --git a/tests/test-types-stability.cc b/tests/test-types-stability.cc
index 7dd42312fb0d..22a85e646de9 100644
--- a/tests/test-types-stability.cc
+++ b/tests/test-types-stability.cc
@@ -21,10 +21,11 @@
 ///
 /// The comparison is expected to yield the empty set.
 
-#include <string>
+#include <cstdlib>
 #include <fstream>
 #include <iostream>
-#include <cstdlib>
+#include <memory>
+#include <string>
 #include "abg-tools-utils.h"
 #include "test-utils.h"
 #include "abg-dwarf-reader.h"
@@ -103,7 +104,7 @@ int
 main()
 {
   using std::vector;
-  using abg_compat::dynamic_pointer_cast;
+  using std::dynamic_pointer_cast;
   using abigail::workers::queue;
   using abigail::workers::task;
   using abigail::workers::task_sptr;
diff --git a/tests/test-write-read-archive.cc b/tests/test-write-read-archive.cc
index 0a4492f10b19..dd16586f006e 100644
--- a/tests/test-write-read-archive.cc
+++ b/tests/test-write-read-archive.cc
@@ -4,8 +4,9 @@
 // Copyright (C) 2013-2020 Red Hat, Inc.
 
 #include <cstdlib>
-#include <iostream>
 #include <fstream>
+#include <iostream>
+#include <memory>
 #include "test-utils.h"
 #include "abg-ir.h"
 #include "abg-corpus.h"
@@ -63,7 +64,7 @@ const InOutSpec archive_spec =
 using std::string;
 using std::cerr;
 using std::ofstream;
-using abg_compat::shared_ptr;
+using std::shared_ptr;
 using abigail::corpus;
 using abigail::corpus_sptr;
 using abigail::translation_unit;
diff --git a/tools/abicompat.cc b/tools/abicompat.cc
index 87fd2a0b9b72..2007a391932f 100644
--- a/tools/abicompat.cc
+++ b/tools/abicompat.cc
@@ -27,12 +27,13 @@
 
 #include <unistd.h>
 #include <cassert>
-#include <cstring>
 #include <cstdio>
 #include <cstdlib>
-#include <string>
-#include <iostream>
+#include <cstring>
 #include <fstream>
+#include <iostream>
+#include <memory>
+#include <string>
 #include "abg-cxx-compat.h"
 #include "abg-config.h"
 #include "abg-tools-utils.h"
@@ -47,7 +48,7 @@ using std::cout;
 using std::ostream;
 using std::ofstream;
 using std::vector;
-using abg_compat::shared_ptr;
+using std::shared_ptr;
 
 using abigail::tools_utils::emit_prefix;
 
diff --git a/tools/abidiff.cc b/tools/abidiff.cc
index ca0b39b28446..666f8d574cde 100644
--- a/tools/abidiff.cc
+++ b/tools/abidiff.cc
@@ -8,9 +8,10 @@
 /// @file
 
 #include <cstring>
-#include <vector>
-#include <string>
 #include <iostream>
+#include <memory>
+#include <string>
+#include <vector>
 #include "abg-config.h"
 #include "abg-comp-filter.h"
 #include "abg-suppression.h"
@@ -23,7 +24,7 @@ using std::string;
 using std::ostream;
 using std::cout;
 using std::cerr;
-using abg_compat::shared_ptr;
+using std::shared_ptr;
 using abigail::ir::environment;
 using abigail::ir::environment_sptr;
 using abigail::translation_unit;
diff --git a/tools/abidw.cc b/tools/abidw.cc
index b1515e7b3f47..9e8251f63cc5 100644
--- a/tools/abidw.cc
+++ b/tools/abidw.cc
@@ -13,12 +13,13 @@
 
 #include <unistd.h>
 #include <cassert>
-#include <cstring>
 #include <cstdio>
 #include <cstdlib>
-#include <string>
-#include <iostream>
+#include <cstring>
 #include <fstream>
+#include <iostream>
+#include <memory>
+#include <string>
 #include <vector>
 #include "abg-cxx-compat.h"
 #include "abg-config.h"
@@ -35,7 +36,7 @@ using std::cout;
 using std::ostream;
 using std::ofstream;
 using std::vector;
-using abg_compat::shared_ptr;
+using std::shared_ptr;
 using abigail::tools_utils::emit_prefix;
 using abigail::tools_utils::temp_file;
 using abigail::tools_utils::temp_file_sptr;
diff --git a/tools/abilint.cc b/tools/abilint.cc
index 54cbefd11a95..63d0d6b8a1f9 100644
--- a/tools/abilint.cc
+++ b/tools/abilint.cc
@@ -13,12 +13,13 @@
 /// runs a diff on the two files and expects the result of the diff to
 /// be empty.
 
-#include <cstring>
 #include <cstdio>
 #include <cstdlib>
-#include <string>
-#include <iostream>
+#include <cstring>
 #include <fstream>
+#include <iostream>
+#include <memory>
+#include <string>
 #include <vector>
 #include "abg-cxx-compat.h"
 #include "abg-config.h"
@@ -68,7 +69,7 @@ struct options
   bool				read_tu;
   bool				diff;
   bool				noout;
-  abg_compat::shared_ptr<char>	di_root_path;
+  std::shared_ptr<char>	di_root_path;
   vector<string>		suppression_paths;
   string			headers_dir;
   vector<string>		header_files;
diff --git a/tools/abipkgdiff.cc b/tools/abipkgdiff.cc
index 05af746d9e7f..6c2c6a53bad3 100644
--- a/tools/abipkgdiff.cc
+++ b/tools/abipkgdiff.cc
@@ -71,14 +71,15 @@
   #include <fts.h>
 #endif
 
-#include <iostream>
+#include <algorithm>
+#include <cstdlib>
+#include <cstring>
 #include <fstream>
+#include <iostream>
+#include <map>
+#include <memory>
 #include <string>
-#include <cstring>
-#include <cstdlib>
 #include <vector>
-#include <algorithm>
-#include <map>
 
 #include "abg-cxx-compat.h"
 #include "abg-workers.h"
@@ -100,8 +101,8 @@ using std::map;
 using abg_compat::unordered_set;
 using std::set;
 using std::ostringstream;
-using abg_compat::shared_ptr;
-using abg_compat::dynamic_pointer_cast;
+using std::shared_ptr;
+using std::dynamic_pointer_cast;
 using abigail::workers::task;
 using abigail::workers::task_sptr;
 using abigail::workers::queue;
-- 
2.29.2.684.gfbc64c5ab5-goog


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

* [PATCH 4/6] Remove <unordered_map> usages from abg_compat
  2020-12-14 23:08 [PATCH 0/6] Drop C++03 compatibility layer from abg-cxx-compat.h Matthias Maennich
                   ` (2 preceding siblings ...)
  2020-12-14 23:08 ` [PATCH 3/6] Remove <memory> " Matthias Maennich
@ 2020-12-14 23:08 ` Matthias Maennich
  2020-12-14 23:08 ` [PATCH 5/6] Remove <unordered_set> " Matthias Maennich
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Matthias Maennich @ 2020-12-14 23:08 UTC (permalink / raw)
  To: libabigail; +Cc: dodji, gprocida, kernel-team, maennich

std::unordered_map is now provided through the language standard, hence
remove the compatibility code for <unordered_map> and adjust all users
accordingly.

	* include/abg-cxx-compat.h: Drop compatibility layer for <unordered_map>.
	* include/abg-comparison.h: migrate abg_compat use to std.
	* include/abg-cxx-compat.h: Likewise.
	* include/abg-fwd.h: Likewise.
	* include/abg-ir.h: Likewise.
	* src/abg-corpus.cc: Likewise.
	* src/abg-dwarf-reader.cc: Likewise.
	* src/abg-ir.cc: Likewise.
	* src/abg-reader.cc: Likewise.
	* src/abg-writer.cc: Likewise.

Signed-off-by: Matthias Maennich <maennich@google.com>
---
 include/abg-comparison.h | 3 ++-
 include/abg-cxx-compat.h | 4 ----
 include/abg-fwd.h        | 3 ++-
 include/abg-ir.h         | 9 +++++----
 src/abg-corpus.cc        | 3 ++-
 src/abg-dwarf-reader.cc  | 3 ++-
 src/abg-ir.cc            | 3 ++-
 src/abg-reader.cc        | 5 +++--
 src/abg-writer.cc        | 3 ++-
 9 files changed, 20 insertions(+), 16 deletions(-)

diff --git a/include/abg-comparison.h b/include/abg-comparison.h
index f3d33e9a28af..c9e8df7624d2 100644
--- a/include/abg-comparison.h
+++ b/include/abg-comparison.h
@@ -11,6 +11,7 @@
 /// @file
 
 #include <ostream>
+#include <unordered_map>
 #include "abg-cxx-compat.h"
 #include "abg-corpus.h"
 #include "abg-diff-utils.h"
@@ -36,7 +37,7 @@ typedef std::vector<filter_base_sptr> filters;
 // Inject types we need into this namespace.
 using std::ostream;
 using std::vector;
-using abg_compat::unordered_map;
+using std::unordered_map;
 using abg_compat::unordered_set;
 using std::pair;
 
diff --git a/include/abg-cxx-compat.h b/include/abg-cxx-compat.h
index 2d3b2b036a37..fd693933d65f 100644
--- a/include/abg-cxx-compat.h
+++ b/include/abg-cxx-compat.h
@@ -8,14 +8,10 @@
 #ifndef __ABG_CXX_COMPAT_H
 #define __ABG_CXX_COMPAT_H
 
-#include <unordered_map>
 #include <unordered_set>
 
 namespace abg_compat {
 
-// <unordered_map>
-using std::unordered_map;
-
 // <unordered_set>
 using std::unordered_set;
 
diff --git a/include/abg-fwd.h b/include/abg-fwd.h
index 0eba77175636..4d594afaccf6 100644
--- a/include/abg-fwd.h
+++ b/include/abg-fwd.h
@@ -16,6 +16,7 @@
 #include <ostream>
 #include <string>
 #include <typeinfo>
+#include <unordered_map>
 #include <utility> // for std::rel_ops, at least.
 #include <vector>
 #include "abg-cxx-compat.h"
@@ -51,7 +52,7 @@ namespace abigail
 // Inject some types.
 using std::shared_ptr;
 using std::weak_ptr;
-using abg_compat::unordered_map;
+using std::unordered_map;
 using std::string;
 using std::vector;
 
diff --git a/include/abg-ir.h b/include/abg-ir.h
index 561d20960ed4..06e03b5f14c9 100644
--- a/include/abg-ir.h
+++ b/include/abg-ir.h
@@ -20,6 +20,7 @@
 #include <cstdlib>
 #include <functional>
 #include <set>
+#include <unordered_map>
 #include "abg-cxx-compat.h"
 #include "abg-fwd.h"
 #include "abg-hash.h"
@@ -92,7 +93,7 @@ namespace ir
 {
 
 // Inject some std types in here.
-using abg_compat::unordered_map;
+using std::unordered_map;
 
 /// A convenience typedef fo r an ordered set of size_t.
 typedef unordered_set<size_t> pointer_set;
@@ -138,7 +139,7 @@ public:
   /// the pretty representation string of a particular type and the
   /// value is the vector of canonical types that have the same pretty
   /// representation string.
-  typedef abg_compat::unordered_map<string, std::vector<type_base_sptr> >
+  typedef std::unordered_map<string, std::vector<type_base_sptr> >
       canonical_types_map_type;
 
 private:
@@ -758,7 +759,7 @@ typedef weak_ptr<elf_symbol> elf_symbol_wptr;
 
 /// Convenience typedef for a map which key is a string and which
 /// value if the elf symbol of the same name.
-typedef abg_compat::unordered_map<string, elf_symbol_sptr>
+typedef std::unordered_map<string, elf_symbol_sptr>
 string_elf_symbol_sptr_map_type;
 
 /// Convenience typedef for a shared pointer to an
@@ -771,7 +772,7 @@ typedef std::vector<elf_symbol_sptr> elf_symbols;
 
 /// Convenience typedef for a map which key is a string and which
 /// value is a vector of elf_symbol.
-typedef abg_compat::unordered_map<string, elf_symbols>
+typedef std::unordered_map<string, elf_symbols>
 string_elf_symbols_map_type;
 
 /// Convenience typedef for a shared pointer to
diff --git a/src/abg-corpus.cc b/src/abg-corpus.cc
index 6924944cb618..e2319d186259 100644
--- a/src/abg-corpus.cc
+++ b/src/abg-corpus.cc
@@ -12,6 +12,7 @@
 #include <cstdio>
 #include <cstring>
 #include <stdexcept>
+#include <unordered_map>
 
 #include "abg-cxx-compat.h"
 #include "abg-internal.h"
@@ -43,7 +44,7 @@ namespace ir
 {
 
 using std::ostringstream;
-using abg_compat::unordered_map;
+using std::unordered_map;
 using std::list;
 using std::vector;
 
diff --git a/src/abg-dwarf-reader.cc b/src/abg-dwarf-reader.cc
index e8f43bc6ab57..c3723ae15236 100644
--- a/src/abg-dwarf-reader.cc
+++ b/src/abg-dwarf-reader.cc
@@ -30,6 +30,7 @@
 #include <ostream>
 #include <sstream>
 #include <stack>
+#include <unordered_map>
 
 #include "abg-cxx-compat.h"
 #include "abg-ir-priv.h"
@@ -65,7 +66,7 @@ namespace dwarf_reader
 
 using std::dynamic_pointer_cast;
 using std::static_pointer_cast;
-using abg_compat::unordered_map;
+using std::unordered_map;
 using abg_compat::unordered_set;
 using std::stack;
 using std::deque;
diff --git a/src/abg-ir.cc b/src/abg-ir.cc
index 4fbbc6a3a211..5f931ee79509 100644
--- a/src/abg-ir.cc
+++ b/src/abg-ir.cc
@@ -16,6 +16,7 @@
 #include <memory>
 #include <sstream>
 #include <typeinfo>
+#include <unordered_map>
 #include <utility>
 #include <vector>
 
@@ -117,7 +118,7 @@ namespace abigail
 using std::string;
 using std::list;
 using std::vector;
-using abg_compat::unordered_map;
+using std::unordered_map;
 using std::dynamic_pointer_cast;
 using std::static_pointer_cast;
 
diff --git a/src/abg-reader.cc b/src/abg-reader.cc
index c89e3ccd29d6..fb7326ed1b81 100644
--- a/src/abg-reader.cc
+++ b/src/abg-reader.cc
@@ -20,6 +20,7 @@
 #include <deque>
 #include <memory>
 #include <sstream>
+#include <unordered_map>
 
 #include "abg-cxx-compat.h"
 #include "abg-suppression-priv.h"
@@ -52,7 +53,7 @@ namespace xml_reader
 using std::string;
 using std::deque;
 using std::shared_ptr;
-using abg_compat::unordered_map;
+using std::unordered_map;
 using std::dynamic_pointer_cast;
 using std::vector;
 using std::istream;
@@ -2886,7 +2887,7 @@ build_elf_symbol_db(read_context& ctxt,
 
   ctxt.set_corpus_node(node);
 
-  typedef abg_compat::unordered_map<xmlNodePtr, elf_symbol_sptr>
+  typedef std::unordered_map<xmlNodePtr, elf_symbol_sptr>
     xml_node_ptr_elf_symbol_sptr_map_type;
   xml_node_ptr_elf_symbol_sptr_map_type xml_node_ptr_elf_symbol_map;
 
diff --git a/src/abg-writer.cc b/src/abg-writer.cc
index 494847b8635b..0953c8b3c7ee 100644
--- a/src/abg-writer.cc
+++ b/src/abg-writer.cc
@@ -19,6 +19,7 @@
 #include <memory>
 #include <sstream>
 #include <stack>
+#include <unordered_map>
 #include <vector>
 
 #include "abg-cxx-compat.h"
@@ -56,7 +57,7 @@ using std::ostringstream;
 using std::list;
 using std::vector;
 using std::stack;
-using abg_compat::unordered_map;
+using std::unordered_map;
 using abigail::sptr_utils::noop_deleter;
 
 #if WITH_ZIP_ARCHIVE
-- 
2.29.2.684.gfbc64c5ab5-goog


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

* [PATCH 5/6] Remove <unordered_set> usages from abg_compat
  2020-12-14 23:08 [PATCH 0/6] Drop C++03 compatibility layer from abg-cxx-compat.h Matthias Maennich
                   ` (3 preceding siblings ...)
  2020-12-14 23:08 ` [PATCH 4/6] Remove <unordered_map> " Matthias Maennich
@ 2020-12-14 23:08 ` Matthias Maennich
  2020-12-14 23:08 ` [PATCH 6/6] Drop unneccessary includes of abg-cxx-compat.h Matthias Maennich
  2020-12-15  8:47 ` [PATCH 0/6] Drop C++03 compatibility layer from abg-cxx-compat.h Dodji Seketeli
  6 siblings, 0 replies; 8+ messages in thread
From: Matthias Maennich @ 2020-12-14 23:08 UTC (permalink / raw)
  To: libabigail; +Cc: dodji, gprocida, kernel-team, maennich

std::unordered_set is now provided through the language standard, hence
remove the compatibility code for <unordered_set> and adjust all users
accordingly.

	* include/abg-cxx-compat.h: Drop compatibility for <unordered_set>.
	* include/abg-comparison.h: migrate abg_compat use to std.
	* include/abg-interned-str.h: Likewise.
	* include/abg-suppression.h: Likewise.
	* src/abg-comparison-priv.h: Likewise.
	* src/abg-dwarf-reader.cc: Likewise.
	* tests/test-diff-suppr.cc: Likewise.
	* tools/abipkgdiff.cc: Likewise.

Signed-off-by: Matthias Maennich <maennich@google.com>
---
 include/abg-comparison.h   | 3 ++-
 include/abg-cxx-compat.h   | 5 -----
 include/abg-interned-str.h | 3 ++-
 include/abg-suppression.h  | 4 +++-
 src/abg-comparison-priv.h  | 3 ++-
 src/abg-dwarf-reader.cc    | 3 ++-
 tests/test-diff-suppr.cc   | 3 ++-
 tools/abipkgdiff.cc        | 3 ++-
 8 files changed, 15 insertions(+), 12 deletions(-)

diff --git a/include/abg-comparison.h b/include/abg-comparison.h
index c9e8df7624d2..1da8215ef19e 100644
--- a/include/abg-comparison.h
+++ b/include/abg-comparison.h
@@ -12,6 +12,7 @@
 
 #include <ostream>
 #include <unordered_map>
+#include <unordered_set>
 #include "abg-cxx-compat.h"
 #include "abg-corpus.h"
 #include "abg-diff-utils.h"
@@ -38,7 +39,7 @@ typedef std::vector<filter_base_sptr> filters;
 using std::ostream;
 using std::vector;
 using std::unordered_map;
-using abg_compat::unordered_set;
+using std::unordered_set;
 using std::pair;
 
 using diff_utils::insertion;
diff --git a/include/abg-cxx-compat.h b/include/abg-cxx-compat.h
index fd693933d65f..838fa53707d1 100644
--- a/include/abg-cxx-compat.h
+++ b/include/abg-cxx-compat.h
@@ -8,13 +8,8 @@
 #ifndef __ABG_CXX_COMPAT_H
 #define __ABG_CXX_COMPAT_H
 
-#include <unordered_set>
-
 namespace abg_compat {
 
-// <unordered_set>
-using std::unordered_set;
-
 }
 
 #endif  // __ABG_CXX_COMPAT_H
diff --git a/include/abg-interned-str.h b/include/abg-interned-str.h
index ed6499090c43..bd51350edd33 100644
--- a/include/abg-interned-str.h
+++ b/include/abg-interned-str.h
@@ -20,13 +20,14 @@
 #include <memory>
 #include <ostream>
 #include <string>
+#include <unordered_set>
 #include "abg-cxx-compat.h"
 
 
 namespace abigail
 {
 // Inject some std types into this namespace.
-using abg_compat::unordered_set;
+using std::unordered_set;
 using std::shared_ptr;
 using std::string;
 using std::ostream;
diff --git a/include/abg-suppression.h b/include/abg-suppression.h
index dd575916068c..9c135607b42f 100644
--- a/include/abg-suppression.h
+++ b/include/abg-suppression.h
@@ -8,6 +8,8 @@
 #ifndef __ABG_SUPPRESSION_H__
 #define __ABG_SUPPRESSION_H__
 
+#include <unordered_set>
+
 #include "abg-cxx-compat.h"
 #include "abg-ini.h"
 #include "abg-comparison.h"
@@ -28,7 +30,7 @@ namespace suppr
 {
 
 using namespace abigail::comparison;
-using abg_compat::unordered_set;
+using std::unordered_set;
 
 /// Base type of the suppression specifications types.
 ///
diff --git a/src/abg-comparison-priv.h b/src/abg-comparison-priv.h
index 1f04f3cbb61a..7b3587d8808d 100644
--- a/src/abg-comparison-priv.h
+++ b/src/abg-comparison-priv.h
@@ -20,6 +20,7 @@
 #include "abg-internal.h"
 // <headers defining libabigail's API go under here>
 #include <memory>
+#include <unordered_set>
 ABG_BEGIN_EXPORT_DECLARATIONS
 
 #include "abg-hash.h"
@@ -38,7 +39,7 @@ namespace abigail
 namespace comparison
 {
 
-using abg_compat::unordered_set;
+using std::unordered_set;
 using namespace abigail::suppr;
 
 // Inject types from outside in here.
diff --git a/src/abg-dwarf-reader.cc b/src/abg-dwarf-reader.cc
index c3723ae15236..2e137b211e71 100644
--- a/src/abg-dwarf-reader.cc
+++ b/src/abg-dwarf-reader.cc
@@ -31,6 +31,7 @@
 #include <sstream>
 #include <stack>
 #include <unordered_map>
+#include <unordered_set>
 
 #include "abg-cxx-compat.h"
 #include "abg-ir-priv.h"
@@ -67,7 +68,7 @@ namespace dwarf_reader
 using std::dynamic_pointer_cast;
 using std::static_pointer_cast;
 using std::unordered_map;
-using abg_compat::unordered_set;
+using std::unordered_set;
 using std::stack;
 using std::deque;
 using std::list;
diff --git a/tests/test-diff-suppr.cc b/tests/test-diff-suppr.cc
index f6548d066391..0f7c448c7600 100644
--- a/tests/test-diff-suppr.cc
+++ b/tests/test-diff-suppr.cc
@@ -22,6 +22,7 @@
 #include <iostream>
 #include <memory>
 #include <string>
+#include <unordered_set>
 #include "abg-cxx-compat.h"
 #include "abg-tools-utils.h"
 #include "abg-workers.h"
@@ -2156,7 +2157,7 @@ main(int argc, char *argv[])
   const std::string out_base_path = std::string(get_build_dir()) + "/tests/";
 
   // output paths need to be unique to avoid collisions during parallel testing
-  abg_compat::unordered_set<std::string> out_paths;
+  std::unordered_set<std::string> out_paths;
   bool non_unique_output_paths = false;
   for (InOutSpec* s = in_out_specs; s->in_elfv0_path; ++s) {
 	if (!out_paths.insert(s->out_report_path).second) {
diff --git a/tools/abipkgdiff.cc b/tools/abipkgdiff.cc
index 6c2c6a53bad3..3decc9205729 100644
--- a/tools/abipkgdiff.cc
+++ b/tools/abipkgdiff.cc
@@ -79,6 +79,7 @@
 #include <map>
 #include <memory>
 #include <string>
+#include <unordered_set>
 #include <vector>
 
 #include "abg-cxx-compat.h"
@@ -98,7 +99,7 @@ using std::ostream;
 using std::ofstream;
 using std::vector;
 using std::map;
-using abg_compat::unordered_set;
+using std::unordered_set;
 using std::set;
 using std::ostringstream;
 using std::shared_ptr;
-- 
2.29.2.684.gfbc64c5ab5-goog


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

* [PATCH 6/6] Drop unneccessary includes of abg-cxx-compat.h
  2020-12-14 23:08 [PATCH 0/6] Drop C++03 compatibility layer from abg-cxx-compat.h Matthias Maennich
                   ` (4 preceding siblings ...)
  2020-12-14 23:08 ` [PATCH 5/6] Remove <unordered_set> " Matthias Maennich
@ 2020-12-14 23:08 ` Matthias Maennich
  2020-12-15  8:47 ` [PATCH 0/6] Drop C++03 compatibility layer from abg-cxx-compat.h Dodji Seketeli
  6 siblings, 0 replies; 8+ messages in thread
From: Matthias Maennich @ 2020-12-14 23:08 UTC (permalink / raw)
  To: libabigail; +Cc: dodji, gprocida, kernel-team, maennich

Remove the unneccessary includes of abg-cxx-compat.h as users have been
migrated to use the corresponding standard includes.

	* include/abg-comparison.h: Remove include of abg-cxx-compat.h.
	* include/abg-diff-utils.h: Likewise.
	* include/abg-fwd.h: Likewise.
	* include/abg-ini.h: Likewise.
	* include/abg-interned-str.h: Likewise.
	* include/abg-ir.h: Likewise.
	* include/abg-libxml-utils.h: Likewise.
	* include/abg-libzip-utils.h: Likewise.
	* include/abg-regex.h: Likewise.
	* include/abg-reporter.h: Likewise.
	* include/abg-sptr-utils.h: Likewise.
	* include/abg-suppression.h: Likewise.
	* include/abg-tools-utils.h: Likewise.
	* include/abg-workers.h: Likewise.
	* src/abg-comp-filter.cc: Likewise.
	* src/abg-comparison-priv.h: Likewise.
	* src/abg-corpus.cc: Likewise.
	* src/abg-dwarf-reader.cc: Likewise.
	* src/abg-hash.cc: Likewise.
	* src/abg-ir.cc: Likewise.
	* src/abg-reader.cc: Likewise.
	* src/abg-suppression.cc: Likewise.
	* src/abg-tools-utils.cc: Likewise.
	* src/abg-writer.cc: Likewise.
	* tests/test-diff-suppr.cc: Likewise.
	* tests/test-read-write.cc: Likewise.
	* tools/abicompat.cc: Likewise.
	* tools/abidw.cc: Likewise.
	* tools/abilint.cc: Likewise.
	* tools/abipkgdiff.cc: Likewise.

Signed-off-by: Matthias Maennich <maennich@google.com>
---
 include/abg-comparison.h   | 1 -
 include/abg-diff-utils.h   | 1 -
 include/abg-fwd.h          | 1 -
 include/abg-ini.h          | 1 -
 include/abg-interned-str.h | 1 -
 include/abg-ir.h           | 1 -
 include/abg-libxml-utils.h | 1 -
 include/abg-libzip-utils.h | 1 -
 include/abg-regex.h        | 1 -
 include/abg-reporter.h     | 1 -
 include/abg-sptr-utils.h   | 1 -
 include/abg-suppression.h  | 1 -
 include/abg-tools-utils.h  | 1 -
 include/abg-workers.h      | 1 -
 src/abg-comp-filter.cc     | 1 -
 src/abg-comparison-priv.h  | 1 -
 src/abg-corpus.cc          | 1 -
 src/abg-dwarf-reader.cc    | 1 -
 src/abg-hash.cc            | 1 -
 src/abg-ir.cc              | 1 -
 src/abg-reader.cc          | 1 -
 src/abg-suppression.cc     | 1 -
 src/abg-tools-utils.cc     | 1 -
 src/abg-writer.cc          | 1 -
 tests/test-diff-suppr.cc   | 1 -
 tests/test-read-write.cc   | 1 -
 tools/abicompat.cc         | 1 -
 tools/abidw.cc             | 1 -
 tools/abilint.cc           | 1 -
 tools/abipkgdiff.cc        | 1 -
 30 files changed, 30 deletions(-)

diff --git a/include/abg-comparison.h b/include/abg-comparison.h
index 1da8215ef19e..eab2850b1e32 100644
--- a/include/abg-comparison.h
+++ b/include/abg-comparison.h
@@ -13,7 +13,6 @@
 #include <ostream>
 #include <unordered_map>
 #include <unordered_set>
-#include "abg-cxx-compat.h"
 #include "abg-corpus.h"
 #include "abg-diff-utils.h"
 #include "abg-reporter.h"
diff --git a/include/abg-diff-utils.h b/include/abg-diff-utils.h
index 89eee495282d..0628950e2473 100644
--- a/include/abg-diff-utils.h
+++ b/include/abg-diff-utils.h
@@ -29,7 +29,6 @@
 #include <stdexcept>
 #include <string>
 #include <vector>
-#include "abg-cxx-compat.h"
 #include "abg-fwd.h"
 
 namespace abigail
diff --git a/include/abg-fwd.h b/include/abg-fwd.h
index 4d594afaccf6..bb839fe76315 100644
--- a/include/abg-fwd.h
+++ b/include/abg-fwd.h
@@ -19,7 +19,6 @@
 #include <unordered_map>
 #include <utility> // for std::rel_ops, at least.
 #include <vector>
-#include "abg-cxx-compat.h"
 #include "abg-interned-str.h"
 #include "abg-hash.h"
 
diff --git a/include/abg-ini.h b/include/abg-ini.h
index 665cdcd3d664..4ccb63bc4550 100644
--- a/include/abg-ini.h
+++ b/include/abg-ini.h
@@ -18,7 +18,6 @@
 #include <ostream>
 #include <string>
 #include <vector>
-#include "abg-cxx-compat.h"
 
 namespace abigail
 {
diff --git a/include/abg-interned-str.h b/include/abg-interned-str.h
index bd51350edd33..e25ea566d656 100644
--- a/include/abg-interned-str.h
+++ b/include/abg-interned-str.h
@@ -21,7 +21,6 @@
 #include <ostream>
 #include <string>
 #include <unordered_set>
-#include "abg-cxx-compat.h"
 
 
 namespace abigail
diff --git a/include/abg-ir.h b/include/abg-ir.h
index 06e03b5f14c9..ada947d7849b 100644
--- a/include/abg-ir.h
+++ b/include/abg-ir.h
@@ -21,7 +21,6 @@
 #include <functional>
 #include <set>
 #include <unordered_map>
-#include "abg-cxx-compat.h"
 #include "abg-fwd.h"
 #include "abg-hash.h"
 #include "abg-traverse.h"
diff --git a/include/abg-libxml-utils.h b/include/abg-libxml-utils.h
index 081bd8f2e908..69e940f6dffb 100644
--- a/include/abg-libxml-utils.h
+++ b/include/abg-libxml-utils.h
@@ -14,7 +14,6 @@
 #include <memory>
 
 #include "abg-sptr-utils.h"
-#include "abg-cxx-compat.h"
 
 namespace abigail
 {
diff --git a/include/abg-libzip-utils.h b/include/abg-libzip-utils.h
index 82378fa18f25..dc431d185a33 100644
--- a/include/abg-libzip-utils.h
+++ b/include/abg-libzip-utils.h
@@ -10,7 +10,6 @@
 
 #include <zip.h>
 #include <memory>
-#include "abg-cxx-compat.h"
 
 namespace abigail
 {
diff --git a/include/abg-regex.h b/include/abg-regex.h
index 477ebbb94a3d..9d8310fb9a8d 100644
--- a/include/abg-regex.h
+++ b/include/abg-regex.h
@@ -16,7 +16,6 @@
 #include <string>
 #include <vector>
 
-#include "abg-cxx-compat.h"
 #include "abg-sptr-utils.h"
 
 namespace abigail
diff --git a/include/abg-reporter.h b/include/abg-reporter.h
index 22d4d4258322..2374f6b37fed 100644
--- a/include/abg-reporter.h
+++ b/include/abg-reporter.h
@@ -16,7 +16,6 @@
 #include <memory>
 #include <ostream>
 #include <string>
-#include "abg-cxx-compat.h"
 
 namespace abigail
 {
diff --git a/include/abg-sptr-utils.h b/include/abg-sptr-utils.h
index 65def7d2f4f7..ef39703acdfe 100644
--- a/include/abg-sptr-utils.h
+++ b/include/abg-sptr-utils.h
@@ -13,7 +13,6 @@
 #include <regex.h>
 #include <memory>
 
-#include "abg-cxx-compat.h"
 
 namespace abigail
 {
diff --git a/include/abg-suppression.h b/include/abg-suppression.h
index 9c135607b42f..de2c60193887 100644
--- a/include/abg-suppression.h
+++ b/include/abg-suppression.h
@@ -10,7 +10,6 @@
 
 #include <unordered_set>
 
-#include "abg-cxx-compat.h"
 #include "abg-ini.h"
 #include "abg-comparison.h"
 
diff --git a/include/abg-tools-utils.h b/include/abg-tools-utils.h
index 14781a456301..053f8795e04b 100644
--- a/include/abg-tools-utils.h
+++ b/include/abg-tools-utils.h
@@ -14,7 +14,6 @@
 #include <ostream>
 #include <set>
 #include <string>
-#include "abg-cxx-compat.h"
 #include "abg-suppression.h"
 
 namespace abigail
diff --git a/include/abg-workers.h b/include/abg-workers.h
index 4cbff8308e42..5b5524471e1c 100644
--- a/include/abg-workers.h
+++ b/include/abg-workers.h
@@ -18,7 +18,6 @@
 
 #include <memory>
 #include <vector>
-#include "abg-cxx-compat.h"
 
 using std::shared_ptr;
 
diff --git a/src/abg-comp-filter.cc b/src/abg-comp-filter.cc
index a3320091c309..a0280d8eddf1 100644
--- a/src/abg-comp-filter.cc
+++ b/src/abg-comp-filter.cc
@@ -10,7 +10,6 @@
 /// This file contains definitions of diff objects filtering
 /// facilities.
 
-#include "abg-cxx-compat.h"
 #include "abg-internal.h"
 #include <memory>
 // <headers defining libabigail's API go under here>
diff --git a/src/abg-comparison-priv.h b/src/abg-comparison-priv.h
index 7b3587d8808d..8e2e59c6bcb6 100644
--- a/src/abg-comparison-priv.h
+++ b/src/abg-comparison-priv.h
@@ -16,7 +16,6 @@
 #ifndef __ABG_COMPARISON_PRIV_H__
 #define __ABG_COMPARISON_PRIV_H__
 
-#include "abg-cxx-compat.h"
 #include "abg-internal.h"
 // <headers defining libabigail's API go under here>
 #include <memory>
diff --git a/src/abg-corpus.cc b/src/abg-corpus.cc
index e2319d186259..2c37e253cf88 100644
--- a/src/abg-corpus.cc
+++ b/src/abg-corpus.cc
@@ -14,7 +14,6 @@
 #include <stdexcept>
 #include <unordered_map>
 
-#include "abg-cxx-compat.h"
 #include "abg-internal.h"
 
 // <headers defining libabigail's API go under here>
diff --git a/src/abg-dwarf-reader.cc b/src/abg-dwarf-reader.cc
index 2e137b211e71..2eee213f358a 100644
--- a/src/abg-dwarf-reader.cc
+++ b/src/abg-dwarf-reader.cc
@@ -33,7 +33,6 @@
 #include <unordered_map>
 #include <unordered_set>
 
-#include "abg-cxx-compat.h"
 #include "abg-ir-priv.h"
 #include "abg-suppression-priv.h"
 #include "abg-corpus-priv.h"
diff --git a/src/abg-hash.cc b/src/abg-hash.cc
index 7b54c177379a..ffa529e805cd 100644
--- a/src/abg-hash.cc
+++ b/src/abg-hash.cc
@@ -6,7 +6,6 @@
 /// @file
 
 #include <functional>
-#include "abg-cxx-compat.h"
 #include "abg-internal.h"
 // <headers defining libabigail's API go under here>
 ABG_BEGIN_EXPORT_DECLARATIONS
diff --git a/src/abg-ir.cc b/src/abg-ir.cc
index 5f931ee79509..1a4091b9370c 100644
--- a/src/abg-ir.cc
+++ b/src/abg-ir.cc
@@ -20,7 +20,6 @@
 #include <utility>
 #include <vector>
 
-#include "abg-cxx-compat.h"
 #include "abg-internal.h"
 // <headers defining libabigail's API go under here>
 ABG_BEGIN_EXPORT_DECLARATIONS
diff --git a/src/abg-reader.cc b/src/abg-reader.cc
index fb7326ed1b81..1fb0cf7d1074 100644
--- a/src/abg-reader.cc
+++ b/src/abg-reader.cc
@@ -22,7 +22,6 @@
 #include <sstream>
 #include <unordered_map>
 
-#include "abg-cxx-compat.h"
 #include "abg-suppression-priv.h"
 
 #include "abg-internal.h"
diff --git a/src/abg-suppression.cc b/src/abg-suppression.cc
index 4b955da7647b..d3343a814ef4 100644
--- a/src/abg-suppression.cc
+++ b/src/abg-suppression.cc
@@ -12,7 +12,6 @@
 
 #include <algorithm>
 
-#include "abg-cxx-compat.h"
 #include "abg-internal.h"
 #include <memory>
 
diff --git a/src/abg-tools-utils.cc b/src/abg-tools-utils.cc
index 7df3da5ffbfc..4d0191326dab 100644
--- a/src/abg-tools-utils.cc
+++ b/src/abg-tools-utils.cc
@@ -45,7 +45,6 @@
 
 #include "abg-dwarf-reader.h"
 #include "abg-internal.h"
-#include "abg-cxx-compat.h"
 #include "abg-regex.h"
 
 // <headers defining libabigail's API go under here>
diff --git a/src/abg-writer.cc b/src/abg-writer.cc
index 0953c8b3c7ee..d55bbbc166d5 100644
--- a/src/abg-writer.cc
+++ b/src/abg-writer.cc
@@ -22,7 +22,6 @@
 #include <unordered_map>
 #include <vector>
 
-#include "abg-cxx-compat.h"
 #include "abg-tools-utils.h"
 
 #include "abg-internal.h"
diff --git a/tests/test-diff-suppr.cc b/tests/test-diff-suppr.cc
index 0f7c448c7600..c7b73fd6d067 100644
--- a/tests/test-diff-suppr.cc
+++ b/tests/test-diff-suppr.cc
@@ -23,7 +23,6 @@
 #include <memory>
 #include <string>
 #include <unordered_set>
-#include "abg-cxx-compat.h"
 #include "abg-tools-utils.h"
 #include "abg-workers.h"
 #include "test-utils.h"
diff --git a/tests/test-read-write.cc b/tests/test-read-write.cc
index 1cddc0ea9220..ffca005251c0 100644
--- a/tests/test-read-write.cc
+++ b/tests/test-read-write.cc
@@ -14,7 +14,6 @@
 #include <memory>
 #include <string>
 #include <vector>
-#include "abg-cxx-compat.h"
 #include "abg-ir.h"
 #include "abg-reader.h"
 #include "abg-writer.h"
diff --git a/tools/abicompat.cc b/tools/abicompat.cc
index 2007a391932f..f9b019fbd0c6 100644
--- a/tools/abicompat.cc
+++ b/tools/abicompat.cc
@@ -34,7 +34,6 @@
 #include <iostream>
 #include <memory>
 #include <string>
-#include "abg-cxx-compat.h"
 #include "abg-config.h"
 #include "abg-tools-utils.h"
 #include "abg-corpus.h"
diff --git a/tools/abidw.cc b/tools/abidw.cc
index 9e8251f63cc5..bf4de28324d0 100644
--- a/tools/abidw.cc
+++ b/tools/abidw.cc
@@ -21,7 +21,6 @@
 #include <memory>
 #include <string>
 #include <vector>
-#include "abg-cxx-compat.h"
 #include "abg-config.h"
 #include "abg-tools-utils.h"
 #include "abg-corpus.h"
diff --git a/tools/abilint.cc b/tools/abilint.cc
index 63d0d6b8a1f9..aaf500f72818 100644
--- a/tools/abilint.cc
+++ b/tools/abilint.cc
@@ -21,7 +21,6 @@
 #include <memory>
 #include <string>
 #include <vector>
-#include "abg-cxx-compat.h"
 #include "abg-config.h"
 #include "abg-tools-utils.h"
 #include "abg-ir.h"
diff --git a/tools/abipkgdiff.cc b/tools/abipkgdiff.cc
index 3decc9205729..783a8d9a5359 100644
--- a/tools/abipkgdiff.cc
+++ b/tools/abipkgdiff.cc
@@ -82,7 +82,6 @@
 #include <unordered_set>
 #include <vector>
 
-#include "abg-cxx-compat.h"
 #include "abg-workers.h"
 #include "abg-config.h"
 #include "abg-tools-utils.h"
-- 
2.29.2.684.gfbc64c5ab5-goog


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

* Re: [PATCH 0/6] Drop C++03 compatibility layer from abg-cxx-compat.h
  2020-12-14 23:08 [PATCH 0/6] Drop C++03 compatibility layer from abg-cxx-compat.h Matthias Maennich
                   ` (5 preceding siblings ...)
  2020-12-14 23:08 ` [PATCH 6/6] Drop unneccessary includes of abg-cxx-compat.h Matthias Maennich
@ 2020-12-15  8:47 ` Dodji Seketeli
  6 siblings, 0 replies; 8+ messages in thread
From: Dodji Seketeli @ 2020-12-15  8:47 UTC (permalink / raw)
  To: Matthias Maennich; +Cc: libabigail, gprocida, kernel-team

Hello Matthias,

Matthias Maennich <maennich@google.com> a écrit:

> This drops the compatiblity layer and clears out the abg_compat namespace from
> definitions that are now provided via the standard. Subsequently, fix up the
> necessary imports and use std:: names instead.
>
> While abg-cxx-compat.h remains now empty, there are lined up patches that will
> make use it again. Hence leave it empty and the corresponding test untouched as
> well.
>
> Matthias Maennich (6):
>   Drop C++03 compatibility layer
>   Remove <functional> usages from abg_compat
>   Remove <memory> usages from abg_compat
>   Remove <unordered_map> usages from abg_compat
>   Remove <unordered_set> usages from abg_compat
>   Drop unneccessary includes of abg-cxx-compat.h

Applied the patchset to master, thanks!

Cheers!

-- 
		Dodji

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

end of thread, other threads:[~2020-12-15  8:47 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-14 23:08 [PATCH 0/6] Drop C++03 compatibility layer from abg-cxx-compat.h Matthias Maennich
2020-12-14 23:08 ` [PATCH 1/6] Drop C++03 compatibility layer Matthias Maennich
2020-12-14 23:08 ` [PATCH 2/6] Remove <functional> usages from abg_compat Matthias Maennich
2020-12-14 23:08 ` [PATCH 3/6] Remove <memory> " Matthias Maennich
2020-12-14 23:08 ` [PATCH 4/6] Remove <unordered_map> " Matthias Maennich
2020-12-14 23:08 ` [PATCH 5/6] Remove <unordered_set> " Matthias Maennich
2020-12-14 23:08 ` [PATCH 6/6] Drop unneccessary includes of abg-cxx-compat.h Matthias Maennich
2020-12-15  8:47 ` [PATCH 0/6] Drop C++03 compatibility layer from abg-cxx-compat.h Dodji Seketeli

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).