mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-28 02:11:43 +00:00
[wpiutil] Upgrade to fmt 10.2.1, add wpi::print (#6161)
We now use a wrapper (wpi::print) to catch exceptions since we can't patch std::print() to not throw when we ultimately migrate to it. fmtlib and std format/print throw the same exceptions and always have. We previously patched fmt::print() to not throw a write failure exception, but we can't do that for std::print(); wpi::print() is the migration plan.
This commit is contained in:
@@ -8,10 +8,10 @@
|
||||
#include <string_view>
|
||||
#include <vector>
|
||||
|
||||
#include <fmt/format.h>
|
||||
#include <wpi/SmallVector.h>
|
||||
#include <wpi/StringExtras.h>
|
||||
#include <wpi/fs.h>
|
||||
#include <wpi/print.h>
|
||||
#include <wpi/spinlock.h>
|
||||
|
||||
#if defined(WIN32) || defined(_WIN32)
|
||||
@@ -55,7 +55,7 @@ extern "C" {
|
||||
|
||||
int HAL_LoadOneExtension(const char* library) {
|
||||
int rc = 1; // It is expected and reasonable not to find an extra simulation
|
||||
fmt::print("HAL Extensions: Attempting to load: {}\n",
|
||||
wpi::print("HAL Extensions: Attempting to load: {}\n",
|
||||
fs::path{library}.stem().string());
|
||||
std::fflush(stdout);
|
||||
HTYPE handle = DLOPEN(library);
|
||||
@@ -66,14 +66,14 @@ int HAL_LoadOneExtension(const char* library) {
|
||||
#else
|
||||
auto libraryName = fmt::format("lib{}.so", library);
|
||||
#endif
|
||||
fmt::print("HAL Extensions: Load failed: {}\nTrying modified name: {}\n",
|
||||
wpi::print("HAL Extensions: Load failed: {}\nTrying modified name: {}\n",
|
||||
DLERROR, fs::path{libraryName}.stem().string());
|
||||
std::fflush(stdout);
|
||||
handle = DLOPEN(libraryName.c_str());
|
||||
}
|
||||
#endif
|
||||
if (!handle) {
|
||||
fmt::print("HAL Extensions: Failed to load library: {}\n", DLERROR);
|
||||
wpi::print("HAL Extensions: Failed to load library: {}\n", DLERROR);
|
||||
std::fflush(stdout);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include <cstdio>
|
||||
#include <thread>
|
||||
|
||||
#include <fmt/format.h>
|
||||
#include <wpi/print.h>
|
||||
#include <wpi/timestamp.h>
|
||||
|
||||
#include "MockHooksInternal.h"
|
||||
@@ -84,7 +84,7 @@ void HALSIM_WaitForProgramStart(void) {
|
||||
int count = 0;
|
||||
while (!programStarted) {
|
||||
count++;
|
||||
fmt::print("Waiting for program start signal: {}\n", count);
|
||||
wpi::print("Waiting for program start signal: {}\n", count);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(500));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user