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:
committed by
Damien George
parent
d0d111356f
commit
a1a8eacdce
@@ -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, "%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, "%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, "%%\n"); // literal % character
|
||||||
mp_printf(&mp_plat_print, ".%-3s.\n", "a"); // left adjust
|
mp_printf(&mp_plat_print, ".%-3s.\n", "a"); // left adjust
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user