1 /* xbt/asserts.h -- assertion mecanism */
3 /* Copyright (c) 2005, 2006, 2007, 2009, 2010. The SimGrid Team.
4 * All rights reserved. */
6 /* This program is free software; you can redistribute it and/or modify it
7 * under the terms of the license (GNU LGPL) which comes with this package. */
10 #define _XBT_ASSERTS_H
19 * @addtogroup XBT_error
20 * @brief Those are the SimGrid version of the good ol' assert macro.
22 * You can pass them a format message and arguments, just as if it where a printf.
23 * It is converted to a CRITICALn logging request.
28 #define xbt_assert(cond)
29 #define xbt_assert0(cond,msg)
30 #define xbt_assert1(cond,msg,a)
31 #define xbt_assert2(cond,msg,a,b)
32 #define xbt_assert3(cond,msg,a,b,c)
33 #define xbt_assert4(cond,msg,a,b,c,d)
34 #define xbt_assert5(cond,msg,a,b,c,d,e)
35 #define xbt_assert6(cond,msg,a,b,c,d,e,f)
37 /** @brief The condition which failed will be displayed.
39 #define xbt_assert(cond) if (!(cond)) THROW1(0,0,"Assertion %s failed", #cond)
40 /** @hideinitializer */
41 #define xbt_assert0(cond,msg) if (!(cond)) THROW0(0,0,msg)
42 /** @hideinitializer */
43 #define xbt_assert1(cond,msg,a) if (!(cond)) THROW1(0,0,msg,a)
44 /** @hideinitializer */
45 #define xbt_assert2(cond,msg,a,b) if (!(cond)) THROW2(0,0,msg,a,b)
46 /** @hideinitializer */
47 #define xbt_assert3(cond,msg,a,b,c) if (!(cond)) THROW3(0,0,msg,a,b,c)
48 /** @hideinitializer */
49 #define xbt_assert4(cond,msg,a,b,c,d) if (!(cond)) THROW4(0,0,msg,a,b,c,d)
50 /** @hideinitializer */
51 #define xbt_assert5(cond,msg,a,b,c,d,e) if (!(cond)) THROW5(0,0,msg,a,b,c,d,e)
52 /** @hideinitializer */
53 #define xbt_assert6(cond,msg,a,b,c,d,e,f) if (!(cond)) THROW6(0,0,msg,a,b,c,d,e,f)
57 #endif /* _XBT_ASSERTS_H */