assumption.h 959 B

12345678910111213141516171819202122232425
  1. #if defined(DYMOLA_STANDALONE) && defined(__cplusplus)
  2. /* For errors that also need to be checked in release mode. Where we cannot proceeed*/
  3. extern void ReportInternalErrorAndThrow();
  4. #define assumptionFatal(x) do{if (!(x)) {ReportInternalErrorAndThrow();}}while(0)
  5. #else
  6. /* For _now_ de-activated, do{;}while(0) is standard for getting an empty statement useable everywhere - including if. */
  7. #define assumptionFatal(x) do{;}while(0)
  8. #endif
  9. #if defined(DYMOLA_STANDALONE) && defined(DEBUG)
  10. /* Only activated if you manually add the define 'DEBUG' */
  11. #include <assert.h>
  12. #define assumption(x) do{if (!(x)) {assert(x);/*ReportInternalError();throw AssertionFailed;*/}}while(0)
  13. /* For errors that only need to be checked during development, will fall thru to other code in release mode and be handled gracefully */
  14. #define assumptionDevelopment(x) assert(x)
  15. #else
  16. #define assumption(x) do{;}while(0)
  17. #define assumptionDevelopment(x) do{;}while(0)
  18. #endif