coverity/100248: Operands don't affect result: HI.

Problem    : Operands don't affect results (CONSTANT_EXPRESSION_RESULT).
Diagnostic : Harmless issue.
Rationale  : n >= LONG_MIN, n being intmax_t, is always true for
             architectures where sizeof(intmax_t) == sizeof(long).
Resolution : Add sizes check.
This commit is contained in:
Eliseo Martínez 2015-01-12 11:46:19 +01:00
parent 12f606a2a8
commit 634d5d86a7
2 changed files with 5 additions and 0 deletions

View File

@ -5,6 +5,7 @@ include(CheckIncludeFiles)
check_type_size("int" SIZEOF_INT)
check_type_size("long" SIZEOF_LONG)
check_type_size("intmax_t" SIZEOF_INTMAX_T)
check_type_size("off_t" SIZEOF_OFF_T)
check_type_size("void *" SIZEOF_VOID_PTR)

View File

@ -1695,7 +1695,9 @@ intmax_t getdigits(char_u **pp)
int getdigits_int(char_u **pp)
{
intmax_t number = getdigits(pp);
#if SIZEOF_INTMAX_T > SIZEOF_INT
assert(number >= INT_MIN && number <= INT_MAX);
#endif
return (int)number;
}
@ -1705,7 +1707,9 @@ int getdigits_int(char_u **pp)
long getdigits_long(char_u **pp)
{
intmax_t number = getdigits(pp);
#if SIZEOF_INTMAX_T > SIZEOF_LONG
assert(number >= LONG_MIN && number <= LONG_MAX);
#endif
return (long)number;
}