/* * Copyright 2006 The WebRTC Project Authors. All rights reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. An additional intellectual property rights grant can be found * in the file PATENTS. All contributing project authors may * be found in the AUTHORS file in the root of the source tree.
*/
// Most of this was borrowed (with minor modifications) from V8's and Chromium's // src/base/logging.cc.
#if RTC_CHECK_MSG_ENABLED // Reads one argument from args, appends it to s and advances fmt. // Returns true iff an argument was sucessfully parsed. bool ParseArg(va_list* args, const CheckArgType** fmt, std::string* s) { if (**fmt == CheckArgType::kEnd) returnfalse;
switch (**fmt) { case CheckArgType::kInt:
AppendFormat(s, "%d", va_arg(*args, int)); break; case CheckArgType::kLong:
AppendFormat(s, "%ld", va_arg(*args, long)); break; case CheckArgType::kLongLong:
AppendFormat(s, "%lld", va_arg(*args, longlong)); break; case CheckArgType::kUInt:
AppendFormat(s, "%u", va_arg(*args, unsigned)); break; case CheckArgType::kULong:
AppendFormat(s, "%lu", va_arg(*args, unsignedlong)); break; case CheckArgType::kULongLong:
AppendFormat(s, "%llu", va_arg(*args, unsignedlonglong)); break; case CheckArgType::kDouble:
AppendFormat(s, "%g", va_arg(*args, double)); break; case CheckArgType::kLongDouble:
AppendFormat(s, "%Lg", va_arg(*args, longdouble)); break; case CheckArgType::kCharP:
s->append(va_arg(*args, constchar*)); break; case CheckArgType::kStdString:
s->append(*va_arg(*args, const std::string*)); break; case CheckArgType::kStringView: { const absl::string_view sv = *va_arg(*args, const absl::string_view*);
s->append(sv.data(), sv.size()); break;
} case CheckArgType::kVoidP:
AppendFormat(s, "%p", va_arg(*args, constvoid*)); break; default:
s->append("[Invalid CheckArgType]"); returnfalse;
}
(*fmt)++; returntrue;
}
std::string s;
AppendFormat(&s, "\n\n" "#\n" "# Fatal error in: %s, line %d\n" "# last system error: %u\n" "# Check failed: %s",
file, line, LAST_SYSTEM_ERROR, message);
if (*fmt == CheckArgType::kCheckOp) { // This log message was generated by RTC_CHECK_OP, so we have to complete // the error message using the operands that have been passed as the first // two arguments.
fmt++;
// Function to call from the C version of the RTC_CHECK and RTC_DCHECK macros.
RTC_NORETURN void rtc_FatalMessage(constchar* file, int line, constchar* msg) { #if RTC_CHECK_MSG_ENABLED static constexpr rtc::webrtc_checks_impl::CheckArgType t[] = {
rtc::webrtc_checks_impl::CheckArgType::kEnd};
rtc::webrtc_checks_impl::FatalLog(file, line, msg, t); #else
rtc::webrtc_checks_impl::FatalLog(file, line); #endif
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.