[libc-commits] [libc] [libc] Add a "Q" length modifier to support __float128 in printf (PR #199110)
Michael Jones via libc-commits
libc-commits at lists.llvm.org
Fri May 22 11:14:34 PDT 2026
================
@@ -1521,9 +1635,26 @@ TEST(LlvmLibcSPrintfTest, FloatDecimalConv) {
ASSERT_STREQ_LEN(written, buff, "+0.126 0001256.000");
}
+template <typename T, char M> struct TypeAndLengthModifier {
+ using Type = T;
+ constexpr static char kCharValue = M;
+};
+
+#if defined(LIBC_SPRINTF_TEST_Q_MODIFIER)
+using LongDoubleFloat128TypesAndModifiers =
+ LIBC_NAMESPACE::testing::TypeList<TypeAndLengthModifier<long double, 'L'>,
+ TypeAndLengthModifier<float128, 'Q'>>;
+#else
+using LongDoubleFloat128TypesAndModifiers =
+ LIBC_NAMESPACE::testing::TypeList<TypeAndLengthModifier<long double, 'L'>>;
+#endif // LIBC_SPRINTF_TEST_Q_MODIFIER
----------------
michaelrj-google wrote:
I don't think it's necessary to replace the `L` with a `Q`. It would be simpler to have separate tests for the `Q` cases.
https://github.com/llvm/llvm-project/pull/199110
More information about the libc-commits
mailing list