[libc-commits] [PATCH] D155892: [libc][NFC] mark vprintf functions as inline

Michael Jones via Phabricator via libc-commits libc-commits at lists.llvm.org
Thu Jul 20 14:49:10 PDT 2023


michaelrj created this revision.
Herald added projects: libc-project, All.
Herald added a subscriber: libc-commits.
michaelrj requested review of this revision.
Herald added a subscriber: wangpc.

The functions are in a header, and so must be marked inline to avoid
symbol conflicts.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D155892

Files:
  libc/src/stdio/printf_core/vfprintf_internal.h


Index: libc/src/stdio/printf_core/vfprintf_internal.h
===================================================================
--- libc/src/stdio/printf_core/vfprintf_internal.h
+++ libc/src/stdio/printf_core/vfprintf_internal.h
@@ -55,7 +55,7 @@
 
 namespace printf_core {
 
-int file_write_hook(cpp::string_view new_str, void *fp) {
+LIBC_INLINE int file_write_hook(cpp::string_view new_str, void *fp) {
   ::FILE *target_file = reinterpret_cast<::FILE *>(fp);
   // Write new_str to the target file. The logic preventing a zero-length write
   // is in the writer, so we don't check here.
@@ -66,8 +66,9 @@
   return WRITE_OK;
 }
 
-int vfprintf_internal(::FILE *__restrict stream, const char *__restrict format,
-                      internal::ArgList &args) {
+LIBC_INLINE int vfprintf_internal(::FILE *__restrict stream,
+                                  const char *__restrict format,
+                                  internal::ArgList &args) {
   constexpr size_t BUFF_SIZE = 1024;
   char buffer[BUFF_SIZE];
   printf_core::WriteBuffer wb(buffer, BUFF_SIZE, &file_write_hook,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D155892.542688.patch
Type: text/x-patch
Size: 1084 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20230720/2e3c3c1c/attachment.bin>


More information about the libc-commits mailing list