From a80532b259c16b9ce1f2f11bcb3b38e40a10b916 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Wed, 27 May 2015 18:51:43 -0500 Subject: [PATCH] Use floating point exceptions to catch more errors in the testsuite. --- tests/tests.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests/tests.h b/tests/tests.h index 90ce586b77..2d8cfbaa92 100644 --- a/tests/tests.h +++ b/tests/tests.h @@ -32,6 +32,9 @@ #include #include +#include + + // silence extra diagnostics in the testsuite #ifdef DEAL_II_DISABLE_EXTRA_DIAGNOSTICS DEAL_II_DISABLE_EXTRA_DIAGNOSTICS @@ -432,6 +435,22 @@ struct SwitchOffStacktrace } deal_II_stacktrace_dummy; + +/* Enable floating point exceptions in debug mode and if we have + detected that they are usable: */ + +struct EnableFPE +{ + EnableFPE () + { +#if defined(DEBUG) && defined(DEAL_II_HAVE_FP_EXCEPTIONS) + // enable floating point exceptions + feenableexcept(FE_DIVBYZERO|FE_INVALID); +#endif + } +} deal_II_enable_fpe; + + /* Set grainsizes for parallel mode smaller than they would otherwise be. * This is used to test that the parallel algorithms in lac/ work alright: */ -- 2.39.5