Implement custom assert macro
Summary: assert.h assertion gets stripped from builds. I don't want these assertions to be stripped so implement a custom assert macro. This also allows the assertion to be documented with a message. Reviewed By: javache Differential Revision: D3648805 fbshipit-source-id: a6bf1bb55e1e0ee37284647ab76d66f3956a66c0
This commit is contained in:
committed by
Facebook Github Bot 7
parent
ac44d2ea6e
commit
9689062f6c
@@ -16,3 +16,17 @@
|
||||
# define CSS_EXTERN_C_BEGIN
|
||||
# define CSS_EXTERN_C_END
|
||||
#endif
|
||||
|
||||
#ifndef FB_ASSERTIONS_ENABLED
|
||||
#define FB_ASSERTIONS_ENABLED 1
|
||||
#endif
|
||||
|
||||
#if !(FB_ASSERTIONS_ENABLED)
|
||||
#define abort()
|
||||
#endif
|
||||
|
||||
#define CSS_ASSERT(X, message) \
|
||||
if (!(X)) { \
|
||||
fprintf(stderr, "%s\n", message); \
|
||||
abort(); \
|
||||
}
|
||||
|
Reference in New Issue
Block a user