File tree Expand file tree Collapse file tree 2 files changed +34
-38
lines changed
test/src/stdio/scanf_core Expand file tree Collapse file tree 2 files changed +34
-38
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,22 @@ if(scanf_config_copts)
8
8
list (PREPEND scanf_config_copts "COMPILE_OPTIONS" )
9
9
endif ()
10
10
11
+
12
+ list (APPEND file_deps
13
+ libc.hdr.types.FILE
14
+ )
15
+ if (LIBC_TARGET_OS_IS_GPU )
16
+ list (APPEND file_deps
17
+ libc.src.stdio.getc
18
+ libc.src.stdio.ungetc
19
+ libc.src.stdio.ferror
20
+ )
21
+ elseif (LLVM_LIBC_FULL_BUILD )
22
+ list (APPEND file_deps
23
+ libc.src.__support.File.file
24
+ )
25
+ endif ()
26
+
11
27
add_header_library (
12
28
scanf_config
13
29
HDRS
@@ -52,28 +68,19 @@ add_object_library(
52
68
.converter
53
69
.core_structs
54
70
libc.src.__support.arg_list
71
+ ${file_deps}
72
+ ${use_system_file}
55
73
)
56
74
57
- if (LIBC_TARGET_OS_IS_GPU )
58
- add_header_library (
59
- reader
60
- HDRS
61
- reader.h
62
- DEPENDS
63
- libc.src.__support.macros.attributes
64
- )
65
- elseif ((TARGET libc.src.__support.File.file ) OR (NOT LLVM_LIBC_FULL_BUILD ))
66
75
add_header_library (
67
76
reader
68
77
HDRS
69
78
reader.h
70
79
DEPENDS
71
80
libc.src.__support.macros.attributes
72
- libc.hdr.types.FILE
73
- libc.src.__support.File.file
81
+ ${file_deps}
74
82
${use_system_file}
75
83
)
76
- endif ()
77
84
78
85
add_object_library (
79
86
converter
@@ -101,33 +108,19 @@ add_object_library(
101
108
libc.src.__support.CPP.limits
102
109
libc.src.__support.char_vector
103
110
libc.src.__support.str_to_float
111
+ ${file_deps}
112
+ ${use_system_file}
104
113
)
105
114
106
- if (LIBC_TARGET_OS_IS_GPU )
107
- add_header_library (
108
- vfscanf_internal
109
- HDRS
110
- vfscanf_internal.h
111
- DEPENDS
112
- .reader
113
- .scanf_main
114
- libc.include.stdio
115
- libc.src.__support.arg_list
116
- libc.src.stdio.getc
117
- libc.src.stdio.ungetc
118
- libc.src.stdio.ferror
119
- )
120
- elseif (TARGET libc.src.__support.File.file OR (NOT LLVM_LIBC_FULL_BUILD ))
121
- add_header_library (
115
+ #TODO: condense the file-related code as possible.
116
+ add_header_library (
122
117
vfscanf_internal
123
118
HDRS
124
119
vfscanf_internal.h
125
120
DEPENDS
126
121
.reader
127
122
.scanf_main
128
- libc.include.stdio
129
- libc.src.__support.File.file
130
123
libc.src.__support.arg_list
124
+ ${file_deps}
131
125
${use_system_file}
132
- )
133
- endif ()
126
+ )
Original file line number Diff line number Diff line change
1
+ if (NOT (LLVM_LIBC_FULL_BUILD ))
2
+ # in overlay mode, use the system's file to test the reader.
3
+ set (use_system_file "-DLIBC_COPT_STDIO_USE_SYSTEM_FILE" )
4
+ endif ()
5
+
1
6
add_libc_unittest (
2
7
parser_test
3
8
SUITE
@@ -22,14 +27,10 @@ add_libc_unittest(
22
27
DEPENDS
23
28
libc.src.stdio.scanf_core.reader
24
29
libc.src.__support.CPP.string_view
30
+ COMPILE_OPTIONS
31
+ ${use_system_file}
25
32
)
26
33
27
- if (NOT (TARGET libc.src.__support.File.file ))
28
- # Not all platforms have a file implementation. If file is unvailable,
29
- # then we must skip all the parts that need file.
30
- return ()
31
- endif ()
32
-
33
34
add_libc_unittest (
34
35
converter_test
35
36
SUITE
@@ -40,4 +41,6 @@ add_libc_unittest(
40
41
libc.src.stdio.scanf_core.reader
41
42
libc.src.stdio.scanf_core.converter
42
43
libc.src.__support.CPP.string_view
44
+ COMPILE_OPTIONS
45
+ ${use_system_file}
43
46
)
You can’t perform that action at this time.
0 commit comments