diff options
Diffstat (limited to 'src/util.h')
-rw-r--r-- | src/util.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/util.h b/src/util.h index 63962a62598..84ca8b876e8 100644 --- a/src/util.h +++ b/src/util.h @@ -23,7 +23,9 @@ #define SRC_UTIL_H_ #include "v8.h" +#include <assert.h> #include <stddef.h> +#include <stdlib.h> namespace node { @@ -41,6 +43,19 @@ namespace node { void operator=(const TypeName&); \ TypeName(const TypeName&) +#if defined(NDEBUG) +#define ASSERT(expression) +#define CHECK(expression) \ + do { \ + if (!(expression)) abort(); \ + } while (0) +#else +#define ASSERT(expression) assert(expression) +#define CHECK(expression) assert(expression) +#endif + +#define UNREACHABLE() abort() + // If persistent.IsWeak() == false, then do not call persistent.Dispose() // while the returned Local<T> is still in scope, it will destroy the // reference to the object. |