changeset 4d08da8cab3c in /z/repo/m5
details: http://repo.m5sim.org/m5?cmd=changeset;node=4d08da8cab3c
description:
Merge.
diffstat:
src/mem/ruby/common/Debug.hh | 81 ++++++++++++++---------------------
src/mem/slicc/ast/FuncCallExprAST.py | 4 +-
2 files changed, 36 insertions(+), 49 deletions(-)
diffs (112 lines):
diff -r 8a7ba5a1b35d -r 4d08da8cab3c src/mem/ruby/common/Debug.hh
--- a/src/mem/ruby/common/Debug.hh Wed Dec 08 10:55:33 2010 -0800
+++ b/src/mem/ruby/common/Debug.hh Wed Dec 08 16:52:38 2010 -0800
@@ -122,59 +122,44 @@
const bool ERROR_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
#define assert(EXPR) ASSERT(EXPR)
#undef ASSERT
-#define ASSERT(EXPR) do { \
- using namespace std; \
- if (ASSERT_FLAG) { \
- if (!(EXPR)) { \
- cerr << "failed assertion '" \
- << #EXPR << "' at fn " \
- << __PRETTY_FUNCTION__ << " in " \
- << __FILE__ << ":" \
- << __LINE__ << endl << flush; \
- (*debug_cout_ptr) << "failed assertion '" \
- << #EXPR << "' at fn " \
- << __PRETTY_FUNCTION__ << " in " \
- << __FILE__ << ":" \
- << __LINE__ << endl << flush; \
- if (isatty(STDIN_FILENO)) { \
- cerr << "At this point you might want to attach a debug to " \
- << "the running and get to the" << endl \
- << "crash site; otherwise press enter to continue" \
- << endl \
- << "PID: " << getpid() \
- << endl << flush; \
- char c; \
- cin.get(c); \
- } \
- abort(); \
- } \
- } \
+
+#ifndef NDEBUG
+
+#define ASSERT(EXPR) do { \
+ using namespace std; \
+ if (!(EXPR)) { \
+ cerr << "failed assertion '" \
+ << #EXPR << "' at fn " \
+ << __PRETTY_FUNCTION__ << " in " \
+ << __FILE__ << ":" \
+ << __LINE__ << endl << flush; \
+ (*debug_cout_ptr) << "failed assertion '" \
+ << #EXPR << "' at fn " \
+ << __PRETTY_FUNCTION__ << " in " \
+ << __FILE__ << ":" \
+ << __LINE__ << endl << flush; \
+ if (isatty(STDIN_FILENO)) { \
+ cerr << "At this point you might want to attach a debug to " \
+ << "the running and get to the" << endl \
+ << "crash site; otherwise press enter to continue" \
+ << endl \
+ << "PID: " << getpid() \
+ << endl << flush; \
+ char c; \
+ cin.get(c); \
+ } \
+ abort(); \
+ } \
} while (0)
-#define BREAK(X) do { \
- using namespace std; \
- cerr << "breakpoint '" \
- << #X << "' reached at fn " \
- << __PRETTY_FUNCTION__ << " in " \
- << __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)
+#else
+
+#define ASSERT(EXPR) do {} while (0)
+
+#endif // NDEBUG
#define ERROR_MSG(MESSAGE) do { \
using namespace std; \
diff -r 8a7ba5a1b35d -r 4d08da8cab3c src/mem/slicc/ast/FuncCallExprAST.py
--- a/src/mem/slicc/ast/FuncCallExprAST.py Wed Dec 08 10:55:33 2010 -0800
+++ b/src/mem/slicc/ast/FuncCallExprAST.py Wed Dec 08 16:52:38 2010 -0800
@@ -165,9 +165,11 @@
elif self.proc_name == "assert":
error = self.exprs[0].embedError('"assert failure"')
code('''
-if (ASSERT_FLAG && !(${{cvec[0]}})) {
+#ifndef NDEBUG
+if (!(${{cvec[0]}})) {
$error
}
+#endif
''')
elif self.proc_name == "continueProcessing":
_______________________________________________
m5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/m5-dev