diff --git a/libc/src/stdio/printf_core/CMakeLists.txt b/libc/src/stdio/printf_core/CMakeLists.txt --- a/libc/src/stdio/printf_core/CMakeLists.txt +++ b/libc/src/stdio/printf_core/CMakeLists.txt @@ -31,17 +31,6 @@ .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 @@ 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 --- 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, 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, 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;