Skip to content

Commit 3fad640

Browse files
[libc] Skip scanf internals when no file available (#128097)
A temporary fix based on discussions in #128079 Currently, baremetal targets are failing to build because the scanf internals require FILE* (either from the system's libc or our libc). Normally we'd just turn off the broken entrypoint, but since the scanf internals are built separately that doesn't work. This patch adds extra conditions to building those internals, which we can hopefully remove once we have a proper way to build scanf for embedded.
1 parent c0a6f7a commit 3fad640

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

libc/src/stdio/scanf_core/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,12 @@ add_header_library(
5454
libc.src.__support.CPP.string_view
5555
)
5656

57+
if(NOT(TARGET libc.src.__support.File.file) AND LLVM_LIBC_FULL_BUILD)
58+
# Not all platforms have a file implementation. If file is unvailable, and a
59+
# full build is requested, then we must skip all file based scanf sections.
60+
return()
61+
endif()
62+
5763
add_object_library(
5864
scanf_main
5965
SRCS

libc/test/src/stdio/scanf_core/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@ add_libc_unittest(
1818
libc.src.__support.arg_list
1919
)
2020

21+
if(NOT(TARGET libc.src.__support.File.file) AND LLVM_LIBC_FULL_BUILD)
22+
# Not all platforms have a file implementation. If file is unvailable, and a
23+
# full build is requested, then we must skip all file based scanf sections.
24+
return()
25+
endif()
26+
2127
add_libc_unittest(
2228
reader_test
2329
SUITE

0 commit comments

Comments
 (0)