summaryrefslogtreecommitdiff
path: root/libc/test/src/stdio/sscanf_test.cpp
AgeCommit message (Collapse)Author
2025-03-14[libc] Fix implicit conversion warnings in tests. (#131362)lntue
2024-10-18[libc] Scanf shouldn't match just "0x" for hex int (#112440)Michael Jones
Scanf parsing reads the longest possibly valid prefix for a given conversion. Then, it performs the conversion on that string. In the case of "0xZ" with a hex conversion (either "%x" or "%i") the longest possibly valid prefix is "0x", which makes it the "input item" (per the standard). The sequence "0x" is not a "matching sequence" for a hex conversion, meaning it results in a matching failure, and parsing ends. This is because to know that there's no valid digit after "0x" it reads the 'Z', but it can only put back one character (the 'Z') leaving it with consuming an invalid sequence. (inspired by a thread on the libc-coord mailing list: https://www.openwall.com/lists/libc-coord/2024/10/15/1, see 7.32.6.2 in the standard for more details.)
2024-10-01[libc][stdio] Use proxy headers of stdio.h in src and test folders. (#110067)lntue
https://github.com/llvm/llvm-project/issues/60481
2024-07-24[libc] Enable 'sscanf' on the GPU #100211Joseph Huber
Summary: We can enable the sscanf function on the GPU now. This required adding the configs to the scanf list so that the GPU build didn't do float conversions.
2024-03-04[libc][NFC] Rename `LIBC_LONG_DOUBLE_IS_` macros (#83399)Guillaume Chatelet
Umbrella bug #83182
2024-01-30[libc][NFC] Rename `FPBits` nan functions (#79998)Guillaume Chatelet
- [libc][NFC] Rename FPBits nan functions - rename build_signaling_nan in signaling_nan - rename build_quiet_nan to quiet_nan
2024-01-29[libc] Remove specific nan payload in math functions (#79165)Guillaume Chatelet
2024-01-23[reland][libc] Remove unnecessary `FPBits` functions and properties (#79128)Guillaume Chatelet
- reland #79113 - Fix aarch64 RISC-V build
2024-01-23Revert "[libc] Remove unnecessary `FPBits` functions and properties" (#79118)Guillaume Chatelet
Reverts llvm/llvm-project#79113 It broke aarch64 build bot machines.
2024-01-23[libc] Remove unnecessary `FPBits` functions and properties (#79113)Guillaume Chatelet
This patch reduces the surface of `FPBits`.
2023-12-01[libc][NFC] rename LONG_DOUBLE_IS_DOUBLE into LIBC_LONG_DOUBLE_IS_FLOAT64 ↵Guillaume Chatelet
(#73948)
2023-11-23[libc][NFC] Sink "PlatformDefs.h" into "FloatProperties.h" (#73226)Guillaume Chatelet
`PlatformDefs.h` does not bring a lot of value as a separate file. It is transitively included in `FloatProperties.h` and `FPBits.h`. This patch sinks it into `FloatProperties.h` and removes the associated build targets.
2023-11-06[libc][math] Add min/max/min_denorm/max_denorm constants to FPBits and clean ↵lntue
up its constants return types. (#71298)
2023-09-26[libc] Mass replace enclosing namespace (#67032)Guillaume Chatelet
This is step 4 of https://discourse.llvm.org/t/rfc-customizable-namespace-to-allow-testing-the-libc-when-the-system-libc-is-also-llvms-libc/73079
2023-02-07[libc][NFC] Move UnitTest and IntegrationTest to the 'test' directory.Siva Chandra Reddy
This part of the effort to make all test related pieces into the `test` directory. This helps is excluding test related pieces in a straight forward manner if LLVM_INCLUDE_TESTS is OFF. Future patches will also move the MPFR wrapper and testutils into the 'test' directory.
2023-01-25[libc] add scanf pointer conversionMichael Jones
This patch adds the last conversion for scanf, %p. It is set up to match the %p implementation in our printf. Reviewed By: sivachandra, lntue Differential Revision: https://reviews.llvm.org/D142510
2023-01-25[libc] add scanf current position conversionMichael Jones
To add the current position (%n) conversion, some reorganization needed to be done. The "write a number to this pointer using the length modifier" utilities and a couple other shared parsing functions have been moved into converter_utils.h. This made implementing current_pos_converter very simple. Reviewed By: lntue Differential Revision: https://reviews.llvm.org/D142495
2023-01-19[libc] add scanf float converterMichael Jones
This patch adds the %f/F/e/E/g/G/a/A conversions for scanf, as well as accompanying tests. This implementation matches the definition set forth in the standard, which may conflict with some other implementations. Reviewed By: sivachandra Differential Revision: https://reviews.llvm.org/D141091
2022-12-13[libc] add scanf int conversionsMichael Jones
This patch adds the integer conversions %d/i/u/o/x/X to scanf as well as unit tests to check their correctness. Reviewed By: sivachandra Differential Revision: https://reviews.llvm.org/D138880
2022-11-17[libc] add scanf entrypointsMichael Jones
This patch adds scanf, sscanf, and fscanf entrypoints. It also adds unit tests for sscanf and a basic test to fscanf. The scanf function is basically impossible to test in an automated fashion due to it recieving user input. Reviewed By: sivachandra, lntue Differential Revision: https://reviews.llvm.org/D138076