Skip to content

Commit 09822de

Browse files
author
git apple-llvm automerger
committed
Merge commit '4b53cbb06962' from llvm.org/main into next
2 parents 754dd90 + 4b53cbb commit 09822de

File tree

4 files changed

+39
-0
lines changed

4 files changed

+39
-0
lines changed

libc/config/config.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,16 @@
2121
"doc": "Disable printing fixed point values in printf and friends."
2222
}
2323
},
24+
"scanf": {
25+
"LIBC_CONF_SCANF_DISABLE_FLOAT": {
26+
"value": false,
27+
"doc": "Disable parsing floating point values in scanf and friends."
28+
},
29+
"LIBC_CONF_SCANF_DISABLE_INDEX_MODE": {
30+
"value": false,
31+
"doc": "Disable index mode in the scanf format string."
32+
}
33+
},
2434
"string": {
2535
"LIBC_CONF_STRING_UNSAFE_WIDE_READ": {
2636
"value": false,

libc/config/gpu/config.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,14 @@
1313
"value": false
1414
}
1515
},
16+
"scanf": {
17+
"LIBC_CONF_SCANF_DISABLE_FLOAT": {
18+
"value": true
19+
},
20+
"LIBC_CONF_SCANF_DISABLE_INDEX_MODE": {
21+
"value": true
22+
}
23+
},
1624
"math": {
1725
"LIBC_CONF_MATH_OPTIMIZATIONS": {
1826
"value": "(LIBC_MATH_SKIP_ACCURATE_PASS | LIBC_MATH_SMALL_TABLES | LIBC_MATH_NO_ERRNO | LIBC_MATH_NO_EXCEPT)"

libc/docs/configure.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ to learn about the defaults for your platform and target.
4242
- ``LIBC_CONF_RAW_MUTEX_DEFAULT_SPIN_COUNT``: Default number of spins before blocking if a mutex is in contention (default to 100).
4343
- ``LIBC_CONF_RWLOCK_DEFAULT_SPIN_COUNT``: Default number of spins before blocking if a rwlock is in contention (default to 100).
4444
- ``LIBC_CONF_TIMEOUT_ENSURE_MONOTONICITY``: Automatically adjust timeout to CLOCK_MONOTONIC (default to true). POSIX API may require CLOCK_REALTIME, which can be unstable and leading to unexpected behavior. This option will convert the real-time timestamp to monotonic timestamp relative to the time of call.
45+
* **"scanf" options**
46+
- ``LIBC_CONF_SCANF_DISABLE_FLOAT``: Disable parsing floating point values in scanf and friends.
47+
- ``LIBC_CONF_SCANF_DISABLE_INDEX_MODE``: Disable index mode in the scanf format string.
4548
* **"string" options**
4649
- ``LIBC_CONF_MEMSET_X86_USE_SOFTWARE_PREFETCHING``: Inserts prefetch for write instructions (PREFETCHW) for memset on x86 to recover performance when hardware prefetcher is disabled.
4750
- ``LIBC_CONF_STRING_UNSAFE_WIDE_READ``: Read more than a byte at a time to perform byte-string operations like strlen.

libc/src/stdio/scanf_core/CMakeLists.txt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,26 @@
1+
if(LIBC_CONF_SCANF_DISABLE_FLOAT)
2+
list(APPEND scanf_config_copts "-DLIBC_COPT_SCANF_DISABLE_FLOAT")
3+
endif()
4+
if(LIBC_CONF_SCANF_DISABLE_INDEX_MODE)
5+
list(APPEND scanf_config_copts "-DLIBC_COPT_SCANF_DISABLE_INDEX_MODE")
6+
endif()
7+
if(scanf_config_copts)
8+
list(PREPEND scanf_config_copts "COMPILE_OPTIONS")
9+
endif()
10+
11+
add_header_library(
12+
scanf_config
13+
HDRS
14+
scanf_config.h
15+
${scanf_config_copts}
16+
)
17+
118
add_header_library(
219
core_structs
320
HDRS
421
core_structs.h
522
DEPENDS
23+
.scanf_config
624
libc.src.__support.CPP.string_view
725
libc.src.__support.CPP.bitset
826
libc.src.__support.FPUtil.fp_bits

0 commit comments

Comments
 (0)