mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
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:
@@ -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)) {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user