From 9309bbfbf867a405087b4bea15d17d80b2eb8048 Mon Sep 17 00:00:00 2001 From: Ari Lazier Date: Wed, 11 Nov 2015 13:57:05 -0800 Subject: [PATCH] make precondition a macro --- src/object-store/parser/query_builder.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/object-store/parser/query_builder.cpp b/src/object-store/parser/query_builder.cpp index f1bbb9d4..5afdfcb9 100644 --- a/src/object-store/parser/query_builder.cpp +++ b/src/object-store/parser/query_builder.cpp @@ -32,12 +32,7 @@ using namespace parser; // check a precondition and throw an exception if it is not met // this should be used iff the condition being false indicates a bug in the caller // of the function checking its preconditions -static void precondition(bool condition, const std::string message) { - if (__builtin_expect(condition, 1)) { - return; - } - throw std::runtime_error(message); -} +#define precondition(condition, message) if (!__builtin_expect(condition, 1)) { throw std::runtime_error(message); } // FIXME: TrueExpression and FalseExpression should be supported by core in some way struct TrueExpression : realm::Expression {