[libcxx] r287866 - Protect tests for std::uninitialized_{copy, fill} under libcpp-no-exceptions
Roger Ferrer Ibanez via cfe-commits
cfe-commits at lists.llvm.org
Thu Nov 24 03:17:09 PST 2016
Author: rogfer01
Date: Thu Nov 24 05:17:09 2016
New Revision: 287866
URL: http://llvm.org/viewvc/llvm-project?rev=287866&view=rev
Log:
Protect tests for std::uninitialized_{copy,fill} under libcpp-no-exceptions
Skip tests that expect an exception be thrown.
Differential Revision: https://reviews.llvm.org/D26606
Modified:
libcxx/trunk/test/std/utilities/memory/specialized.algorithms/uninitialized.copy/uninitialized_copy.pass.cpp
libcxx/trunk/test/std/utilities/memory/specialized.algorithms/uninitialized.copy/uninitialized_copy_n.pass.cpp
libcxx/trunk/test/std/utilities/memory/specialized.algorithms/uninitialized.fill.n/uninitialized_fill_n.pass.cpp
libcxx/trunk/test/std/utilities/memory/specialized.algorithms/uninitialized.fill/uninitialized_fill.pass.cpp
Modified: libcxx/trunk/test/std/utilities/memory/specialized.algorithms/uninitialized.copy/uninitialized_copy.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/memory/specialized.algorithms/uninitialized.copy/uninitialized_copy.pass.cpp?rev=287866&r1=287865&r2=287866&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/memory/specialized.algorithms/uninitialized.copy/uninitialized_copy.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/memory/specialized.algorithms/uninitialized.copy/uninitialized_copy.pass.cpp Thu Nov 24 05:17:09 2016
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: libcpp-no-exceptions
// <memory>
// template <class InputIterator, class ForwardIterator>
@@ -18,13 +17,21 @@
#include <memory>
#include <cassert>
+#include "test_macros.h"
+
struct B
{
static int count_;
static int population_;
int data_;
explicit B() : data_(1) { ++population_; }
- B(const B& b) {if (++count_ == 3) throw 1; data_ = b.data_; ++population_; }
+ B(const B &b) {
+ ++count_;
+ if (count_ == 3)
+ TEST_THROW(1);
+ data_ = b.data_;
+ ++population_;
+ }
~B() {data_ = 0; --population_; }
};
@@ -49,6 +56,7 @@ int main()
B* bp = (B*)pool;
B b[N];
assert(B::population_ == N);
+#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
std::uninitialized_copy(b, b+N, bp);
@@ -58,6 +66,7 @@ int main()
{
assert(B::population_ == N);
}
+#endif
B::count_ = 0;
std::uninitialized_copy(b, b+2, bp);
for (int i = 0; i < 2; ++i)
Modified: libcxx/trunk/test/std/utilities/memory/specialized.algorithms/uninitialized.copy/uninitialized_copy_n.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/memory/specialized.algorithms/uninitialized.copy/uninitialized_copy_n.pass.cpp?rev=287866&r1=287865&r2=287866&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/memory/specialized.algorithms/uninitialized.copy/uninitialized_copy_n.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/memory/specialized.algorithms/uninitialized.copy/uninitialized_copy_n.pass.cpp Thu Nov 24 05:17:09 2016
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: libcpp-no-exceptions
// <memory>
// template <class InputIterator, class Size, class ForwardIterator>
@@ -18,13 +17,21 @@
#include <memory>
#include <cassert>
+#include "test_macros.h"
+
struct B
{
static int count_;
static int population_;
int data_;
explicit B() : data_(1) { ++population_; }
- B(const B& b) {if (++count_ == 3) throw 1; data_ = b.data_; ++population_; }
+ B(const B &b) {
+ ++count_;
+ if (count_ == 3)
+ TEST_THROW(1);
+ data_ = b.data_;
+ ++population_;
+ }
~B() {data_ = 0; --population_; }
};
@@ -49,6 +56,7 @@ int main()
B* bp = (B*)pool;
B b[N];
assert(B::population_ == N);
+#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
std::uninitialized_copy_n(b, 5, bp);
@@ -58,6 +66,7 @@ int main()
{
assert(B::population_ == N);
}
+#endif
B::count_ = 0;
std::uninitialized_copy_n(b, 2, bp);
for (int i = 0; i < 2; ++i)
Modified: libcxx/trunk/test/std/utilities/memory/specialized.algorithms/uninitialized.fill.n/uninitialized_fill_n.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/memory/specialized.algorithms/uninitialized.fill.n/uninitialized_fill_n.pass.cpp?rev=287866&r1=287865&r2=287866&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/memory/specialized.algorithms/uninitialized.fill.n/uninitialized_fill_n.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/memory/specialized.algorithms/uninitialized.fill.n/uninitialized_fill_n.pass.cpp Thu Nov 24 05:17:09 2016
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: libcpp-no-exceptions
// <memory>
// template <class ForwardIterator, class Size, class T>
@@ -17,13 +16,21 @@
#include <memory>
#include <cassert>
+#include "test_macros.h"
+
struct B
{
static int count_;
static int population_;
int data_;
explicit B() : data_(1) { ++population_; }
- B(const B& b) {if (++count_ == 3) throw 1; data_ = b.data_; ++population_; }
+ B(const B &b) {
+ ++count_;
+ if (count_ == 3)
+ TEST_THROW(1);
+ data_ = b.data_;
+ ++population_;
+ }
~B() {data_ = 0; --population_; }
};
@@ -47,6 +54,7 @@ int main()
char pool[sizeof(B)*N] = {0};
B* bp = (B*)pool;
assert(B::population_ == 0);
+#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
std::uninitialized_fill_n(bp, 5, B());
@@ -56,6 +64,7 @@ int main()
{
assert(B::population_ == 0);
}
+#endif
B::count_ = 0;
B* r = std::uninitialized_fill_n(bp, 2, B());
assert(r == bp + 2);
Modified: libcxx/trunk/test/std/utilities/memory/specialized.algorithms/uninitialized.fill/uninitialized_fill.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/memory/specialized.algorithms/uninitialized.fill/uninitialized_fill.pass.cpp?rev=287866&r1=287865&r2=287866&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/memory/specialized.algorithms/uninitialized.fill/uninitialized_fill.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/memory/specialized.algorithms/uninitialized.fill/uninitialized_fill.pass.cpp Thu Nov 24 05:17:09 2016
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: libcpp-no-exceptions
// <memory>
// template <class ForwardIterator, class T>
@@ -18,13 +17,21 @@
#include <memory>
#include <cassert>
+#include "test_macros.h"
+
struct B
{
static int count_;
static int population_;
int data_;
explicit B() : data_(1) { ++population_; }
- B(const B& b) {if (++count_ == 3) throw 1; data_ = b.data_; ++population_; }
+ B(const B &b) {
+ ++count_;
+ if (count_ == 3)
+ TEST_THROW(1);
+ data_ = b.data_;
+ ++population_;
+ }
~B() {data_ = 0; --population_; }
};
@@ -48,6 +55,7 @@ int main()
char pool[sizeof(B)*N] = {0};
B* bp = (B*)pool;
assert(B::population_ == 0);
+#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
std::uninitialized_fill(bp, bp+N, B());
@@ -57,6 +65,7 @@ int main()
{
assert(B::population_ == 0);
}
+#endif
B::count_ = 0;
std::uninitialized_fill(bp, bp+2, B());
for (int i = 0; i < 2; ++i)
More information about the cfe-commits
mailing list