Commit Graph

32 Commits

Author SHA1 Message Date
Mark Olesen
bb53e8adb3 ENH: adjustments to Switch
- align Switch more with Enum.
  Now have find(), found() static methods.
  Constructors with failsafe option.

  The find() method makes for clearer coding:

  OLD

     Switch sw(some_string, true); // NB: true = allowBad

     if (sw.valid()) ...

  NOW

     Switch sw = Switch::find(some_string);

     if (sw.good()) ...

  or

     if (Switch::found(some_string)) ...

- improve construct from dictionary to handle all valid token types.
  Previously just read in a word.

- Remove asText() method - replaced by c_str() and str() several
  versions ago.
2020-02-18 21:51:35 +01:00
OpenFOAM bot
e9219558d7 GIT: Header file updates 2019-10-31 14:48:44 +00:00
Mark Olesen
8928ac54bd COMP: use standard compiler macros when distinguishing the OS
- replace (darwin) with (__APPLE__)
- replace (solarisGcc) with (__sun__ && __GNUC__)
- instead of 'darwin' -> '__APPLE'

- cease with passing a -D$(WM_ARCH) define since this adds no useful
  additional information and isn't used anywhere.

Reference
http://nadeausoftware.com/articles/2012/01/c_c_tip_how_use_compiler_predefined_macros_detect_operating_system

--

COMP: Extend size disambiguation on long (#1238)
2019-04-12 18:42:30 +02:00
Mark Olesen
8d827f99a9 DEFEATURE: remove old IRIX code for floating-point-exceptions 2019-04-12 18:35:18 +02:00
Mark Olesen
c24fbfd7e3 ENH: improve code isolation for signal-handling
- file-local static for saving the old action, which moves system
  dependencies out of the header files.

- set/reset of signals as file-local functions

STYLE: use csignal header instead of signal.h
2019-04-02 11:38:09 +02:00
OpenFOAM bot
154029ddd0 BOT: Cleaned up header files 2019-02-06 12:28:23 +00:00
Mark Olesen
83c9d3b287 EHH: add sigFpe::ignore helper class (issue #897)
- convenient way to temporarily suspend the SIGFPE handler.
  Eg,

      // Normal code with SIGFPE enabled ...
      sigFpe::set();

      {
          // Ignore SIGFPE in this scope ...
          sigFpe::ignore noFpeHandling;
          ...
      }
2018-06-22 00:39:53 +02:00
Alexey Matveichev
9258b558f4 ENH: Darwin adjustments
- link CGAL (clang version) without reference to mpfr,gmp libraries

- use offset address in printStack for Darwin as well

- alternative handling of feexcept on Darwin
2018-06-13 13:32:19 +02:00
Mark Olesen
97dc9f4029 EHN: make signal verbosity an optional calling argument. 2018-04-11 21:35:02 +02:00
Mark Olesen
c50368ecc6 ENH: add trapFpe and setNaN optimisationSwitch (issue #517)
- allows configuration without an environment variable.
  For compatibility still respect FOAM_SIGFPE and FOAM_SETNAN
  env-variables

- The env-variables are now treated as true/false switch values.
  Previously there was just a check for env exists or not, but this
  can be fairly fragile for a user's environment.
2017-07-05 17:49:37 +02:00
Andrew Heather
9fbd612672 GIT: Initial state after latest Foundation merge 2016-09-20 14:49:08 +01:00
Henry Weller
58f905ff70 C++11: Replaced the C NULL with the safer C++11 nullptr
Requires gcc version 4.7 or higher
2016-08-05 17:19:38 +01:00
mattijs
edec4d139d STYLE: sigFpe: use of FatalErrorInFunction 2015-12-11 15:14:45 +00:00
Andrew Heather
3f55f752fc GIT: Resolve conflict with upstream merge from Foundation 2015-12-07 17:07:20 +00:00
mattijs
99bdd2c1d7 ENH: signals: refactored to make static methods
The signal handling can now be set and unset. This latter is important
for external libraries (e.g. VTK/OpenGL) that do not work with it.
2015-11-27 12:14:14 +00:00
Henry Weller
c4d5f65a10 Completed update ...ErrorIn -> ...ErrorInFunction
Avoids the clutter and maintenance effort associated with providing the
function signature string.
2015-11-11 09:03:39 +00:00
Henry Weller
00279d617a sigFpe: Replace the deprecated __malloc_hook with a special malloc
This malloc overrides the one provided by GLIBC and calls mallocNan
which initializes the allocated block of memory to NaN if enabled by the
FOAM_SETNAN environment variable.
2015-07-19 12:39:44 +01:00
Henry
c93f87cc7f Added support for glibc < 2.18
Resolves bug-report http://www.openfoam.org/mantisbt/view.php?id=1474
2015-01-04 20:13:37 +00:00
mattijs
ed99c9d05d ENH: sigFpe: use std::signalling_nan 2013-10-31 12:57:01 +00:00
mattijs
a501d0ff3c ENH: sigFpe: split off Nan handling 2013-09-18 16:59:44 +01:00
mattijs
81021c37bf STYLE: sigFpe: indentation 2013-03-26 09:28:39 +00:00
Henry
c2dd153a14 Copyright transfered to the OpenFOAM Foundation 2011-08-14 12:17:30 +01:00
Mark Olesen
e95e9700c8 Merge remote branch 'OpenCFD/master' into olesenm 2011-01-17 10:21:58 +01:00
andy
eaef8d482b STYLE: Updated 1991 start copyright year to 2004 2011-01-14 16:08:00 +00:00
andy
099cc39e2e Revert "STYLE: 2011 copyright date."
This reverts commit b18f6cc1ce.
2011-01-05 18:24:29 +00:00
graham
b18f6cc1ce STYLE: 2011 copyright date. 2011-01-05 11:14:26 +00:00
Mark Olesen
09170d7715 COMP: protect headers against multiple inclusion in POSIX/signals
STYLE: report when SIGFPE handling is unsupported

- move OSspecific.H include from signal headers to argList where
  it is more obvious
2011-01-04 19:35:48 +01:00
graham
d79237597e STYLE: Fixing code style requirements for all src. 2010-07-28 13:31:46 +01:00
Mark Olesen
d29c438657 STYLE: use url for FSF license instead of postal address, switch to GPL v3 2010-03-29 14:07:56 +02:00
henry
218b2baec4 Changed SP and DP to WM_SP and WM_DP. 2009-07-03 11:46:45 +01:00
mattijs
6d324c0f3e sigfpe message in header 2009-06-17 13:51:48 +01:00
Mark Olesen
20c1a673e7 'rebrand' OSspecific Unix -> POSIX
- change name of environment variable from $WM_OS -> $WM_OSTYPE
  as a better description
2009-05-18 10:26:11 +02:00