00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef NS3_ABORT_H
00020 #define NS3_ABORT_H
00021
00022 #include "fatal-error.h"
00023
00024 #define NS_ABORT_MSG(msg) \
00025 do { \
00026 std::cerr << "file=" << __FILE__ << \
00027 ", line=" << __LINE__ << ", abort, msg=\"" << \
00028 msg << "\"" << std::endl; \
00029 int *a = 0; \
00030 *a = 0; \
00031 } while (false)
00032
00033
00034 #define NS_ABORT_IF(cond) \
00035 do { \
00036 if (cond) \
00037 { \
00038 std::cerr << "file=" << __FILE__ << \
00039 ", line=" << __LINE__ << ", abort on=\""#cond << \
00040 "\"" << std::endl; \
00041 int *a = 0; \
00042 *a = 0; \
00043 } \
00044 } while (false)
00045
00046 #define NS_ABORT_MSG_IF(cond, msg) \
00047 do { \
00048 if (cond) \
00049 { \
00050 std::cerr << "file=" << __FILE__ << \
00051 ", line=" << __LINE__ << ", abort on=\""#cond << \
00052 "\", msg=\"" << msg << "\"" << std::endl; \
00053 int *a = 0; \
00054 *a = 0; \
00055 } \
00056 } while (false)
00057
00058 #define NS_ABORT_UNLESS(cond) \
00059 NS_ABORT_IF(!(cond))
00060
00061 #define NS_ABORT_MSG_UNLESS(cond, msg) \
00062 NS_ABORT_MSG_IF(!(cond),msg)
00063
00064 #endif