printf: Explain what couldn't be converted

This commit is contained in:
Fabian Homborg 2021-11-19 21:19:56 +01:00
parent 8391f94081
commit 707f042fc4
2 changed files with 3 additions and 3 deletions

View File

@ -262,7 +262,7 @@ void builtin_printf_state_t::verify_numeric(const wchar_t *s, const wchar_t *end
this->fatal_error(_(L"%ls: expected a numeric value"), s);
} else {
// This isn't entirely fatal - the value should still be printed.
this->nonfatal_error(_(L"%ls: value not completely converted"), s);
this->nonfatal_error(_(L"%ls: value not completely converted (can't convert '%ls')"), s, end);
}
}
}

View File

@ -66,7 +66,7 @@ printf '%e\n' "1.23" # should succeed, output should be 1.230000e+00
printf '%e\n' "2,34" # should fail
# CHECK: 2.000000e+00
# CHECKERR: 2,34: value not completely converted
# CHECKERR: 2,34: value not completely converted (can't convert ',34')
# Verify long long ints are handled correctly. See issue #3352.
printf 'long hex1 %x\n' 498216206234
@ -92,6 +92,6 @@ echo $status
# Verify numeric conversion still happens even if it couldn't be fully converted
printf '%d\n' 15.1
# CHECK: 15
# CHECKERR: 15.1: value not completely converted
# CHECKERR: 15.1: value not completely converted (can't convert '.1')
echo $status
# CHECK: 1