[libc-commits] [libc] aeec462 - [libc][NFC] mark vprintf functions as inline

Michael Jones via libc-commits libc-commits at lists.llvm.org
Thu Jul 20 14:50:23 PDT 2023


Author: Michael Jones
Date: 2023-07-20T14:50:18-07:00
New Revision: aeec4627e6df467ecb37367d6fbb140d6c9c2e10

URL: https://github.com/llvm/llvm-project/commit/aeec4627e6df467ecb37367d6fbb140d6c9c2e10
DIFF: https://github.com/llvm/llvm-project/commit/aeec4627e6df467ecb37367d6fbb140d6c9c2e10.diff

LOG: [libc][NFC] mark vprintf functions as inline

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

Differential Revision: https://reviews.llvm.org/D155892

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/libc/src/stdio/printf_core/vfprintf_internal.h b/libc/src/stdio/printf_core/vfprintf_internal.h
index 198213c18c816e..e45189d05c88c1 100644
--- a/libc/src/stdio/printf_core/vfprintf_internal.h
+++ b/libc/src/stdio/printf_core/vfprintf_internal.h
@@ -55,7 +55,7 @@ LIBC_INLINE int fwrite_unlocked(const void *ptr, size_t size, size_t nmemb,
 
 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 @@ int file_write_hook(cpp::string_view new_str, void *fp) {
   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,


        


More information about the libc-commits mailing list