diff options
author | Eric Fiselier <eric@efcs.ca> | 2016-05-23 15:38:30 -0600 |
---|---|---|
committer | Eric Fiselier <eric@efcs.ca> | 2016-05-23 15:38:30 -0600 |
commit | 029f37446daeef98db8dc3b26165405a1df2cc80 (patch) | |
tree | dc44978367ece254f9a872155d29bc70d8e0395e /test/diagnostics_test.cc | |
parent | 481e06e65acc2d82e8f3a02fba2fd226de56b3ad (diff) | |
download | google-benchmark-029f37446daeef98db8dc3b26165405a1df2cc80.tar.gz |
Allow test to compile with -fno-exceptions
Diffstat (limited to 'test/diagnostics_test.cc')
-rw-r--r-- | test/diagnostics_test.cc | 12 |
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(); |