Made error checking macros less prone to clashes.

Change-Id: Ieb252ce01446551699d935507bc95ee286fe1ddd
Tested: on Linux.
This commit is contained in:
Wouter van Oortmerssen
2015-12-29 16:33:00 -08:00
parent 1891537236
commit 451272b618
2 changed files with 48 additions and 36 deletions

View File

@@ -43,7 +43,13 @@ static_assert(BASE_TYPE_UNION ==
static_cast<BaseType>(reflection::Union),
"enums don't match");
// Any parsing calls have to be wrapped in this macro, which automates
// handling of recursive error checking a bit. It will check the received
// CheckedError object, and return straight away on error.
#define ECHECK(call) { auto ce = (call); if (ce.Check()) return ce; }
// These two functions are called hundreds of times below, so define a short
// form:
#define NEXT() ECHECK(Next())
#define EXPECT(tok) ECHECK(Expect(tok))