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

@@ -16,7 +16,7 @@ int GetThreadPriority(std::thread& thread, bool* isRealTime) {
HAL_Bool rt = false;
auto native = thread.native_handle();
auto ret = HAL_GetThreadPriority(&native, &rt, &status);
FRC_CheckErrorStatus(status, "{}", "GetThreadPriority");
FRC_CheckErrorStatus(status, "GetThreadPriority");
*isRealTime = rt;
return ret;
}
@@ -25,7 +25,7 @@ int GetCurrentThreadPriority(bool* isRealTime) {
int32_t status = 0;
HAL_Bool rt = false;
auto ret = HAL_GetCurrentThreadPriority(&rt, &status);
FRC_CheckErrorStatus(status, "{}", "GetCurrentThreadPriority");
FRC_CheckErrorStatus(status, "GetCurrentThreadPriority");
*isRealTime = rt;
return ret;
}
@@ -34,14 +34,14 @@ bool SetThreadPriority(std::thread& thread, bool realTime, int priority) {
int32_t status = 0;
auto native = thread.native_handle();
auto ret = HAL_SetThreadPriority(&native, realTime, priority, &status);
FRC_CheckErrorStatus(status, "{}", "SetThreadPriority");
FRC_CheckErrorStatus(status, "SetThreadPriority");
return ret;
}
bool SetCurrentThreadPriority(bool realTime, int priority) {
int32_t status = 0;
auto ret = HAL_SetCurrentThreadPriority(realTime, priority, &status);
FRC_CheckErrorStatus(status, "{}", "SetCurrentThreadPriority");
FRC_CheckErrorStatus(status, "SetCurrentThreadPriority");
return ret;
}