[libc-commits] [PATCH] D146001: [libc] enable printf using system FILE

Michael Jones via Phabricator via libc-commits libc-commits at lists.llvm.org
Thu Mar 16 15:44:16 PDT 2023


michaelrj added inline comments.


================
Comment at: libc/src/stdio/printf.cpp:31
+#ifndef LIBC_COPT_PRINTF_USE_PUBLIC_FILE
   int ret_val = printf_core::vfprintf_internal(
       reinterpret_cast<::FILE *>(__llvm_libc::stdout), format, args);
----------------
sivachandra wrote:
> Have you considered making `vfprintf_internal` a template function which takes a suitable `FileWriter` object? The goal should be to confine `#ifdef` to only one place in the code. Since only one of the templates will get instantiated, it will not lead to code size bloat.
`vfprintf_internal` already doesn't have this `#ifdef`, this condition only changes where the stdout comes from. I've changed the code to clarify that.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D146001/new/

https://reviews.llvm.org/D146001



More information about the libc-commits mailing list