From be878126a8177a9b1ed56c98c1ec59b030642f22 Mon Sep 17 00:00:00 2001 From: Iavor Diatchki Date: Thu, 12 Oct 2023 10:14:17 -0700 Subject: [PATCH] Guard error operations with CPP, for easy disabling of errors. --- rts-c/ddl/parser.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/rts-c/ddl/parser.h b/rts-c/ddl/parser.h index f3cafb28..64d50c84 100644 --- a/rts-c/ddl/parser.h +++ b/rts-c/ddl/parser.h @@ -46,9 +46,16 @@ class ParserState { void say(const char *msg) { debugLine(msg); } void pushDebug(char const* msg, bool tail = false) { +#ifdef DDL_ENABLE_ERRORS if (tail) debugs.tailCallFun(msg); else debugs.callFun(msg); +#endif + } + + void popDebug() { +#ifdef DDL_ENABLE_ERRORS + debugs.popFun(); +#endif } - void popDebug() { debugs.popFun(); } // Set the "sibling failied" flag in the given thread. // Assumes: valid id (i.e., thread has not been resumed) @@ -56,7 +63,9 @@ class ParserState { // Borrows input and msg void noteFail(bool is_sys, char const *loc, I input, Array> msg) { +#ifdef DDL_ENABLE_ERRORS error.improve(is_sys,loc,input,msg,debugs); +#endif } // Function calls