[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 14:27:44 PDT 2022
michaelrj created this revision.
michaelrj added reviewers: sivachandra, lntue.
Herald added subscribers: libc-commits, ecnelises, tschuett, mgorny.
Herald added projects: libc-project, All.
michaelrj requested review of this revision.
In the printf_core CMake, the file pieces are defined as object
libraries that depend on the File data structure. If these are added
unconditionally they'll try to evaluate that dependancy even when there
is no File available. This patch adds a guard to prevent that error.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D131921
Files:
libc/src/stdio/printf_core/CMakeLists.txt
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.452806.patch
Type: text/x-patch
Size: 919 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20220815/4a5ce9f6/attachment.bin>
More information about the libc-commits
mailing list