tar: improve compile-time diagnostics

* src/misc.c (sysinttostr, strtosysint): Improve #error wording.
This commit is contained in:
Nathan Stratton Treadway
2013-01-28 22:11:05 -08:00
committed by Paul Eggert
parent 9cf743abf8
commit 20dcc4d122

View File

@@ -332,7 +332,7 @@ replace_prefix (char **pname, const char *samp, size_t slen,
the range MINVAL .. -1, represent it with a string representation the range MINVAL .. -1, represent it with a string representation
of the negative integer, using leading '-'. */ of the negative integer, using leading '-'. */
#if ! (INTMAX_MAX <= UINTMAX_MAX / 2) #if ! (INTMAX_MAX <= UINTMAX_MAX / 2)
# error "strtosysint accepts uintmax_t to represent intmax_t" # error "sysinttostr: uintmax_t cannot represent all intmax_t values"
#endif #endif
char * char *
sysinttostr (uintmax_t value, intmax_t minval, uintmax_t maxval, sysinttostr (uintmax_t value, intmax_t minval, uintmax_t maxval,
@@ -361,7 +361,7 @@ sysinttostr (uintmax_t value, intmax_t minval, uintmax_t maxval,
On conversion error, return 0 and set errno = EINVAL. On conversion error, return 0 and set errno = EINVAL.
On overflow, return an extreme value and set errno = ERANGE. */ On overflow, return an extreme value and set errno = ERANGE. */
#if ! (INTMAX_MAX <= UINTMAX_MAX) #if ! (INTMAX_MAX <= UINTMAX_MAX)
# error "strtosysint accepts uintmax_t to represent nonnegative intmax_t" # error "strtosysint: nonnegative intmax_t does not fit in uintmax_t"
#endif #endif
intmax_t intmax_t
strtosysint (char const *arg, char **arglim, intmax_t minval, uintmax_t maxval) strtosysint (char const *arg, char **arglim, intmax_t minval, uintmax_t maxval)