Merge.
This commit is contained in:
commit
55978f0395
2 changed files with 36 additions and 49 deletions
|
@ -122,59 +122,44 @@ operator<<(std::ostream& out, const Debug& obj)
|
||||||
const bool ERROR_MESSAGE_FLAG = true;
|
const bool ERROR_MESSAGE_FLAG = true;
|
||||||
const bool WARNING_MESSAGE_FLAG = true;
|
const bool WARNING_MESSAGE_FLAG = true;
|
||||||
|
|
||||||
#ifdef RUBY_NO_ASSERT
|
|
||||||
const bool ASSERT_FLAG = false;
|
|
||||||
#else
|
|
||||||
const bool ASSERT_FLAG = true;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#undef assert
|
#undef assert
|
||||||
#define assert(EXPR) ASSERT(EXPR)
|
#define assert(EXPR) ASSERT(EXPR)
|
||||||
#undef ASSERT
|
#undef ASSERT
|
||||||
#define ASSERT(EXPR) do { \
|
|
||||||
using namespace std; \
|
#ifndef NDEBUG
|
||||||
if (ASSERT_FLAG) { \
|
|
||||||
if (!(EXPR)) { \
|
#define ASSERT(EXPR) do { \
|
||||||
cerr << "failed assertion '" \
|
using namespace std; \
|
||||||
<< #EXPR << "' at fn " \
|
if (!(EXPR)) { \
|
||||||
<< __PRETTY_FUNCTION__ << " in " \
|
cerr << "failed assertion '" \
|
||||||
<< __FILE__ << ":" \
|
<< #EXPR << "' at fn " \
|
||||||
<< __LINE__ << endl << flush; \
|
<< __PRETTY_FUNCTION__ << " in " \
|
||||||
(*debug_cout_ptr) << "failed assertion '" \
|
<< __FILE__ << ":" \
|
||||||
<< #EXPR << "' at fn " \
|
<< __LINE__ << endl << flush; \
|
||||||
<< __PRETTY_FUNCTION__ << " in " \
|
(*debug_cout_ptr) << "failed assertion '" \
|
||||||
<< __FILE__ << ":" \
|
<< #EXPR << "' at fn " \
|
||||||
<< __LINE__ << endl << flush; \
|
<< __PRETTY_FUNCTION__ << " in " \
|
||||||
if (isatty(STDIN_FILENO)) { \
|
<< __FILE__ << ":" \
|
||||||
cerr << "At this point you might want to attach a debug to " \
|
<< __LINE__ << endl << flush; \
|
||||||
<< "the running and get to the" << endl \
|
if (isatty(STDIN_FILENO)) { \
|
||||||
<< "crash site; otherwise press enter to continue" \
|
cerr << "At this point you might want to attach a debug to " \
|
||||||
<< endl \
|
<< "the running and get to the" << endl \
|
||||||
<< "PID: " << getpid() \
|
<< "crash site; otherwise press enter to continue" \
|
||||||
<< endl << flush; \
|
<< endl \
|
||||||
char c; \
|
<< "PID: " << getpid() \
|
||||||
cin.get(c); \
|
<< endl << flush; \
|
||||||
} \
|
char c; \
|
||||||
abort(); \
|
cin.get(c); \
|
||||||
} \
|
} \
|
||||||
} \
|
abort(); \
|
||||||
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define BREAK(X) do { \
|
#else
|
||||||
using namespace std; \
|
|
||||||
cerr << "breakpoint '" \
|
#define ASSERT(EXPR) do {} while (0)
|
||||||
<< #X << "' reached at fn " \
|
|
||||||
<< __PRETTY_FUNCTION__ << " in " \
|
#endif // NDEBUG
|
||||||
<< __FILE__ << ":" \
|
|
||||||
<< __LINE__ << endl << flush; \
|
|
||||||
if(isatty(STDIN_FILENO)) { \
|
|
||||||
cerr << "press enter to continue" << endl; \
|
|
||||||
cerr << "PID: " << getpid(); \
|
|
||||||
cerr << endl << flush; \
|
|
||||||
char c; \
|
|
||||||
cin.get(c); \
|
|
||||||
} \
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
#define ERROR_MSG(MESSAGE) do { \
|
#define ERROR_MSG(MESSAGE) do { \
|
||||||
using namespace std; \
|
using namespace std; \
|
||||||
|
|
|
@ -165,9 +165,11 @@ class FuncCallExprAST(ExprAST):
|
||||||
elif self.proc_name == "assert":
|
elif self.proc_name == "assert":
|
||||||
error = self.exprs[0].embedError('"assert failure"')
|
error = self.exprs[0].embedError('"assert failure"')
|
||||||
code('''
|
code('''
|
||||||
if (ASSERT_FLAG && !(${{cvec[0]}})) {
|
#ifndef NDEBUG
|
||||||
|
if (!(${{cvec[0]}})) {
|
||||||
$error
|
$error
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
''')
|
''')
|
||||||
|
|
||||||
elif self.proc_name == "continueProcessing":
|
elif self.proc_name == "continueProcessing":
|
||||||
|
|
Loading…
Reference in a new issue