Defines | Functions

nsDebug.h File Reference

#include "nscore.h"
#include "nsError.h"
#include "nsXPCOM.h"
Include dependency graph for nsDebug.h:
This graph shows which files directly or indirectly include this file:

Defines

#define NS_ABORT_IF_FALSE(_expr, _msg)   PR_BEGIN_MACRO /* nothing */ PR_END_MACRO
 The non-debug version of these macros do not evaluate the expression or the message arguments to the macro.
#define NS_WARN_IF_FALSE(_expr, _msg)   PR_BEGIN_MACRO /* nothing */ PR_END_MACRO
#define NS_PRECONDITION(expr, str)   PR_BEGIN_MACRO /* nothing */ PR_END_MACRO
#define NS_ASSERTION(expr, str)   PR_BEGIN_MACRO /* nothing */ PR_END_MACRO
#define NS_POSTCONDITION(expr, str)   PR_BEGIN_MACRO /* nothing */ PR_END_MACRO
#define NS_NOTYETIMPLEMENTED(str)   PR_BEGIN_MACRO /* nothing */ PR_END_MACRO
#define NS_NOTREACHED(str)   PR_BEGIN_MACRO /* nothing */ PR_END_MACRO
#define NS_ERROR(str)   PR_BEGIN_MACRO /* nothing */ PR_END_MACRO
#define NS_WARNING(str)   PR_BEGIN_MACRO /* nothing */ PR_END_MACRO
#define NS_ABORT()   PR_BEGIN_MACRO /* nothing */ PR_END_MACRO
#define NS_BREAK()   PR_BEGIN_MACRO /* nothing */ PR_END_MACRO
#define NS_RUNTIMEABORT(msg)   NS_DebugBreak(NS_DEBUG_ABORT, msg, nsnull, __FILE__, __LINE__)
 Terminate execution immediately, and if possible on the current platform, in such a way that execution can't be continued by other code (e.g., by intercepting a signal).
#define NS_ENSURE_TRUE(x, ret)
#define NS_ENSURE_FALSE(x, ret)   NS_ENSURE_TRUE(!(x), ret)
#define NS_ENSURE_SUCCESS_BODY(res, ret)   NS_WARNING("NS_ENSURE_SUCCESS(" #res ", " #ret ") failed");
#define NS_ENSURE_SUCCESS(res, ret)
#define NS_ENSURE_ARG(arg)   NS_ENSURE_TRUE(arg, NS_ERROR_INVALID_ARG)
#define NS_ENSURE_ARG_POINTER(arg)   NS_ENSURE_TRUE(arg, NS_ERROR_INVALID_POINTER)
#define NS_ENSURE_ARG_MIN(arg, min)   NS_ENSURE_TRUE((arg) >= min, NS_ERROR_INVALID_ARG)
#define NS_ENSURE_ARG_MAX(arg, max)   NS_ENSURE_TRUE((arg) <= max, NS_ERROR_INVALID_ARG)
#define NS_ENSURE_ARG_RANGE(arg, min, max)   NS_ENSURE_TRUE(((arg) >= min) && ((arg) <= max), NS_ERROR_INVALID_ARG)
#define NS_ENSURE_STATE(state)   NS_ENSURE_TRUE(state, NS_ERROR_UNEXPECTED)
#define NS_ENSURE_NO_AGGREGATION(outer)   NS_ENSURE_FALSE(outer, NS_ERROR_NO_AGGREGATION)
#define NS_ENSURE_PROPER_AGGREGATION(outer, iid)   NS_ENSURE_FALSE(outer && !iid.Equals(NS_GET_IID(nsISupports)), NS_ERROR_INVALID_ARG)
#define NS_CheckThreadSafe(owningThread, msg)   NS_ASSERTION(owningThread == PR_GetCurrentThread(), msg)

Functions

void printf_stderr (const char *fmt,...)

Define Documentation

#define NS_ABORT (  )     PR_BEGIN_MACRO /* nothing */ PR_END_MACRO
#define NS_ABORT_IF_FALSE (   _expr,
  _msg 
)    PR_BEGIN_MACRO /* nothing */ PR_END_MACRO

The non-debug version of these macros do not evaluate the expression or the message arguments to the macro.

#define NS_ASSERTION (   expr,
  str 
)    PR_BEGIN_MACRO /* nothing */ PR_END_MACRO
#define NS_BREAK (  )     PR_BEGIN_MACRO /* nothing */ PR_END_MACRO
#define NS_CheckThreadSafe (   owningThread,
  msg 
)    NS_ASSERTION(owningThread == PR_GetCurrentThread(), msg)
#define NS_ENSURE_ARG (   arg  )     NS_ENSURE_TRUE(arg, NS_ERROR_INVALID_ARG)
#define NS_ENSURE_ARG_MAX (   arg,
  max 
)    NS_ENSURE_TRUE((arg) <= max, NS_ERROR_INVALID_ARG)
#define NS_ENSURE_ARG_MIN (   arg,
  min 
)    NS_ENSURE_TRUE((arg) >= min, NS_ERROR_INVALID_ARG)
#define NS_ENSURE_ARG_POINTER (   arg  )     NS_ENSURE_TRUE(arg, NS_ERROR_INVALID_POINTER)
#define NS_ENSURE_ARG_RANGE (   arg,
  min,
  max 
)    NS_ENSURE_TRUE(((arg) >= min) && ((arg) <= max), NS_ERROR_INVALID_ARG)
#define NS_ENSURE_FALSE (   x,
  ret 
)    NS_ENSURE_TRUE(!(x), ret)
#define NS_ENSURE_NO_AGGREGATION (   outer  )     NS_ENSURE_FALSE(outer, NS_ERROR_NO_AGGREGATION)
#define NS_ENSURE_PROPER_AGGREGATION (   outer,
  iid 
)    NS_ENSURE_FALSE(outer && !iid.Equals(NS_GET_IID(nsISupports)), NS_ERROR_INVALID_ARG)
#define NS_ENSURE_STATE (   state  )     NS_ENSURE_TRUE(state, NS_ERROR_UNEXPECTED)
#define NS_ENSURE_SUCCESS (   res,
  ret 
)
Value:
PR_BEGIN_MACRO                                                          \
    nsresult __rv = res; /* Don't evaluate |res| more than once */        \
    if (NS_FAILED(__rv)) {                                                \
      NS_ENSURE_SUCCESS_BODY(res, ret)                                    \
      return ret;                                                         \
    }                                                                     \
  PR_END_MACRO
#define NS_ENSURE_SUCCESS_BODY (   res,
  ret 
)    NS_WARNING("NS_ENSURE_SUCCESS(" #res ", " #ret ") failed");
#define NS_ENSURE_TRUE (   x,
  ret 
)
Value:
PR_BEGIN_MACRO                                              \
    if (NS_UNLIKELY(!(x))) {                                  \
       NS_WARNING("NS_ENSURE_TRUE(" #x ") failed");           \
       return ret;                                            \
    }                                                         \
  PR_END_MACRO
#define NS_ERROR (   str  )     PR_BEGIN_MACRO /* nothing */ PR_END_MACRO
#define NS_NOTREACHED (   str  )     PR_BEGIN_MACRO /* nothing */ PR_END_MACRO
#define NS_NOTYETIMPLEMENTED (   str  )     PR_BEGIN_MACRO /* nothing */ PR_END_MACRO
#define NS_POSTCONDITION (   expr,
  str 
)    PR_BEGIN_MACRO /* nothing */ PR_END_MACRO
#define NS_PRECONDITION (   expr,
  str 
)    PR_BEGIN_MACRO /* nothing */ PR_END_MACRO
#define NS_RUNTIMEABORT (   msg  )     NS_DebugBreak(NS_DEBUG_ABORT, msg, nsnull, __FILE__, __LINE__)

Terminate execution immediately, and if possible on the current platform, in such a way that execution can't be continued by other code (e.g., by intercepting a signal).

#define NS_WARN_IF_FALSE (   _expr,
  _msg 
)    PR_BEGIN_MACRO /* nothing */ PR_END_MACRO
#define NS_WARNING (   str  )     PR_BEGIN_MACRO /* nothing */ PR_END_MACRO

Function Documentation

void printf_stderr ( const char *  fmt,
  ... 
)