Permalink
Browse files

COMP: scotchDecomp: floating point error checking

  • Loading branch information...
1 parent 5a54dea commit 276d31f755c4ed1bb61f318ffd6f48b7e5bed210 mattijs committed Aug 20, 2012
@@ -129,17 +129,9 @@ extern "C"
// Hack: scotch generates floating point errors so need to switch of error
// trapping!
-#if defined(linux) || defined(linuxAMD64) || defined(linuxIA64)
-# define LINUX
-#endif
-
-#if defined(LINUX) && defined(__GNUC__)
-# define LINUX_GNUC
-#endif
-
-#ifdef LINUX_GNUC
-# ifndef __USE_GNU
-# define __USE_GNU
+#ifdef __GLIBC__
+# ifndef _GNU_SOURCE
+# define _GNU_SOURCE
# endif
# include <fenv.h>
#endif
@@ -651,7 +643,7 @@ Foam::label Foam::ptscotchDecomp::decompose
// Hack:switch off fpu error trapping
-# ifdef LINUX_GNUC
+# ifdef FE_NOMASK_ENV
int oldExcepts = fedisableexcept
(
FE_DIVBYZERO
@@ -681,7 +673,7 @@ Foam::label Foam::ptscotchDecomp::decompose
"SCOTCH_graphMap"
);
-# ifdef LINUX_GNUC
+# ifdef FE_NOMASK_ENV
feenableexcept(oldExcepts);
# endif
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
- \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
+ \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@@ -135,17 +135,9 @@ extern "C"
// Hack: scotch generates floating point errors so need to switch of error
// trapping!
-#if defined(linux) || defined(linuxAMD64) || defined(linuxIA64)
-# define LINUX
-#endif
-
-#if defined(LINUX) && defined(__GNUC__)
-# define LINUX_GNUC
-#endif
-
-#ifdef LINUX_GNUC
-# ifndef __USE_GNU
-# define __USE_GNU
+#ifdef __GLIBC__
+# ifndef _GNU_SOURCE
+# define _GNU_SOURCE
# endif
# include <fenv.h>
#endif
@@ -503,7 +495,7 @@ Foam::label Foam::scotchDecomp::decomposeOneProc
// Hack:switch off fpu error trapping
-# ifdef LINUX_GNUC
+# ifdef FE_NOMASK_ENV
int oldExcepts = fedisableexcept
(
FE_DIVBYZERO
@@ -526,7 +518,7 @@ Foam::label Foam::scotchDecomp::decomposeOneProc
"SCOTCH_graphMap"
);
-# ifdef LINUX_GNUC
+# ifdef FE_NOMASK_ENV
feenableexcept(oldExcepts);
# endif

0 comments on commit 276d31f

Please sign in to comment.