[libc-commits] [PATCH] D131921: [libc] add guard for file pieces of printf
Michael Jones via Phabricator via libc-commits
libc-commits at lists.llvm.org
Mon Aug 15 15:43:07 PDT 2022
michaelrj updated this revision to Diff 452828.
michaelrj added a comment.
This new version passes on arm32. There was a minor failure caused by type issues in parser_test.cpp that's also being fixed.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D131921/new/
https://reviews.llvm.org/D131921
Files:
libc/src/stdio/printf_core/CMakeLists.txt
libc/test/src/stdio/printf_core/parser_test.cpp
Index: libc/test/src/stdio/printf_core/parser_test.cpp
===================================================================
--- libc/test/src/stdio/printf_core/parser_test.cpp
+++ 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;
Index: libc/src/stdio/printf_core/CMakeLists.txt
===================================================================
--- libc/src/stdio/printf_core/CMakeLists.txt
+++ 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D131921.452828.patch
Type: text/x-patch
Size: 1774 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20220815/30ca8e05/attachment.bin>
More information about the libc-commits
mailing list