File tree Expand file tree Collapse file tree 2 files changed +32
-40
lines changed
test/src/stdio/scanf_core Expand file tree Collapse file tree 2 files changed +32
-40
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,20 @@ if(scanf_config_copts)
8
8
list (PREPEND scanf_config_copts "COMPILE_OPTIONS" )
9
9
endif ()
10
10
11
+
12
+ list (APPEND file_deps libc.hdr.types.FILE )
13
+ if (LIBC_TARGET_OS_IS_GPU )
14
+ list (APPEND file_deps
15
+ libc.src.stdio.getc
16
+ libc.src.stdio.ungetc
17
+ libc.src.stdio.ferror
18
+ )
19
+ elseif (LLVM_LIBC_FULL_BUILD )
20
+ list (APPEND file_deps
21
+ libc.src.__support.File.file
22
+ )
23
+ endif ()
24
+
11
25
add_header_library (
12
26
scanf_config
13
27
HDRS
@@ -52,30 +66,19 @@ add_object_library(
52
66
.converter
53
67
.core_structs
54
68
libc.src.__support.arg_list
69
+ ${file_deps}
70
+ ${use_system_file}
55
71
)
56
72
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
- libc.src.stdio.getc
65
- libc.src.stdio.ungetc
66
- )
67
- elseif ((TARGET libc.src.__support.File.file ) OR (NOT LLVM_LIBC_FULL_BUILD ))
68
73
add_header_library (
69
74
reader
70
75
HDRS
71
76
reader.h
72
77
DEPENDS
73
78
libc.src.__support.macros.attributes
74
- libc.hdr.types.FILE
75
- libc.src.__support.File.file
79
+ ${file_deps}
76
80
${use_system_file}
77
81
)
78
- endif ()
79
82
80
83
add_object_library (
81
84
converter
@@ -103,33 +106,19 @@ add_object_library(
103
106
libc.src.__support.CPP.limits
104
107
libc.src.__support.char_vector
105
108
libc.src.__support.str_to_float
109
+ ${file_deps}
110
+ ${use_system_file}
106
111
)
107
112
108
- if (LIBC_TARGET_OS_IS_GPU )
109
- add_header_library (
110
- vfscanf_internal
111
- HDRS
112
- vfscanf_internal.h
113
- DEPENDS
114
- .reader
115
- .scanf_main
116
- libc.include.stdio
117
- libc.src.__support.arg_list
118
- libc.src.stdio.getc
119
- libc.src.stdio.ungetc
120
- libc.src.stdio.ferror
121
- )
122
- elseif (TARGET libc.src.__support.File.file OR (NOT LLVM_LIBC_FULL_BUILD ))
123
- add_header_library (
113
+ #TODO: condense the file-related code as possible.
114
+ add_header_library (
124
115
vfscanf_internal
125
116
HDRS
126
117
vfscanf_internal.h
127
118
DEPENDS
128
119
.reader
129
120
.scanf_main
130
- libc.include.stdio
131
- libc.src.__support.File.file
132
121
libc.src.__support.arg_list
122
+ ${file_deps}
133
123
${use_system_file}
134
- )
135
- endif ()
124
+ )
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