[libc-commits] [libc] [libc] Template the writing mode for the writer class (PR #111559)

Joseph Huber via libc-commits libc-commits at lists.llvm.org
Wed Feb 19 11:17:06 PST 2025


jhuber6 wrote:

> From the most recent libc meeting I've been convinced that this patch is useful and we should move forward with it.
> 
> That being said there are some changes that to make before it lands:
> 
>     1. Rebase and update the `strftime` internals, since those use the printf writer.
> 
>     2. Create a template of `Writer` and `WriteBuffer` that does runtime dispatch based on an enum.
> 
>     3. Create a compile flag that switches `printf_main` to take a specific templated writer and create a runtime dispatch version of it. 
> What do you think of this as a plan to move forward?

Does this address your concerns with binary bloat? This would allow me to move some of these into `shared/` under a non-exported interface so I could then remove the weird GPU loader / exporting to offload situation as well. Plus, i think some people would like to use the `printf` internals in other places. (Is anything in shared/ besides rpc.h intended to be installed? If it's just for cross-project like libc++, clang, and offload then it should be fine to put whatever we want there with the right controls.)

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


More information about the libc-commits mailing list