Enable log macros to work with no args (#4475)

This is enabled by the C++20 __VA_OPT__ feature.
Uses of "{}" format string were updated.
Some warning suppressions were required for older clang versions.
Also improve codegen of wpi::Logger::Log(), frc::ReportError(), and frc::MakeError();
these generate better and less redundant code if they use fmt::string_view for the
format string instead of templating on it.
This commit is contained in:
Tyler Veness
2022-10-19 10:49:27 -07:00
committed by GitHub
parent 878cc8defb
commit 1fc098e696
70 changed files with 373 additions and 338 deletions

View File

@@ -171,7 +171,7 @@ void CImpl::ProcessIncomingBinary(std::span<const uint8_t> data) {
}
void CImpl::HandleLocal(std::vector<ClientMessage>&& msgs) {
DEBUG4("{}", "HandleLocal()");
DEBUG4("HandleLocal()");
for (auto&& elem : msgs) {
// common case is value
if (auto msg = std::get_if<ClientValueMsg>(&elem.contents)) {

View File

@@ -45,7 +45,7 @@ void NetworkLoopQueue::SetValue(NT_Publisher pubHandle, const Value& value) {
m_size += sizeof(ClientMessage);
if (m_size > kMaxSize) {
if (!m_sizeErrored) {
WPI_ERROR(m_logger, "{}", "NT: dropping value set due to memory limits");
WPI_ERROR(m_logger, "NT: dropping value set due to memory limits");
m_sizeErrored = true;
}
return; // avoid potential out of memory

View File

@@ -758,7 +758,7 @@ void ClientDataLocal::SendPropertiesUpdate(TopicData* topic,
}
void ClientDataLocal::HandleLocal(std::span<const ClientMessage> msgs) {
DEBUG4("{}", "HandleLocal()");
DEBUG4("HandleLocal()");
// just map as a normal client into client=0 calls
for (const auto& elem : msgs) { // NOLINT
// common case is value, so check that first
@@ -2145,7 +2145,7 @@ void SImpl::UpdateMetaClients(const std::vector<ConnectionInfo>& conns) {
if (mpack_writer_destroy(&w) == mpack_ok) {
SetValue(nullptr, m_metaClients, Value::MakeRaw(std::move(w.bytes)));
} else {
DEBUG4("{}", "failed to encode $clients");
DEBUG4("failed to encode $clients");
}
}

View File

@@ -119,7 +119,7 @@ static void WireDecodeTextImpl(std::string_view in, T& out,
}
if (!j.is_array()) {
WPI_WARNING(logger, "{}", "expected JSON array at top level");
WPI_WARNING(logger, "expected JSON array at top level");
return;
}