Browse Source

src: add ASSERT/CHECK/UNREACHABLE macros

v0.11.9-release
Ben Noordhuis 11 years ago
parent
commit
3ac6946999
  1. 15
      src/util.h

15
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.

Loading…
Cancel
Save