[PATCH] PR libstdc++/91067 add more missing exports for directory iterators

Jonathan Wakely jwakely@redhat.com
Thu Aug 29 12:16:00 GMT 2019


	PR libstdc++/91067
	* acinclude.m4 (libtool_VERSION): Bump to 6:28:0.
	* configure: Regenerate.
	* config/abi/pre/gnu.ver (GLIBCXX_3.4.28): Add new version. Export
	missing symbols.
	* testsuite/27_io/filesystem/iterators/91067.cc: Test move
	constructors.
	* testsuite/util/testsuite_abi.cc: Add new symbol version.

As mentioned yesterday, we need to add some more exports for
std::filesystem directory iterators. As discussed in PR 91067 Clang
inlines the move constructor and optimises it to a tail call to the C2
move constructor of __shared_ptr, which wasn't exported.

Tested x86_64-linux, i686-linux, powerpc64-linux. Committing to trunk
and (later today) gcc-9-branch.


-------------- next part --------------
commit c6c577f0fd4e807f071a2a7d519e109733e3c704
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Tue Aug 27 15:20:10 2019 +0100

    PR libstdc++/91067 add more missing exports for directory iterators
    
            PR libstdc++/91067
            * acinclude.m4 (libtool_VERSION): Bump to 6:28:0.
            * configure: Regenerate.
            * config/abi/pre/gnu.ver (GLIBCXX_3.4.28): Add new version. Export
            missing symbols.
            * testsuite/27_io/filesystem/iterators/91067.cc: Test move
            constructors.
            * testsuite/util/testsuite_abi.cc: Add new symbol version.

diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4
index 24145fdf1ce..9485b1fecee 100644
--- a/libstdc++-v3/acinclude.m4
+++ b/libstdc++-v3/acinclude.m4
@@ -3832,7 +3832,7 @@ changequote([,])dnl
 fi
 
 # For libtool versioning info, format is CURRENT:REVISION:AGE
-libtool_VERSION=6:27:0
+libtool_VERSION=6:28:0
 
 # Everything parsed; figure out what files and settings to use.
 case $enable_symvers in
diff --git a/libstdc++-v3/config/abi/pre/gnu.ver b/libstdc++-v3/config/abi/pre/gnu.ver
index ff4b74cb971..07a00036827 100644
--- a/libstdc++-v3/config/abi/pre/gnu.ver
+++ b/libstdc++-v3/config/abi/pre/gnu.ver
@@ -2268,11 +2268,11 @@ GLIBCXX_3.4.26 {
 
 GLIBCXX_3.4.27 {
 
-    # __shared_ptr<_Dir>::__shared_ptr()
+    # __shared_ptr<_Dir>::__shared_ptr() (base object ctor)
     _ZNSt12__shared_ptrINSt10filesystem4_DirELN9__gnu_cxx12_Lock_policyE[012]EEC2Ev;
     _ZNSt12__shared_ptrINSt10filesystem7__cxx114_DirELN9__gnu_cxx12_Lock_policyE[012]EEC2Ev;
 
-    # __shared_ptr<recursive_directory_iterator::_Dir_stack>::__shared_ptr()
+    # __shared_ptr<recursive_directory_iterator::_Dir_stack>::__shared_ptr() (base object ctor)
     _ZNSt12__shared_ptrINSt10filesystem28recursive_directory_iterator10_Dir_stackELN9__gnu_cxx12_Lock_policyE[012]EEC2Ev;
     _ZNSt12__shared_ptrINSt10filesystem7__cxx1128recursive_directory_iterator10_Dir_stackELN9__gnu_cxx12_Lock_policyE[012]EEC2Ev;
 
@@ -2282,6 +2282,18 @@ GLIBCXX_3.4.27 {
 
 } GLIBCXX_3.4.26;
 
+GLIBCXX_3.4.28 {
+
+    # __shared_ptr<_Dir>::__shared_ptr(__shared_ptr&&) (base object ctor)
+    _ZNSt12__shared_ptrINSt10filesystem4_DirELN9__gnu_cxx12_Lock_policyE[012]EEC2EOS4_;
+    _ZNSt12__shared_ptrINSt10filesystem7__cxx114_DirELN9__gnu_cxx12_Lock_policyE[012]EEC2EOS5_;
+
+    # __shared_ptr<recursive_directory_iterator::_Dir_stack>::__shared_ptr(__shared_ptr&&) (base object ctor)
+    _ZNSt12__shared_ptrINSt10filesystem28recursive_directory_iterator10_Dir_stackELN9__gnu_cxx12_Lock_policyE[012]EEC2EOS5_;
+    _ZNSt12__shared_ptrINSt10filesystem7__cxx1128recursive_directory_iterator10_Dir_stackELN9__gnu_cxx12_Lock_policyE[012]EEC2EOS6_;
+
+} GLIBCXX_3.4.27;
+
 # Symbols in the support library (libsupc++) have their own tag.
 CXXABI_1.3 {
 
diff --git a/libstdc++-v3/testsuite/27_io/filesystem/iterators/91067.cc b/libstdc++-v3/testsuite/27_io/filesystem/iterators/91067.cc
index 54172d9f20b..39fbc7b5d96 100644
--- a/libstdc++-v3/testsuite/27_io/filesystem/iterators/91067.cc
+++ b/libstdc++-v3/testsuite/27_io/filesystem/iterators/91067.cc
@@ -37,9 +37,25 @@ test02()
   d = std::move(d);
 }
 
+void
+test03()
+{
+  std::filesystem::directory_iterator d;
+  auto d2 = std::move(d);
+}
+
+void
+test04()
+{
+  std::filesystem::recursive_directory_iterator d;
+  auto d2 = std::move(d);
+}
+
 int
 main()
 {
   test01();
   test02();
+  test03();
+  test04();
 }
diff --git a/libstdc++-v3/testsuite/util/testsuite_abi.cc b/libstdc++-v3/testsuite/util/testsuite_abi.cc
index 1277972049f..dfce3741521 100644
--- a/libstdc++-v3/testsuite/util/testsuite_abi.cc
+++ b/libstdc++-v3/testsuite/util/testsuite_abi.cc
@@ -208,6 +208,7 @@ check_version(symbol& test, bool added)
       known_versions.push_back("GLIBCXX_3.4.25");
       known_versions.push_back("GLIBCXX_3.4.26");
       known_versions.push_back("GLIBCXX_3.4.27");
+      known_versions.push_back("GLIBCXX_3.4.28");
       known_versions.push_back("CXXABI_1.3");
       known_versions.push_back("CXXABI_LDBL_1.3");
       known_versions.push_back("CXXABI_1.3.1");
@@ -239,7 +240,7 @@ check_version(symbol& test, bool added)
 	test.version_status = symbol::incompatible;
 
       // Check that added symbols are added in the latest pre-release version.
-      bool latestp = (test.version_name == "GLIBCXX_3.4.27"
+      bool latestp = (test.version_name == "GLIBCXX_3.4.28"
 		     || test.version_name == "CXXABI_1.3.12"
 		     || test.version_name == "CXXABI_FLOAT128"
 		     || test.version_name == "CXXABI_TM_1");


More information about the Libstdc++ mailing list