Skip to content

Commit

Permalink
Guard error operations with CPP, for easy disabling of errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
yav committed Oct 12, 2023
1 parent f0c2ca3 commit be87812
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion rts-c/ddl/parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,26 @@ 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)
void notify(ThreadId id) { suspended[id].notify(); }

// Borrows input and msg
void noteFail(bool is_sys, char const *loc, I input, Array<UInt<8>> msg) {
#ifdef DDL_ENABLE_ERRORS
error.improve(is_sys,loc,input,msg,debugs);
#endif
}

// Function calls
Expand Down

0 comments on commit be87812

Please sign in to comment.