Fix FN for intmax_t passed as %jx into printf

This commit is contained in:
Dmitry-Me 2017-11-18 00:00:02 +03:00
parent 73414ee56c
commit cf05b722a9
2 changed files with 2 additions and 3 deletions

View File

@ -1007,8 +1007,7 @@ void CheckIO::checkFormatString(const Token * const tok,
invalidPrintfArgTypeError_uint(tok, numFormat, specifier, &argInfo);
break;
case 'j':
if (!(argInfo.typeToken->originalName() == "intmax_t" ||
argInfo.typeToken->originalName() == "uintmax_t"))
if (argInfo.typeToken->originalName() != "uintmax_t")
invalidPrintfArgTypeError_uint(tok, numFormat, specifier, &argInfo);
break;
case 'z':

View File

@ -3677,7 +3677,7 @@ private:
TEST_PRINTF_WARN_AKA("%jx", "uintmax_t", "ssize_t", "signed long", "signed long long");
TEST_PRINTF_WARN_AKA("%jx", "uintmax_t", "ptrdiff_t", "signed long", "signed long long");
TEST_PRINTF_WARN_AKA("%jx", "uintmax_t", "unsigned ptrdiff_t", "unsigned long", "unsigned long long");
//TODO TEST_PRINTF_WARN_AKA("%jx", "uintmax_t", "intmax_t", "signed long", "signed long long");
TEST_PRINTF_WARN_AKA("%jx", "uintmax_t", "intmax_t", "signed long", "signed long long");
TEST_PRINTF_NOWARN("%jx", "uintmax_t", "uintmax_t");
TEST_PRINTF_WARN_AKA("%jx", "uintmax_t", "std::size_t", "unsigned long", "unsigned long long");
TEST_PRINTF_WARN_AKA("%jx", "uintmax_t", "std::ssize_t", "signed long", "signed long long");