diff --git a/libc/src/stdio/printf_core/CMakeLists.txt b/libc/src/stdio/printf_core/CMakeLists.txt index 5ab0bc6d29f6..9c7a9fbe9c5a 100644 --- a/libc/src/stdio/printf_core/CMakeLists.txt +++ b/libc/src/stdio/printf_core/CMakeLists.txt @@ -31,17 +31,6 @@ add_object_library( .core_structs ) -add_object_library( - file_writer - SRCS - file_writer.cpp - HDRS - file_writer.h - DEPENDS - libc.src.__support.File.file - .core_structs -) - add_object_library( writer SRCS @@ -91,6 +80,23 @@ add_object_library( libc.src.__support.arg_list ) +if(NOT (TARGET libc.src.__support.File.file)) + # Not all platforms have a file implementation. If file is unvailable, + # then we must skip all file based printf sections. + return() +endif() + +add_object_library( + file_writer + SRCS + file_writer.cpp + HDRS + file_writer.h + DEPENDS + libc.src.__support.File.file + .core_structs +) + add_object_library( vfprintf_internal SRCS diff --git a/libc/test/src/stdio/printf_core/parser_test.cpp b/libc/test/src/stdio/printf_core/parser_test.cpp index c6ec04a0e7d2..c9cc1c2f3c58 100644 --- a/libc/test/src/stdio/printf_core/parser_test.cpp +++ b/libc/test/src/stdio/printf_core/parser_test.cpp @@ -191,7 +191,7 @@ TEST(LlvmLibcPrintfParserTest, EvalOneArgWithShortLengthModifier) { TEST(LlvmLibcPrintfParserTest, EvalOneArgWithLongLengthModifier) { __llvm_libc::printf_core::FormatSection format_arr[10]; const char *str = "%lld"; - int arg1 = 12345; + long long arg1 = 12345; evaluate(format_arr, str, arg1); __llvm_libc::printf_core::FormatSection expected; @@ -208,7 +208,7 @@ TEST(LlvmLibcPrintfParserTest, EvalOneArgWithLongLengthModifier) { TEST(LlvmLibcPrintfParserTest, EvalOneArgWithAllOptions) { __llvm_libc::printf_core::FormatSection format_arr[10]; const char *str = "% -056.78jd"; - int arg1 = 12345; + intmax_t arg1 = 12345; evaluate(format_arr, str, arg1); __llvm_libc::printf_core::FormatSection expected;