casaroli opened a new pull request, #4027: URL: https://github.com/apache/nuttx-apps/pull/4027
depends-on: apache/nuttx/pull/21730 depends-on: apache/nuttx/pull/21729 ## Summary `testing/libc/scanftest` has no case for the `L` length modifier. This PR adds two groups of cases: - `%Lf`, `%Le`, `%Lg`, `%LE`, `%LG` with a field width, with `%*Lf` and with an `int` after the long double: the whole long double must be stored and the next conversion must read the rest of the input. Each value is exact or needs one rounding only, so it is equal to the constant in every long double format. These cases are built only when the compiler has a long double (`CONFIG_HAVE_LONG_DOUBLE`). - `%Ld`, `%Li` and `%Lu`: the same as `%lld` and `%llu`, as in GNU libc. They are in the type modifier table with the `ll` cases. The first commit only changes white space: the case labels of the switch in the type modifier test were level with its braces, and nxstyle reports each line of the switch. checkpatch checks the whole file, so the check job fails without it. ## Impact Test only. No change to the existing cases. The test still needs `CONFIG_LIBC_FLOATINGPOINT` for the floating point cases, as before. ## Testing `scanftest` with `LIBC_FLOATINGPOINT` and `LIBC_SCANSET`, and a FAT RAM disk on `/mnt/fs` for the `fscanf()` cases (`mkrd`, `mkfatfs`, `mount -t vfat`): | Configuration | nuttx master | with apache/nuttx#21730 | |---|---|---| | qemu-armv8a:nsh (flat), make, HVF | OK 168, FAILED 8 | OK 176, FAILED 0 | | qemu-armv8a:knsh (kernel), make, HVF | OK 168, FAILED 8 | OK 176, FAILED 0 | | qemu-armv8a:nsh, CMake, HVF | not run | OK 176, FAILED 0 | | mps2-an500:knsh (protected, 32-bit), make, TCG | OK 172, FAILED 4 | OK 176, FAILED 0 | On master the 8 long double cases fail on arm64 (the value is not stored). The `%Ld` cases pass there, because a long is 64 bits. On mps2-an500 a long double is a double, so the long double cases pass on master too, and the 4 `%Ld`, `%Li` and `%Lu` cases fail on master, because `L` stored a long (32 bits) there. `scanftest` exits with status 0 in all runs: it reports failures only in its output. ostest exits with status 0 on qemu-armv8a:nsh and qemu-armv8a:knsh, with master and with the fix. qemu-armv8a:nsh (make and CMake) and mps2-an500:knsh build with `-Wno-cpp -Werror`, with no warning. `tools/checkpatch.sh -c -u -m -g` passes. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
