+2017-01-13 Jonathan Wakely <jwakely@redhat.com>
+
+ PR libstdc++/79075
+ * testsuite/lib/libstdc++.exp (check_v3_target_filesystem_ts): Remove
+ redundant option from cxxflags.
+ (check_effective_target_cxx11-abi): Define.
+ * testsuite/21_strings/basic_string/allocator/71964.cc: Use cxx11-abi
+ effective target.
+ * testsuite/21_strings/basic_string/allocator/char/copy.cc: Likewise.
+ * testsuite/21_strings/basic_string/allocator/char/copy_assign.cc:
+ Likewise.
+ * testsuite/21_strings/basic_string/allocator/char/minimal.cc:
+ Likewise.
+ * testsuite/21_strings/basic_string/allocator/char/move.cc: Likewise.
+ * testsuite/21_strings/basic_string/allocator/char/move_assign.cc:
+ Likewise.
+ * testsuite/21_strings/basic_string/allocator/char/noexcept.cc:
+ Likewise.
+ * testsuite/21_strings/basic_string/allocator/char/swap.cc: Likewise.
+ * testsuite/21_strings/basic_string/allocator/wchar_t/copy.cc:
+ Likewise.
+ * testsuite/21_strings/basic_string/allocator/wchar_t/copy_assign.cc:
+ Likewise.
+ * testsuite/21_strings/basic_string/allocator/wchar_t/minimal.cc:
+ Likewise.
+ * testsuite/21_strings/basic_string/allocator/wchar_t/move.cc:
+ Likewise.
+ * testsuite/21_strings/basic_string/allocator/wchar_t/move_assign.cc:
+ Likewise.
+ * testsuite/21_strings/basic_string/allocator/wchar_t/noexcept.cc:
+ Likewise.
+ * testsuite/21_strings/basic_string/allocator/wchar_t/swap.cc:
+ Likewise.
+ * testsuite/23_containers/list/61347.cc: Likewise.
+ * testsuite/27_io/basic_fstream/cons/base.cc: Likewise.
+ * testsuite/27_io/ios_base/failure/cxx11.cc: Likewise.
+
2017-01-13 Ville Voutilainen <ville.voutilainen@gmail.com>
PR libstdc++/78389
// <http://www.gnu.org/licenses/>.
// { dg-do run { target c++11 } }
+// COW strings don't support C++11 allocators:
+// { dg-require-effective-target cxx11-abi }
#include <string>
#include <testsuite_hooks.h>
void
test01()
{
- // COW strings don't support C++11 allocators
-#if _GLIBCXX_USE_CXX11_ABI
std::basic_string<char, std::char_traits<char>, mv_allocator<char>> s;
auto t = std::move(s);
VERIFY( s.get_allocator().moved_from );
VERIFY( t.get_allocator().moved_to );
-#endif
}
int
// <http://www.gnu.org/licenses/>.
// { dg-do run { target c++11 } }
+// COW strings don't support C++11 allocators:
+// { dg-require-effective-target cxx11-abi }
#include <string>
#include <testsuite_hooks.h>
#include <testsuite_allocator.h>
-#if _GLIBCXX_USE_CXX11_ABI
using C = char;
const C c = 'a';
using traits = std::char_traits<C>;
test03();
return 0;
}
-#else
-int main()
-{
- // COW strings don't support C++11 allocators
-}
-#endif
// <http://www.gnu.org/licenses/>.
// { dg-do run { target c++11 } }
+// COW strings don't support C++11 allocators:
+// { dg-require-effective-target cxx11-abi }
#include <string>
#include <testsuite_hooks.h>
#include <testsuite_allocator.h>
-#if _GLIBCXX_USE_CXX11_ABI
using C = char;
const C c = 'a';
using traits = std::char_traits<C>;
test02();
return 0;
}
-#else
-int main()
-{
- // COW strings don't support C++11 allocators
-}
-#endif
// <http://www.gnu.org/licenses/>.
// { dg-do run { target c++11 } }
+// COW strings don't support C++11 allocators:
+// { dg-require-effective-target cxx11-abi }
#include <string>
#include <memory>
#include <testsuite_hooks.h>
#include <testsuite_allocator.h>
-#if _GLIBCXX_USE_CXX11_ABI
using C = char;
const C c = 'a';
using traits = std::char_traits<C>;
v.assign(1, c);
v.assign(100, c);
}
-#else
-void test01() { }
-#endif
int main()
{
// <http://www.gnu.org/licenses/>.
// { dg-do run { target c++11 } }
+// COW strings don't support C++11 allocators:
+// { dg-require-effective-target cxx11-abi }
#include <string>
#include <testsuite_hooks.h>
#include <testsuite_allocator.h>
-#if _GLIBCXX_USE_CXX11_ABI
using C = char;
const C c = 'a';
using traits = std::char_traits<C>;
test02();
return 0;
}
-#else
-int main()
-{
- // COW strings don't support C++11 allocators
-}
-#endif
// <http://www.gnu.org/licenses/>.
// { dg-do run { target c++11 } }
+// COW strings don't support C++11 allocators:
+// { dg-require-effective-target cxx11-abi }
#include <string>
#include <testsuite_hooks.h>
#include <testsuite_allocator.h>
-#if _GLIBCXX_USE_CXX11_ABI
using C = char;
const C c = 'a';
using traits = std::char_traits<C>;
test03();
return 0;
}
-#else
-int main()
-{
- // COW strings don't support C++11 allocators
-}
-#endif
// <http://www.gnu.org/licenses/>.
// { dg-do compile { target c++11 } }
+// COW strings don't support C++11 allocators:
+// { dg-require-effective-target cxx11-abi }
#include <string>
#include <testsuite_allocator.h>
-#if _GLIBCXX_USE_CXX11_ABI
using C = char;
const C c = 'a';
using traits = std::char_traits<C>;
static_assert( noexcept( v1 = std::move(v2) ), "Move assign cannot throw" );
static_assert( noexcept( v1.swap(v2) ), "Swap cannot throw" );
}
-#endif
// <http://www.gnu.org/licenses/>.
// { dg-do run { target c++11 } }
+// COW strings don't support C++11 allocators:
+// { dg-require-effective-target cxx11-abi }
#include <string>
#include <testsuite_hooks.h>
#include <testsuite_allocator.h>
-#if _GLIBCXX_USE_CXX11_ABI
using C = char;
const C c = 'a';
using traits = std::char_traits<C>;
test02();
return 0;
}
-#else
-int main()
-{
- // COW strings don't support C++11 allocators
-}
-#endif
// <http://www.gnu.org/licenses/>.
// { dg-do run { target c++11 } }
+// COW strings don't support C++11 allocators:
+// { dg-require-effective-target cxx11-abi }
#include <string>
#include <testsuite_hooks.h>
#include <testsuite_allocator.h>
-#if _GLIBCXX_USE_CXX11_ABI
using C = wchar_t;
const C c = L'a';
using traits = std::char_traits<C>;
test03();
return 0;
}
-#else
-int main()
-{
- // COW strings don't support C++11 allocators
-}
-#endif
// <http://www.gnu.org/licenses/>.
// { dg-do run { target c++11 } }
+// COW strings don't support C++11 allocators:
+// { dg-require-effective-target cxx11-abi }
#include <string>
#include <testsuite_hooks.h>
#include <testsuite_allocator.h>
-#if _GLIBCXX_USE_CXX11_ABI
using C = wchar_t;
const C c = L'a';
using traits = std::char_traits<C>;
test02();
return 0;
}
-#else
-int main()
-{
- // COW strings don't support C++11 allocators
-}
-#endif
// <http://www.gnu.org/licenses/>.
// { dg-do run { target c++11 } }
+// COW strings don't support C++11 allocators:
+// { dg-require-effective-target cxx11-abi }
#include <string>
#include <memory>
#include <testsuite_hooks.h>
#include <testsuite_allocator.h>
-#if _GLIBCXX_USE_CXX11_ABI
using C = wchar_t;
const C c = L'a';
using traits = std::char_traits<C>;
v.assign(1, c);
v.assign(100, c);
}
-#else
-void test01() { }
-#endif
int main()
{
// <http://www.gnu.org/licenses/>.
// { dg-do run { target c++11 } }
+// COW strings don't support C++11 allocators:
+// { dg-require-effective-target cxx11-abi }
#include <string>
#include <testsuite_hooks.h>
#include <testsuite_allocator.h>
-#if _GLIBCXX_USE_CXX11_ABI
using C = wchar_t;
const C c = L'a';
using traits = std::char_traits<C>;
test02();
return 0;
}
-#else
-int main()
-{
- // COW strings don't support C++11 allocators
-}
-#endif
// <http://www.gnu.org/licenses/>.
// { dg-do run { target c++11 } }
+// COW strings don't support C++11 allocators:
+// { dg-require-effective-target cxx11-abi }
#include <string>
#include <testsuite_hooks.h>
#include <testsuite_allocator.h>
-#if _GLIBCXX_USE_CXX11_ABI
using C = wchar_t;
const C c = L'a';
using traits = std::char_traits<C>;
test03();
return 0;
}
-#else
-int main()
-{
- // COW strings don't support C++11 allocators
-}
-#endif
// <http://www.gnu.org/licenses/>.
// { dg-do compile { target c++11 } }
+// COW strings don't support C++11 allocators:
+// { dg-require-effective-target cxx11-abi }
#include <string>
#include <testsuite_allocator.h>
-#if _GLIBCXX_USE_CXX11_ABI
using C = wchar_t;
const C c = L'a';
using traits = std::char_traits<C>;
static_assert( noexcept( v1 = std::move(v2) ), "Move assign cannot throw" );
static_assert( noexcept( v1.swap(v2) ), "Swap cannot throw" );
}
-#endif
// <http://www.gnu.org/licenses/>.
// { dg-do run { target c++11 } }
+// COW strings don't support C++11 allocators:
+// { dg-require-effective-target cxx11-abi }
#include <string>
#include <testsuite_hooks.h>
#include <testsuite_allocator.h>
-#if _GLIBCXX_USE_CXX11_ABI
using C = wchar_t;
const C c = L'a';
using traits = std::char_traits<C>;
test02();
return 0;
}
-#else
-int main()
-{
- // COW strings don't support C++11 allocators
-}
-#endif
-// { dg-options "-O2 -D_GLIBCXX_USE_CXX11_ABI" }
+// { dg-options "-O2" }
// { dg-do run { target c++11 } }
// { dg-require-normal-mode "" }
+// { dg-require-effective-target cxx11-abi }
// Copyright (C) 2015-2017 Free Software Foundation, Inc.
//
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-// { dg-options "-O0 -D_GLIBCXX_USE_CXX11_ABI=1" }
+// { dg-options "-O0" }
// { dg-do link { target c++11 } }
+// { dg-require-effective-target cxx11-abi }
#include <fstream>
#include <string>
// <http://www.gnu.org/licenses/>.
// { dg-do run { target c++11 } }
+// { dg-require-effective-target cxx11-abi }
#include <ios>
#include <testsuite_hooks.h>
-#if _GLIBCXX_USE_CXX11_ABI
using test_type = std::ios_base::failure;
static_assert( std::is_base_of<std::system_error, test_type>::value, "base" );
test01();
test02();
}
-#else
-int main() { }
-#endif
close $f
set cxxflags_saved $cxxflags
- set cxxflags "$cxxflags $DEFAULT_CXXFLAGS -Werror -std=gnu++11"
+ set cxxflags "$cxxflags $DEFAULT_CXXFLAGS -Werror"
set lines [v3_target_compile $src /dev/null preprocess ""]
set cxxflags $cxxflags_saved
return $et_filesystem_ts
}
+# Return 1 if the "cxx11" ABI is in use using the current flags, 0 otherwise.
+proc check_effective_target_cxx11-abi { } {
+ global cxxflags
+
+ # Set up and preprocess a C++ test program that depends
+ # on the new ABI being enabled.
+ set src cxx11_abi[pid].cc
+
+ set f [open $src "w"]
+ puts $f "#include <bits/c++config.h>"
+ puts $f "#if ! _GLIBCXX_USE_CXX11_ABI"
+ puts $f "# error old ABI in use"
+ puts $f "#endif"
+ close $f
+
+ set lines [v3_target_compile $src /dev/null preprocess ""]
+ file delete $src
+
+ if [string match "" $lines] {
+ # No error message, preprocessing succeeded.
+ verbose "check_v3_cxx11_abi: `1'" 2
+ return 1
+ }
+
+ verbose "check_v3_cxx11_abi: `0'" 2
+ return 0
+}
+
set additional_prunes ""
if { [info exists env(GCC_RUNTEST_PARALLELIZE_DIR)] \