assertmpeu.H 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2. ! NASA/GSFC, Data Assimilation Office, Code 910.3, GEOS/DAS !
  3. !-----------------------------------------------------------------------
  4. ! CVS assertmpeu.H,v 1.2 2007-08-17 20:44:17 jacob Exp
  5. ! CVS MCT_2_8_0
  6. !BOP -------------------------------------------------------------------
  7. !
  8. ! !MODULE: assertmpeu.H - an #include section of ASSERT() macro for Fortran
  9. !
  10. ! !DESCRIPTION:
  11. !
  12. ! !INTERFACE:
  13. !
  14. ! #define NDEBUG
  15. ! #include "assertmpeu.H"
  16. ! ...
  17. ! use m_die,only : assert_
  18. ! ...
  19. ! ASSERT( <Fortran expression> )
  20. ! ALWAYS_ASSERT( <Fortran expression> )
  21. !
  22. ! !BUGS
  23. ! This macro requires Fortran friendly cpp() for macro processing.
  24. !
  25. ! !REVISION HISTORY:
  26. ! 17Aug07 - R. Jacob <jacob@mcs.anl.gov> - renamed from assert.H to
  27. ! prevent namespace collision with assert.h on Mac
  28. ! 28Aug00 - Jing Guo <guo@dao.gsfc.nasa.gov>
  29. ! - modified
  30. ! - added the prolog for a brief documentation
  31. ! before - Tom Clune
  32. ! - Created for MP PSAS
  33. !EOP ___________________________________________________________________
  34. ! This implementation allows multi-"#include" in a single file
  35. #ifndef ALWAYS_ASSERT
  36. #define ALWAYS_ASSERT(EX) If (.not. (EX) ) call assert_("EX",__FILE__,__LINE__)
  37. #endif
  38. #ifndef ASSERT
  39. #ifdef NDEBUG
  40. #define ASSERT(EX) ! Skip assertion: EX
  41. #else
  42. #define ASSERT(EX) ALWAYS_ASSERT(EX)
  43. #endif
  44. #endif