aboutsummaryrefslogtreecommitdiff
path: root/test/diagnostics_test.cc
diff options
context:
space:
mode:
authorEric Fiselier <eric@efcs.ca>2016-05-23 15:38:30 -0600
committerEric Fiselier <eric@efcs.ca>2016-05-23 15:38:30 -0600
commit029f37446daeef98db8dc3b26165405a1df2cc80 (patch)
treedc44978367ece254f9a872155d29bc70d8e0395e /test/diagnostics_test.cc
parent481e06e65acc2d82e8f3a02fba2fd226de56b3ad (diff)
downloadgoogle-benchmark-029f37446daeef98db8dc3b26165405a1df2cc80.tar.gz
Allow test to compile with -fno-exceptions
Diffstat (limited to 'test/diagnostics_test.cc')
-rw-r--r--test/diagnostics_test.cc12
1 files changed, 11 insertions, 1 deletions
diff --git a/test/diagnostics_test.cc b/test/diagnostics_test.cc
index 005abdc..60fa3b1 100644
--- a/test/diagnostics_test.cc
+++ b/test/diagnostics_test.cc
@@ -9,13 +9,23 @@
#include "benchmark/benchmark_api.h"
#include "../src/check.h"
+#include <stdexcept>
+#include <cstdlib>
+
+#if defined(__GNUC__) && !defined(__EXCEPTIONS)
+#define TEST_HAS_NO_EXCEPTIONS
+#endif
void TestHandler() {
+#ifndef TEST_HAS_NO_EXCEPTIONS
throw std::logic_error("");
+#else
+ std::abort();
+#endif
}
void try_invalid_pause_resume(benchmark::State& state) {
-#ifndef NDEBUG
+#if !defined(NDEBUG) && !defined(TEST_HAS_NO_EXCEPTIONS)
try {
state.PauseTiming();
std::abort();