[libcxx] r283030 - Replace test_throw.h header with a single test macro
Eric Fiselier via cfe-commits
cfe-commits at lists.llvm.org
Sat Oct 1 03:34:14 PDT 2016
Author: ericwf
Date: Sat Oct 1 05:34:13 2016
New Revision: 283030
URL: http://llvm.org/viewvc/llvm-project?rev=283030&view=rev
Log:
Replace test_throw.h header with a single test macro
Removed:
libcxx/trunk/test/support/test_throw.h
Modified:
libcxx/trunk/test/std/utilities/memory/specialized.algorithms/uninitialized.construct.default/uninitialized_default_construct.pass.cpp
libcxx/trunk/test/std/utilities/memory/specialized.algorithms/uninitialized.construct.default/uninitialized_default_construct_n.pass.cpp
libcxx/trunk/test/std/utilities/memory/specialized.algorithms/uninitialized.construct.value/uninitialized_value_construct.pass.cpp
libcxx/trunk/test/std/utilities/memory/specialized.algorithms/uninitialized.construct.value/uninitialized_value_construct_n.pass.cpp
libcxx/trunk/test/std/utilities/memory/specialized.algorithms/uninitialized.move/uninitialized_move.pass.cpp
libcxx/trunk/test/std/utilities/memory/specialized.algorithms/uninitialized.move/uninitialized_move_n.pass.cpp
libcxx/trunk/test/support/test_macros.h
Modified: libcxx/trunk/test/std/utilities/memory/specialized.algorithms/uninitialized.construct.default/uninitialized_default_construct.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/memory/specialized.algorithms/uninitialized.construct.default/uninitialized_default_construct.pass.cpp?rev=283030&r1=283029&r2=283030&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/memory/specialized.algorithms/uninitialized.construct.default/uninitialized_default_construct.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/memory/specialized.algorithms/uninitialized.construct.default/uninitialized_default_construct.pass.cpp Sat Oct 1 05:34:13 2016
@@ -20,7 +20,6 @@
#include "test_macros.h"
#include "test_iterators.h"
-#include "test_throw.h"
struct Counted {
static int count;
@@ -43,7 +42,7 @@ struct ThrowsCounted {
explicit ThrowsCounted() {
++constructed;
if (throw_after > 0 && --throw_after == 0) {
- test_throw<int>();
+ TEST_THROW(1);
}
++count;
}
Modified: libcxx/trunk/test/std/utilities/memory/specialized.algorithms/uninitialized.construct.default/uninitialized_default_construct_n.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/memory/specialized.algorithms/uninitialized.construct.default/uninitialized_default_construct_n.pass.cpp?rev=283030&r1=283029&r2=283030&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/memory/specialized.algorithms/uninitialized.construct.default/uninitialized_default_construct_n.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/memory/specialized.algorithms/uninitialized.construct.default/uninitialized_default_construct_n.pass.cpp Sat Oct 1 05:34:13 2016
@@ -20,7 +20,6 @@
#include "test_macros.h"
#include "test_iterators.h"
-#include "test_throw.h"
struct Counted {
static int count;
@@ -43,7 +42,7 @@ struct ThrowsCounted {
explicit ThrowsCounted() {
++constructed;
if (throw_after > 0 && --throw_after == 0) {
- test_throw<int>();
+ TEST_THROW(1);
}
++count;
}
Modified: libcxx/trunk/test/std/utilities/memory/specialized.algorithms/uninitialized.construct.value/uninitialized_value_construct.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/memory/specialized.algorithms/uninitialized.construct.value/uninitialized_value_construct.pass.cpp?rev=283030&r1=283029&r2=283030&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/memory/specialized.algorithms/uninitialized.construct.value/uninitialized_value_construct.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/memory/specialized.algorithms/uninitialized.construct.value/uninitialized_value_construct.pass.cpp Sat Oct 1 05:34:13 2016
@@ -20,7 +20,6 @@
#include "test_macros.h"
#include "test_iterators.h"
-#include "test_throw.h"
struct Counted {
static int count;
@@ -43,7 +42,7 @@ struct ThrowsCounted {
explicit ThrowsCounted() {
++constructed;
if (throw_after > 0 && --throw_after == 0) {
- test_throw<int>();
+ TEST_THROW(1);
}
++count;
}
Modified: libcxx/trunk/test/std/utilities/memory/specialized.algorithms/uninitialized.construct.value/uninitialized_value_construct_n.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/memory/specialized.algorithms/uninitialized.construct.value/uninitialized_value_construct_n.pass.cpp?rev=283030&r1=283029&r2=283030&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/memory/specialized.algorithms/uninitialized.construct.value/uninitialized_value_construct_n.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/memory/specialized.algorithms/uninitialized.construct.value/uninitialized_value_construct_n.pass.cpp Sat Oct 1 05:34:13 2016
@@ -20,7 +20,6 @@
#include "test_macros.h"
#include "test_iterators.h"
-#include "test_throw.h"
struct Counted {
static int count;
@@ -42,7 +41,7 @@ struct ThrowsCounted {
explicit ThrowsCounted() {
++constructed;
if (throw_after > 0 && --throw_after == 0) {
- test_throw<int>();
+ TEST_THROW(1);
}
++count;
}
Modified: libcxx/trunk/test/std/utilities/memory/specialized.algorithms/uninitialized.move/uninitialized_move.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/memory/specialized.algorithms/uninitialized.move/uninitialized_move.pass.cpp?rev=283030&r1=283029&r2=283030&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/memory/specialized.algorithms/uninitialized.move/uninitialized_move.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/memory/specialized.algorithms/uninitialized.move/uninitialized_move.pass.cpp Sat Oct 1 05:34:13 2016
@@ -20,7 +20,6 @@
#include "test_macros.h"
#include "test_iterators.h"
-#include "test_throw.h"
struct Counted {
static int count;
@@ -43,7 +42,7 @@ struct ThrowsCounted {
explicit ThrowsCounted(int&& x) {
++constructed;
if (throw_after > 0 && --throw_after == 0) {
- test_throw<int>();
+ TEST_THROW(1);
}
++count;
x = 0;
Modified: libcxx/trunk/test/std/utilities/memory/specialized.algorithms/uninitialized.move/uninitialized_move_n.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/memory/specialized.algorithms/uninitialized.move/uninitialized_move_n.pass.cpp?rev=283030&r1=283029&r2=283030&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/memory/specialized.algorithms/uninitialized.move/uninitialized_move_n.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/memory/specialized.algorithms/uninitialized.move/uninitialized_move_n.pass.cpp Sat Oct 1 05:34:13 2016
@@ -20,7 +20,6 @@
#include "test_macros.h"
#include "test_iterators.h"
-#include "test_throw.h"
struct Counted {
static int count;
@@ -43,7 +42,7 @@ struct ThrowsCounted {
explicit ThrowsCounted(int&& x) {
++constructed;
if (throw_after > 0 && --throw_after == 0) {
- test_throw<int>();
+ TEST_THROW(1);
}
++count;
x = 0;
Modified: libcxx/trunk/test/support/test_macros.h
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/support/test_macros.h?rev=283030&r1=283029&r2=283030&view=diff
==============================================================================
--- libcxx/trunk/test/support/test_macros.h (original)
+++ libcxx/trunk/test/support/test_macros.h Sat Oct 1 05:34:13 2016
@@ -140,4 +140,15 @@ struct is_same<T, T> { enum {value = 1};
static_assert(test_macros_detail::is_same<__VA_ARGS__>::value, \
"Types differ uexpectedly")
+#ifndef TEST_HAS_NO_EXCEPTIONS
+#define TEST_THROW(...) throw __VA_ARGS__
+#else
+#if defined(__GNUC__)
+#define TEST_THROW(...) __builtin_abort()
+#else
+#include <stdlib.h>
+#define TEST_THROW(...) ::abort()
+#endif
+#endif
+
#endif // SUPPORT_TEST_MACROS_HPP
Removed: libcxx/trunk/test/support/test_throw.h
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/support/test_throw.h?rev=283029&view=auto
==============================================================================
--- libcxx/trunk/test/support/test_throw.h (original)
+++ libcxx/trunk/test/support/test_throw.h (removed)
@@ -1,27 +0,0 @@
-// -*- C++ -*-
-//===---------------------------- test_macros.h ---------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef SUPPORT_TEST_THROW_H
-#define SUPPORT_TEST_THROW_H
-
-#include "test_macros.h"
-#include <cstdlib>
-
-template <class Ex>
-TEST_NORETURN
-inline void test_throw() {
-#ifndef TEST_HAS_NO_EXCEPTIONS
- throw Ex();
-#else
- std::abort();
-#endif
-}
-
-#endif // SUPPORT_TEST_THROW_H
More information about the cfe-commits
mailing list