From: Wolfgang Bangerth Date: Wed, 27 May 2015 23:51:43 +0000 (-0500) Subject: Use floating point exceptions to catch more errors in the testsuite. X-Git-Tag: v8.4.0-rc2~587^2~3 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a80532b259c16b9ce1f2f11bcb3b38e40a10b916;p=dealii.git Use floating point exceptions to catch more errors in the testsuite. --- 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: */