[3/6] Remove <memory> usages from abg_compat

Message ID 20201214230855.1574934-4-maennich@google.com
State Committed
Headers
Series Drop C++03 compatibility layer from abg-cxx-compat.h |

Commit Message

Matthias Männich Dec. 14, 2020, 11:08 p.m. UTC
  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(-)
  

Patch

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;