src/macros.h

changeset 129
54f27fa8f32f
parent 125
85814c0918c5
child 130
885fd60e8bf1
equal deleted inserted replaced
128:186ebeea2a85 129:54f27fa8f32f
59 #define deprecated __attribute__ ((deprecated)) 59 #define deprecated __attribute__ ((deprecated))
60 60
61 template<typename... argtypes> 61 template<typename... argtypes>
62 void error (const char* fmtstr, const argtypes&... args); 62 void error (const char* fmtstr, const argtypes&... args);
63 63
64 #define BOTC_GENERIC_ASSERT(A,B,OP,COMPLAINT) ((A OP B) ? (void) 0 : \ 64 #ifdef DEBUG
65 # define BOTC_GENERIC_ASSERT(A,B,OP,COMPLAINT) ((A OP B) ? (void) 0 : \
65 error ("assertion failed at " __FILE__ ":%1: " #A " (%2) " COMPLAINT " " #B " (%3)", __LINE__, A, B)); 66 error ("assertion failed at " __FILE__ ":%1: " #A " (%2) " COMPLAINT " " #B " (%3)", __LINE__, A, B));
67 #else
68 # define BOTC_GENERIC_ASSERT(A,B,OP,COMPLAINT) {}
69 #endif
66 70
67 #define ASSERT_EQ(A,B) BOTC_GENERIC_ASSERT (A, B, ==, "does not equal") 71 #define ASSERT_EQ(A,B) BOTC_GENERIC_ASSERT (A, B, ==, "does not equal")
68 #define ASSERT_NE(A,B) BOTC_GENERIC_ASSERT (A, B, !=, "is no different from") 72 #define ASSERT_NE(A,B) BOTC_GENERIC_ASSERT (A, B, !=, "is no different from")
69 #define ASSERT_LT(A,B) BOTC_GENERIC_ASSERT (A, B, <, "is not less than") 73 #define ASSERT_LT(A,B) BOTC_GENERIC_ASSERT (A, B, <, "is not less than")
70 #define ASSERT_GT(A,B) BOTC_GENERIC_ASSERT (A, B, >, "is not greater than") 74 #define ASSERT_GT(A,B) BOTC_GENERIC_ASSERT (A, B, >, "is not greater than")

mercurial