2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Select exception users in EditPrivacyBox.

This commit is contained in:
John Preston
2017-03-17 15:05:50 +03:00
parent 85fd117675
commit 61c5b45d7a
17 changed files with 622 additions and 227 deletions

View File

@@ -71,14 +71,13 @@ using alignment = std::max_align_t;
template <typename Lambda>
constexpr bool is_large = (sizeof(std::decay_t<Lambda>) > kStorageSize);
inline void bad_construct_copy(void *lambda, const void *source) {
t_assert(!"base::lambda bad_construct_copy() called!");
[[noreturn]] inline void bad_construct_copy(void *lambda, const void *source) {
Unexpected("base::lambda bad_construct_copy() called!");
}
template <typename Return, typename ...Args>
Return bad_const_call(const void *lambda, Args...) {
t_assert(!"base::lambda bad_const_call() called!");
return Return();
[[noreturn]] Return bad_const_call(const void *lambda, Args...) {
Unexpected("base::lambda bad_const_call() called!");
}
template <typename Return, typename ...Args>

View File

@@ -29,13 +29,17 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
// Release build assertions.
inline void t_noop() {
}
inline void t_assert_fail(const char *message, const char *file, int32 line) {
[[noreturn]] inline void t_assert_fail(const char *message, const char *file, int32 line) {
auto info = qsl("%1 %2:%3").arg(message).arg(file).arg(line);
LOG(("Assertion Failed! ") + info);
SignalHandlers::setCrashAnnotation("Assertion", info);
// Crash with access violation and generate crash report.
volatile int *t_assert_nullptr = nullptr;
*t_assert_nullptr = 0;
// Silent the possible failure to comply noreturn warning.
std::abort();
}
#define t_assert_full(condition, message, file, line) ((GSL_UNLIKELY(!(condition))) ? t_assert_fail(message, file, line) : t_noop())
#define t_assert_c(condition, comment) t_assert_full(condition, "\"" #condition "\" (" comment ")", __FILE__, __LINE__)
@@ -45,13 +49,18 @@ inline void t_assert_fail(const char *message, const char *file, int32 line) {
// Let them crash with reports and logging.
#ifdef Expects
#undef Expects
#define Expects(condition) t_assert_full(condition, "\"" #condition "\"", __FILE__, __LINE__)
#endif // Expects
#define Expects(condition) t_assert_full(condition, "\"" #condition "\"", __FILE__, __LINE__)
#ifdef Ensures
#undef Ensures
#define Ensures(condition) t_assert_full(condition, "\"" #condition "\"", __FILE__, __LINE__)
#endif // Ensures
#define Ensures(condition) t_assert_full(condition, "\"" #condition "\"", __FILE__, __LINE__)
#ifdef Unexpected
#undef Unexpected
#endif // Unexpected
#define Unexpected(message) t_assert_fail("Unexpected: " message, __FILE__, __LINE__)
// Define specializations for QByteArray for Qt 5.3.2, because
// QByteArray in Qt 5.3.2 doesn't declare "pointer" subtype.