diff --git a/libc/src/stdio/printf_core/vasprintf_internal.h b/libc/src/stdio/printf_core/vasprintf_internal.h index 9d46617da7751..283d8df2810fb 100644 --- a/libc/src/stdio/printf_core/vasprintf_internal.h +++ b/libc/src/stdio/printf_core/vasprintf_internal.h @@ -10,7 +10,6 @@ #include "hdr/func/malloc.h" #include "hdr/func/realloc.h" #include "src/__support/arg_list.h" -#include "src/stdio/printf.h" #include "src/stdio/printf_core/core_structs.h" #include "src/stdio/printf_core/printf_main.h" #include "src/stdio/printf_core/writer.h" diff --git a/libc/test/src/stdio/CMakeLists.txt b/libc/test/src/stdio/CMakeLists.txt index 4aa8b95880018..eec108bc12ca5 100644 --- a/libc/test/src/stdio/CMakeLists.txt +++ b/libc/test/src/stdio/CMakeLists.txt @@ -270,7 +270,6 @@ add_libc_test( libc.src.stdio.vasprintf libc.src.string.memset libc.include.stdlib - libc.src.stdio.sprintf ) if(LLVM_LIBC_FULL_BUILD) diff --git a/libc/test/src/stdio/asprintf_test.cpp b/libc/test/src/stdio/asprintf_test.cpp index 9292cebb80e24..0222742170860 100644 --- a/libc/test/src/stdio/asprintf_test.cpp +++ b/libc/test/src/stdio/asprintf_test.cpp @@ -76,6 +76,7 @@ TEST(LlvmLibcASPrintfTest, LargeStringNoConv) { TEST(LlvmLibcASPrintfTest, ManyReAlloc) { char *buff = nullptr; char long_str[1001]; + // TODO: simplify test to match with vasprintf_test auto expected_num_chars = LIBC_NAMESPACE::sprintf(long_str, "%200s%200s%200s", "a", "b", "c"); long_str[expected_num_chars] = '\0'; diff --git a/libc/test/src/stdio/vasprintf_test.cpp b/libc/test/src/stdio/vasprintf_test.cpp index 2eb1be3d7a9bf..72d7165aa800a 100644 --- a/libc/test/src/stdio/vasprintf_test.cpp +++ b/libc/test/src/stdio/vasprintf_test.cpp @@ -6,7 +6,6 @@ // //===----------------------------------------------------------------------===// -#include "src/stdio/sprintf.h" #include "src/stdio/vasprintf.h" #include "src/string/memset.h" #include "test/UnitTest/Test.h" diff --git a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel index d9b1bb5635aaf..79ea0e181f453 100644 --- a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel +++ b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel @@ -6113,6 +6113,31 @@ libc_support_library( ], ) +libc_support_library( + name = "vasprintf_internal", + hdrs = ["src/stdio/printf_core/vasprintf_internal.h"], + deps = [ + ":__support_arg_list", + ":__support_macros_attributes", + ":func_free", + ":func_malloc", + ":func_realloc", + ":printf_main", + ":printf_writer", + ":types_FILE", + ], +) + +libc_function( + name = "asprintf", + srcs = ["src/stdio/asprintf.cpp"], + hdrs = ["src/stdio/asprintf.h"], + deps = [ + ":__support_arg_list", + ":vasprintf_internal", + ], +) + libc_function( name = "sprintf", srcs = ["src/stdio/sprintf.cpp"], @@ -6164,6 +6189,16 @@ libc_function( ], ) +libc_function( + name = "vasprintf", + srcs = ["src/stdio/vasprintf.cpp"], + hdrs = ["src/stdio/vasprintf.h"], + deps = [ + ":__support_arg_list", + ":vasprintf_internal", + ], +) + libc_function( name = "vsprintf", srcs = ["src/stdio/vsprintf.cpp"], diff --git a/utils/bazel/llvm-project-overlay/libc/test/src/stdio/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/test/src/stdio/BUILD.bazel index 505b73fd77111..d06fe7bab72e7 100644 --- a/utils/bazel/llvm-project-overlay/libc/test/src/stdio/BUILD.bazel +++ b/utils/bazel/llvm-project-overlay/libc/test/src/stdio/BUILD.bazel @@ -47,6 +47,16 @@ libc_test( ], ) +libc_test( + name = "asprintf_test", + srcs = ["asprintf_test.cpp"], + deps = [ + "//libc:asprintf", + "//libc:memset", + "//libc:sprintf", + ], +) + libc_test( name = "sprintf_test", srcs = ["sprintf_test.cpp"], @@ -81,6 +91,15 @@ libc_test( ], ) +libc_test( + name = "vasprintf_test", + srcs = ["vasprintf_test.cpp"], + deps = [ + "//libc:memset", + "//libc:vasprintf", + ], +) + libc_test( name = "vsprintf_test", srcs = ["vsprintf_test.cpp"],