[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:35 PDT 2026
================
@@ -254,12 +265,22 @@ template <typename ArgProvider> class Parser {
case ('A'):
case ('g'):
case ('G'):
- if (lm != LengthModifier::L) {
- WRITE_ARG_VAL_SIMPLEST(section.conv_val_raw, double, conv_index);
- } else {
+#if defined(LIBC_TYPES_HAS_FLOAT128)
+ if (lm == LengthModifier::Q) {
+#if !defined(LIBC_COPT_PRINTF_DISABLE_Q_LENGTH_MODIFIER)
+ WRITE_ARG_VAL_SIMPLEST(section.conv_val_raw, float128, conv_index);
+#else
+ section.has_conv = false;
+#endif // LIBC_COPT_PRINTF_DISABLE_Q_LENGTH_MODIFIER
----------------
michaelrj-google wrote:
it might be useful to simplify this by defining a single constant in `printf_config.h` that represents both "we have float128" and "Q is not disabled", similar to what we do with fixed point (see `LIBC_INTERNAL_PRINTF_HAS_FIXED_POINT`).
https://github.com/llvm/llvm-project/pull/199110
More information about the libc-commits
mailing list