5 // Created by James McIlree on 4/7/13.
6 // Copyright (c) 2013 Apple. All rights reserved.
9 #ifndef CPPUtil_Assert_hpp
10 #define CPPUtil_Assert_hpp
12 #if !defined(NDEBUG) && !defined(NS_BLOCK_ASSERTIONS)
14 #define DEBUG_ONLY( statement ) statement
16 #define ASSERT(e, d) \
18 if (__builtin_expect(!(e), 0)) { \
19 ::printf("ASSERT(%s) %s %d, %s\n", #e, util::Path::basename((char*)__FILE__).c_str(), __LINE__, d); \
24 #define SHOULD_NOT_REACH_HERE(d) \
26 ::printf("SHOULD_NOT_REACH_HERE %s %d, %s\n", util::Path::basename((char*)__FILE__).c_str(), __LINE__, d); \
30 #define TrueInDebug true
34 #define DEBUG_ONLY( statement )
36 #define SHOULD_NOT_REACH_HERE(d)
38 #define TrueInDebug false
42 #define GUARANTEE(e) \
44 if (__builtin_expect(!(e), 0)) { \
45 ::printf("ASSERT(%s) %s %d\n", #e, util::Path::basename((char*)__FILE__).c_str(), __LINE__); \