Chombo + EB  3.2
CH_assert.H
Go to the documentation of this file.
1 #ifdef CH_LANG_CC
2 /*
3  * _______ __
4  * / ___/ / ___ __ _ / / ___
5  * / /__/ _ \/ _ \/ V \/ _ \/ _ \
6  * \___/_//_/\___/_/_/_/_.__/\___/
7  * Please refer to Copyright.txt, in Chombo's root directory.
8  */
9 #endif
10 
11 #ifndef _CH_ASSERT_H_
12 #define _CH_ASSERT_H_
13 
14 #ifdef CH_LANG_CC
15 # include "MayDay.H"
16 #endif
17 
18 #include "BaseNamespaceHeader.H"
19 
20 #ifdef CH_LANG_CC
21 /**
22 @ingroup macros
23 compile-time cpp macro that replaces 'assert()' and aborts
24 correctly when running in parallel. */
25 # ifndef NDEBUG
26 # define CH_assert_str(s) # s
27 # define CH_assert_xstr(s) CH_assert_str(s)
28 # define CH_assert(cond) if (!(cond)) \
29  { \
30  CH_XD::MayDay::Abort( __FILE__ ":" CH_assert_xstr(__LINE__) ": Assertion `" #cond "' failed."); \
31  }
32 # else
33 # define CH_assert(cond) (void)0
34 #endif
35 
36 /* removing this form of static_assert since it does not follow the
37 std::static_assert specification and users can now use real static_assert
38 */
39 /** Compile-time assertion */
40 /** (renamed this temp variable as static_assert will become a keyword -- and likely have same functionality) */
41 /*
42 template<bool> struct diy_static_assert;
43 template<> struct diy_static_assert<true>
44 {
45 };
46 */
47 //#define STATIC_ASSERT( a ) diy_static_assert<a>()
48 
49 #endif /*CH_LANG_CC*/
50 
51 #ifdef CH_LANG_FORT
52 #ifndef NDEBUG
53 # define CH_assert(cond) if (.NOT. cond) call MAYDAYERROR()
54 #else
55 # define CH_assert(cond)
56 #endif
57 #endif /*CH_LANG_FORT*/
58 
59 #include "BaseNamespaceFooter.H"
60 
61 #endif /* include guard*/