[libc-commits] [libc] [libc] Support %lc in printf (PR #169983)

Alexey Samsonov via libc-commits libc-commits at lists.llvm.org
Sat Dec 27 10:21:32 PST 2025


================
@@ -173,7 +177,15 @@ template <typename ArgProvider> class Parser {
         section.has_conv = true;
         break;
       case ('c'):
-        WRITE_ARG_VAL_SIMPLEST(section.conv_val_raw, int, conv_index);
+        if (section.length_modifier == LengthModifier::l) {
+#ifndef LIBC_COPT_PRINTF_DISABLE_WIDE
----------------
vonosmas wrote:

I would defer to @michaelrj-google , but as an option, you can create a typedef based on compile options for the type of the argument to simplify further:

Above you can have:

```c++
#ifdef LIBC_COPT_PRINTF_DISABLE_WIDE
using WideCharArgType = int;
#else
#include "hdr/types/wint_t.h"
using WideCharArgType = wint_t;
#endif
```

and then use `WideCharArgType` here and in a similar function below.

https://github.com/llvm/llvm-project/pull/169983


More information about the libc-commits mailing list