[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:
Tyler Veness
2024-05-12 06:25:42 -07:00
committed by GitHub
parent 6c9dcc157e
commit d88c71ffdc
99 changed files with 1374 additions and 1130 deletions

View File

@@ -15,14 +15,13 @@
#include <utility>
#include <vector>
#include <fmt/core.h>
#include "wpi/ConvertUTF.h"
#include "wpi/SafeThread.h"
#include "wpi/SmallString.h"
#include "wpi/SmallVector.h"
#include "wpi/StringExtras.h"
#include "wpi/mutex.h"
#include "wpi/print.h"
#include "wpi/raw_ostream.h"
/** Java Native Interface (JNI) utility functions */
@@ -160,7 +159,7 @@ class JStringRef {
env->ReleaseStringCritical(str, chars);
}
} else {
fmt::print(stderr, "JStringRef was passed a null pointer at\n",
wpi::print(stderr, "JStringRef was passed a null pointer at\n",
GetJavaStackTrace(env));
}
// Ensure str is null-terminated.
@@ -283,7 +282,7 @@ class JSpanBase {
m_elements{static_cast<std::remove_cv_t<T>*>(
bb ? env->GetDirectBufferAddress(bb) : nullptr)} {
if (!bb) {
fmt::print(stderr, "JSpan was passed a null pointer at\n",
wpi::print(stderr, "JSpan was passed a null pointer at\n",
GetJavaStackTrace(env));
}
}
@@ -302,7 +301,7 @@ class JSpanBase {
m_elements = ArrHelper::GetArrayElements(env, jarr);
}
} else {
fmt::print(stderr, "JSpan was passed a null pointer at\n",
wpi::print(stderr, "JSpan was passed a null pointer at\n",
GetJavaStackTrace(env));
}
}