unix/coverage: Avoid type checking an invalid string.

We still want this not to crash a runtime but the new static checker
wouldn't like it.

Signed-off-by: Jeff Epler <jepler@gmail.com>
This commit is contained in:
Jeff Epler 2025-06-24 10:07:37 +02:00 committed by Damien George
parent d0d111356f
commit a1a8eacdce

View file

@ -230,7 +230,12 @@ static mp_obj_t extra_coverage(void) {
mp_printf(&mp_plat_print, "%u\n", 0x80000000); // should print unsigned
mp_printf(&mp_plat_print, "%x\n", 0x8000000f); // should print unsigned
mp_printf(&mp_plat_print, "%X\n", 0x8000000f); // should print unsigned
mp_printf(&mp_plat_print, "abc\n%"); // string ends in middle of format specifier
// note: storing the string in a variable is enough to prevent the
// format string checker from checking this format string. Otherwise,
// it would be a compile time diagnostic under the format string
// checker.
const char msg[] = "abc\n%";
mp_printf(&mp_plat_print, msg); // string ends in middle of format specifier
mp_printf(&mp_plat_print, "%%\n"); // literal % character
mp_printf(&mp_plat_print, ".%-3s.\n", "a"); // left adjust