mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
Better
This commit is contained in:
parent
2781224d7a
commit
f3f1f611a4
@ -108,16 +108,22 @@
|
||||
{
|
||||
[[noreturn]] void abortOnFailedAssertion(const String & description);
|
||||
}
|
||||
#define chassert(x) do { static_cast<bool>(x) ? void(0) : ::DB::abortOnFailedAssertion(#x); } while (0)
|
||||
#define chassert_1(x, ...) do { static_cast<bool>(x) ? void(0) : ::DB::abortOnFailedAssertion(#x); } while (0)
|
||||
#define chassert_2(x, comment, ...) do { static_cast<bool>(x) ? void(0) : ::DB::abortOnFailedAssertion(comment); } while (0)
|
||||
#define UNREACHABLE() abort()
|
||||
// clang-format off
|
||||
#else
|
||||
/// Here sizeof() trick is used to suppress unused warning for result,
|
||||
/// since simple "(void)x" will evaluate the expression, while
|
||||
/// "sizeof(!(x))" will not.
|
||||
#define chassert(x) (void)sizeof(!(x))
|
||||
#define chassert_1(x, ...) (void)sizeof(!(x))
|
||||
#define chassert_2(x, comment, ...) (void)sizeof(!(x))
|
||||
#define UNREACHABLE() __builtin_unreachable()
|
||||
#endif
|
||||
#define CHASSERT_IMPL(_1,_2, N,...) N(_1, _2)
|
||||
#define CHASSERT_IMPL_(tuple) CHASSERT_IMPL tuple
|
||||
#define chassert(...) CHASSERT_IMPL_((__VA_ARGS__, chassert_2, chassert_1))
|
||||
|
||||
#endif
|
||||
|
||||
/// Macros for Clang Thread Safety Analysis (TSA). They can be safely ignored by other compilers.
|
||||
|
@ -61,6 +61,7 @@ protected:
|
||||
settings.ostr << '.';
|
||||
}
|
||||
|
||||
chassert(table != nullptr, "Table is empty for the ASTQueryWithTableAndOutputImpl.");
|
||||
table->formatImpl(settings, state, frame);
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user