Partial fix for #5536 (printf/scanf argument tests failing on Windows x64)
This commit is contained in:
parent
14386d06dc
commit
7b5a96dc06
585
test/testio.cpp
585
test/testio.cpp
|
@ -697,7 +697,8 @@ private:
|
||||||
"}", true);
|
"}", true);
|
||||||
ASSERT_EQUALS("", errout.str());
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
|
||||||
check("const unsigned int * foo() { }\n"
|
{
|
||||||
|
const char * code = "const unsigned int * foo() { }\n"
|
||||||
"void foo() {\n"
|
"void foo() {\n"
|
||||||
" bool b;\n"
|
" bool b;\n"
|
||||||
" char c;\n"
|
" char c;\n"
|
||||||
|
@ -721,8 +722,8 @@ private:
|
||||||
" void * vp;\n"
|
" void * vp;\n"
|
||||||
" scanf(\"%u %u %u %u %u %u %u %u %u %u %u %u %u %u %u %u %u %u %u %u %u %u %u %u %u %u\",\n"
|
" scanf(\"%u %u %u %u %u %u %u %u %u %u %u %u %u %u %u %u %u %u %u %u %u %u %u %u %u %u\",\n"
|
||||||
" &b, &c, &sc, &uc, &s, &us, &i, &ui, &l, &ul, &ll, &ull, &f, &d, &ld, &st, &pt, &it, &ut, &vp, vp, \"str\", L\"str\", foo(), &unknown, unknown);\n"
|
" &b, &c, &sc, &uc, &s, &us, &i, &ui, &l, &ul, &ll, &ull, &f, &d, &ld, &st, &pt, &it, &ut, &vp, vp, \"str\", L\"str\", foo(), &unknown, unknown);\n"
|
||||||
"}\n", true);
|
"}\n";
|
||||||
ASSERT_EQUALS("[test.cpp:23]: (warning) %u in format string (no. 1) requires 'unsigned int *' but the argument type is 'bool *'.\n"
|
std::string result("[test.cpp:23]: (warning) %u in format string (no. 1) requires 'unsigned int *' but the argument type is 'bool *'.\n"
|
||||||
"[test.cpp:23]: (warning) %u in format string (no. 2) requires 'unsigned int *' but the argument type is 'char *'.\n"
|
"[test.cpp:23]: (warning) %u in format string (no. 2) requires 'unsigned int *' but the argument type is 'char *'.\n"
|
||||||
"[test.cpp:23]: (warning) %u in format string (no. 3) requires 'unsigned int *' but the argument type is 'signed char *'.\n"
|
"[test.cpp:23]: (warning) %u in format string (no. 3) requires 'unsigned int *' but the argument type is 'signed char *'.\n"
|
||||||
"[test.cpp:23]: (warning) %u in format string (no. 4) requires 'unsigned int *' but the argument type is 'unsigned char *'.\n"
|
"[test.cpp:23]: (warning) %u in format string (no. 4) requires 'unsigned int *' but the argument type is 'unsigned char *'.\n"
|
||||||
|
@ -744,9 +745,43 @@ private:
|
||||||
"[test.cpp:23]: (warning) %u in format string (no. 21) requires 'unsigned int *' but the argument type is 'void *'.\n"
|
"[test.cpp:23]: (warning) %u in format string (no. 21) requires 'unsigned int *' but the argument type is 'void *'.\n"
|
||||||
"[test.cpp:23]: (warning) %u in format string (no. 22) requires 'unsigned int *' but the argument type is 'const char *'.\n"
|
"[test.cpp:23]: (warning) %u in format string (no. 22) requires 'unsigned int *' but the argument type is 'const char *'.\n"
|
||||||
"[test.cpp:23]: (warning) %u in format string (no. 23) requires 'unsigned int *' but the argument type is 'const wchar_t *'.\n"
|
"[test.cpp:23]: (warning) %u in format string (no. 23) requires 'unsigned int *' but the argument type is 'const wchar_t *'.\n"
|
||||||
"[test.cpp:23]: (warning) %u in format string (no. 24) requires 'unsigned int *' but the argument type is 'const unsigned int *'.\n", errout.str());
|
"[test.cpp:23]: (warning) %u in format string (no. 24) requires 'unsigned int *' but the argument type is 'const unsigned int *'.\n");
|
||||||
|
std::string result_win64("[test.cpp:23]: (warning) %u in format string (no. 1) requires 'unsigned int *' but the argument type is 'bool *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %u in format string (no. 2) requires 'unsigned int *' but the argument type is 'char *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %u in format string (no. 3) requires 'unsigned int *' but the argument type is 'signed char *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %u in format string (no. 4) requires 'unsigned int *' but the argument type is 'unsigned char *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %u in format string (no. 5) requires 'unsigned int *' but the argument type is 'short *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %u in format string (no. 6) requires 'unsigned int *' but the argument type is 'unsigned short *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %u in format string (no. 7) requires 'unsigned int *' but the argument type is 'int *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %u in format string (no. 9) requires 'unsigned int *' but the argument type is 'long *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %u in format string (no. 10) requires 'unsigned int *' but the argument type is 'unsigned long *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %u in format string (no. 11) requires 'unsigned int *' but the argument type is 'long long *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %u in format string (no. 12) requires 'unsigned int *' but the argument type is 'unsigned long long *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %u in format string (no. 13) requires 'unsigned int *' but the argument type is 'float *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %u in format string (no. 14) requires 'unsigned int *' but the argument type is 'double *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %u in format string (no. 15) requires 'unsigned int *' but the argument type is 'long double *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %u in format string (no. 16) requires 'unsigned int *' but the argument type is 'size_t * {aka unsigned long long *}'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %u in format string (no. 17) requires 'unsigned int *' but the argument type is 'ptrdiff_t * {aka long long *}'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %u in format string (no. 18) requires 'unsigned int *' but the argument type is 'intmax_t * {aka long long *}'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %u in format string (no. 19) requires 'unsigned int *' but the argument type is 'uintmax_t * {aka unsigned long long *}'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %u in format string (no. 20) requires 'unsigned int *' but the argument type is 'void * *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %u in format string (no. 21) requires 'unsigned int *' but the argument type is 'void *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %u in format string (no. 22) requires 'unsigned int *' but the argument type is 'const char *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %u in format string (no. 23) requires 'unsigned int *' but the argument type is 'const wchar_t *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %u in format string (no. 24) requires 'unsigned int *' but the argument type is 'const unsigned int *'.\n");
|
||||||
|
|
||||||
check("void foo() {\n"
|
check(code, true, false, Settings::Unix32);
|
||||||
|
ASSERT_EQUALS(result, errout.str());
|
||||||
|
check(code, true, false, Settings::Unix64);
|
||||||
|
ASSERT_EQUALS(result, errout.str());
|
||||||
|
check(code, true, false, Settings::Win32A);
|
||||||
|
ASSERT_EQUALS(result, errout.str());
|
||||||
|
check(code, true, false, Settings::Win64);
|
||||||
|
ASSERT_EQUALS(result_win64, errout.str());
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
const char * code = "void foo() {\n"
|
||||||
" bool b;\n"
|
" bool b;\n"
|
||||||
" char c;\n"
|
" char c;\n"
|
||||||
" signed char sc;\n"
|
" signed char sc;\n"
|
||||||
|
@ -769,8 +804,8 @@ private:
|
||||||
" void * vp;\n"
|
" void * vp;\n"
|
||||||
" scanf(\"%lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu\",\n"
|
" scanf(\"%lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu\",\n"
|
||||||
" &b, &c, &sc, &uc, &s, &us, &i, &ui, &l, &ul, &ll, &ull, &f, &d, &ld, &st, &pt, &it, &ut, &vp, vp, &unknown, unknown);\n"
|
" &b, &c, &sc, &uc, &s, &us, &i, &ui, &l, &ul, &ll, &ull, &f, &d, &ld, &st, &pt, &it, &ut, &vp, vp, &unknown, unknown);\n"
|
||||||
"}\n", true);
|
"}\n";
|
||||||
ASSERT_EQUALS("[test.cpp:22]: (warning) %lu in format string (no. 1) requires 'unsigned long *' but the argument type is 'bool *'.\n"
|
std::string result("[test.cpp:22]: (warning) %lu in format string (no. 1) requires 'unsigned long *' but the argument type is 'bool *'.\n"
|
||||||
"[test.cpp:22]: (warning) %lu in format string (no. 2) requires 'unsigned long *' but the argument type is 'char *'.\n"
|
"[test.cpp:22]: (warning) %lu in format string (no. 2) requires 'unsigned long *' but the argument type is 'char *'.\n"
|
||||||
"[test.cpp:22]: (warning) %lu in format string (no. 3) requires 'unsigned long *' but the argument type is 'signed char *'.\n"
|
"[test.cpp:22]: (warning) %lu in format string (no. 3) requires 'unsigned long *' but the argument type is 'signed char *'.\n"
|
||||||
"[test.cpp:22]: (warning) %lu in format string (no. 4) requires 'unsigned long *' but the argument type is 'unsigned char *'.\n"
|
"[test.cpp:22]: (warning) %lu in format string (no. 4) requires 'unsigned long *' but the argument type is 'unsigned char *'.\n"
|
||||||
|
@ -789,9 +824,40 @@ private:
|
||||||
"[test.cpp:22]: (warning) %lu in format string (no. 18) requires 'unsigned long *' but the argument type is 'intmax_t * {aka long *}'.\n"
|
"[test.cpp:22]: (warning) %lu in format string (no. 18) requires 'unsigned long *' but the argument type is 'intmax_t * {aka long *}'.\n"
|
||||||
"[test.cpp:22]: (warning) %lu in format string (no. 19) requires 'unsigned long *' but the argument type is 'uintmax_t * {aka unsigned long *}'.\n"
|
"[test.cpp:22]: (warning) %lu in format string (no. 19) requires 'unsigned long *' but the argument type is 'uintmax_t * {aka unsigned long *}'.\n"
|
||||||
"[test.cpp:22]: (warning) %lu in format string (no. 20) requires 'unsigned long *' but the argument type is 'void * *'.\n"
|
"[test.cpp:22]: (warning) %lu in format string (no. 20) requires 'unsigned long *' but the argument type is 'void * *'.\n"
|
||||||
"[test.cpp:22]: (warning) %lu in format string (no. 21) requires 'unsigned long *' but the argument type is 'void *'.\n", errout.str());
|
"[test.cpp:22]: (warning) %lu in format string (no. 21) requires 'unsigned long *' but the argument type is 'void *'.\n");
|
||||||
|
std::string result_win64("[test.cpp:22]: (warning) %lu in format string (no. 1) requires 'unsigned long *' but the argument type is 'bool *'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %lu in format string (no. 2) requires 'unsigned long *' but the argument type is 'char *'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %lu in format string (no. 3) requires 'unsigned long *' but the argument type is 'signed char *'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %lu in format string (no. 4) requires 'unsigned long *' but the argument type is 'unsigned char *'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %lu in format string (no. 5) requires 'unsigned long *' but the argument type is 'short *'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %lu in format string (no. 6) requires 'unsigned long *' but the argument type is 'unsigned short *'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %lu in format string (no. 7) requires 'unsigned long *' but the argument type is 'int *'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %lu in format string (no. 8) requires 'unsigned long *' but the argument type is 'unsigned int *'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %lu in format string (no. 9) requires 'unsigned long *' but the argument type is 'long *'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %lu in format string (no. 11) requires 'unsigned long *' but the argument type is 'long long *'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %lu in format string (no. 12) requires 'unsigned long *' but the argument type is 'unsigned long long *'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %lu in format string (no. 13) requires 'unsigned long *' but the argument type is 'float *'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %lu in format string (no. 14) requires 'unsigned long *' but the argument type is 'double *'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %lu in format string (no. 15) requires 'unsigned long *' but the argument type is 'long double *'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %lu in format string (no. 16) requires 'unsigned long *' but the argument type is 'size_t * {aka unsigned long long *}'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %lu in format string (no. 17) requires 'unsigned long *' but the argument type is 'ptrdiff_t * {aka long long *}'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %lu in format string (no. 18) requires 'unsigned long *' but the argument type is 'intmax_t * {aka long long *}'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %lu in format string (no. 19) requires 'unsigned long *' but the argument type is 'uintmax_t * {aka unsigned long long *}'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %lu in format string (no. 20) requires 'unsigned long *' but the argument type is 'void * *'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %lu in format string (no. 21) requires 'unsigned long *' but the argument type is 'void *'.\n");
|
||||||
|
|
||||||
check("void foo() {\n"
|
check(code, true, false, Settings::Unix32);
|
||||||
|
ASSERT_EQUALS(result, errout.str());
|
||||||
|
check(code, true, false, Settings::Unix64);
|
||||||
|
ASSERT_EQUALS(result, errout.str());
|
||||||
|
check(code, true, false, Settings::Win32A);
|
||||||
|
ASSERT_EQUALS(result, errout.str());
|
||||||
|
check(code, true, false, Settings::Win64);
|
||||||
|
ASSERT_EQUALS(result_win64, errout.str());
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
const char * code = "void foo() {\n"
|
||||||
" bool b;\n"
|
" bool b;\n"
|
||||||
" char c;\n"
|
" char c;\n"
|
||||||
" signed char sc;\n"
|
" signed char sc;\n"
|
||||||
|
@ -814,8 +880,8 @@ private:
|
||||||
" void * vp;\n"
|
" void * vp;\n"
|
||||||
" scanf(\"%llu %llu %llu %llu %llu %llu %llu %llu %llu %llu %llu %llu %llu %llu %llu %llu %llu %llu %llu %llu %llu %llu %llu\",\n"
|
" scanf(\"%llu %llu %llu %llu %llu %llu %llu %llu %llu %llu %llu %llu %llu %llu %llu %llu %llu %llu %llu %llu %llu %llu %llu\",\n"
|
||||||
" &b, &c, &sc, &uc, &s, &us, &i, &ui, &l, &ul, &ll, &ull, &f, &d, &ld, &st, &pt, &it, &ut, &vp, vp, &unknown, unknown);\n"
|
" &b, &c, &sc, &uc, &s, &us, &i, &ui, &l, &ul, &ll, &ull, &f, &d, &ld, &st, &pt, &it, &ut, &vp, vp, &unknown, unknown);\n"
|
||||||
"}\n", true);
|
"}\n";
|
||||||
ASSERT_EQUALS("[test.cpp:22]: (warning) %llu in format string (no. 1) requires 'unsigned long long *' but the argument type is 'bool *'.\n"
|
std::string result("[test.cpp:22]: (warning) %llu in format string (no. 1) requires 'unsigned long long *' but the argument type is 'bool *'.\n"
|
||||||
"[test.cpp:22]: (warning) %llu in format string (no. 2) requires 'unsigned long long *' but the argument type is 'char *'.\n"
|
"[test.cpp:22]: (warning) %llu in format string (no. 2) requires 'unsigned long long *' but the argument type is 'char *'.\n"
|
||||||
"[test.cpp:22]: (warning) %llu in format string (no. 3) requires 'unsigned long long *' but the argument type is 'signed char *'.\n"
|
"[test.cpp:22]: (warning) %llu in format string (no. 3) requires 'unsigned long long *' but the argument type is 'signed char *'.\n"
|
||||||
"[test.cpp:22]: (warning) %llu in format string (no. 4) requires 'unsigned long long *' but the argument type is 'unsigned char *'.\n"
|
"[test.cpp:22]: (warning) %llu in format string (no. 4) requires 'unsigned long long *' but the argument type is 'unsigned char *'.\n"
|
||||||
|
@ -834,9 +900,40 @@ private:
|
||||||
"[test.cpp:22]: (warning) %llu in format string (no. 18) requires 'unsigned long long *' but the argument type is 'intmax_t * {aka long *}'.\n"
|
"[test.cpp:22]: (warning) %llu in format string (no. 18) requires 'unsigned long long *' but the argument type is 'intmax_t * {aka long *}'.\n"
|
||||||
"[test.cpp:22]: (warning) %llu in format string (no. 19) requires 'unsigned long long *' but the argument type is 'uintmax_t * {aka unsigned long *}'.\n"
|
"[test.cpp:22]: (warning) %llu in format string (no. 19) requires 'unsigned long long *' but the argument type is 'uintmax_t * {aka unsigned long *}'.\n"
|
||||||
"[test.cpp:22]: (warning) %llu in format string (no. 20) requires 'unsigned long long *' but the argument type is 'void * *'.\n"
|
"[test.cpp:22]: (warning) %llu in format string (no. 20) requires 'unsigned long long *' but the argument type is 'void * *'.\n"
|
||||||
"[test.cpp:22]: (warning) %llu in format string (no. 21) requires 'unsigned long long *' but the argument type is 'void *'.\n", errout.str());
|
"[test.cpp:22]: (warning) %llu in format string (no. 21) requires 'unsigned long long *' but the argument type is 'void *'.\n");
|
||||||
|
std::string result_win64("[test.cpp:22]: (warning) %llu in format string (no. 1) requires 'unsigned long long *' but the argument type is 'bool *'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %llu in format string (no. 2) requires 'unsigned long long *' but the argument type is 'char *'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %llu in format string (no. 3) requires 'unsigned long long *' but the argument type is 'signed char *'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %llu in format string (no. 4) requires 'unsigned long long *' but the argument type is 'unsigned char *'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %llu in format string (no. 5) requires 'unsigned long long *' but the argument type is 'short *'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %llu in format string (no. 6) requires 'unsigned long long *' but the argument type is 'unsigned short *'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %llu in format string (no. 7) requires 'unsigned long long *' but the argument type is 'int *'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %llu in format string (no. 8) requires 'unsigned long long *' but the argument type is 'unsigned int *'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %llu in format string (no. 9) requires 'unsigned long long *' but the argument type is 'long *'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %llu in format string (no. 10) requires 'unsigned long long *' but the argument type is 'unsigned long *'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %llu in format string (no. 11) requires 'unsigned long long *' but the argument type is 'long long *'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %llu in format string (no. 13) requires 'unsigned long long *' but the argument type is 'float *'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %llu in format string (no. 14) requires 'unsigned long long *' but the argument type is 'double *'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %llu in format string (no. 15) requires 'unsigned long long *' but the argument type is 'long double *'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %llu in format string (no. 16) requires 'unsigned long long *' but the argument type is 'size_t * {aka unsigned long long *}'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %llu in format string (no. 17) requires 'unsigned long long *' but the argument type is 'ptrdiff_t * {aka long long *}'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %llu in format string (no. 18) requires 'unsigned long long *' but the argument type is 'intmax_t * {aka long long *}'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %llu in format string (no. 19) requires 'unsigned long long *' but the argument type is 'uintmax_t * {aka unsigned long long *}'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %llu in format string (no. 20) requires 'unsigned long long *' but the argument type is 'void * *'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %llu in format string (no. 21) requires 'unsigned long long *' but the argument type is 'void *'.\n");
|
||||||
|
|
||||||
check("void foo() {\n"
|
check(code, true, false, Settings::Unix32);
|
||||||
|
ASSERT_EQUALS(result, errout.str());
|
||||||
|
check(code, true, false, Settings::Unix64);
|
||||||
|
ASSERT_EQUALS(result, errout.str());
|
||||||
|
check(code, true, false, Settings::Win32A);
|
||||||
|
ASSERT_EQUALS(result, errout.str());
|
||||||
|
check(code, true, false, Settings::Win64);
|
||||||
|
ASSERT_EQUALS(result_win64, errout.str());
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
const char * code = "void foo() {\n"
|
||||||
" bool b;\n"
|
" bool b;\n"
|
||||||
" char c;\n"
|
" char c;\n"
|
||||||
" signed char sc;\n"
|
" signed char sc;\n"
|
||||||
|
@ -859,8 +956,8 @@ private:
|
||||||
" void * vp;\n"
|
" void * vp;\n"
|
||||||
" scanf(\"%hu %hu %hu %hu %hu %hu %hu %hu %hu %hu %hu %hu %hu %hu %hu %hu %hu %hu %hu %hu %hu %hu %hu\",\n"
|
" scanf(\"%hu %hu %hu %hu %hu %hu %hu %hu %hu %hu %hu %hu %hu %hu %hu %hu %hu %hu %hu %hu %hu %hu %hu\",\n"
|
||||||
" &b, &c, &sc, &uc, &s, &us, &i, &ui, &l, &ul, &ll, &ull, &f, &d, &ld, &st, &pt, &it, &ut, &vp, vp, &unknown, unknown);\n"
|
" &b, &c, &sc, &uc, &s, &us, &i, &ui, &l, &ul, &ll, &ull, &f, &d, &ld, &st, &pt, &it, &ut, &vp, vp, &unknown, unknown);\n"
|
||||||
"}\n", true);
|
"}\n";
|
||||||
ASSERT_EQUALS("[test.cpp:22]: (warning) %hu in format string (no. 1) requires 'unsigned short *' but the argument type is 'bool *'.\n"
|
std::string result("[test.cpp:22]: (warning) %hu in format string (no. 1) requires 'unsigned short *' but the argument type is 'bool *'.\n"
|
||||||
"[test.cpp:22]: (warning) %hu in format string (no. 2) requires 'unsigned short *' but the argument type is 'char *'.\n"
|
"[test.cpp:22]: (warning) %hu in format string (no. 2) requires 'unsigned short *' but the argument type is 'char *'.\n"
|
||||||
"[test.cpp:22]: (warning) %hu in format string (no. 3) requires 'unsigned short *' but the argument type is 'signed char *'.\n"
|
"[test.cpp:22]: (warning) %hu in format string (no. 3) requires 'unsigned short *' but the argument type is 'signed char *'.\n"
|
||||||
"[test.cpp:22]: (warning) %hu in format string (no. 4) requires 'unsigned short *' but the argument type is 'unsigned char *'.\n"
|
"[test.cpp:22]: (warning) %hu in format string (no. 4) requires 'unsigned short *' but the argument type is 'unsigned char *'.\n"
|
||||||
|
@ -879,9 +976,40 @@ private:
|
||||||
"[test.cpp:22]: (warning) %hu in format string (no. 18) requires 'unsigned short *' but the argument type is 'intmax_t * {aka long *}'.\n"
|
"[test.cpp:22]: (warning) %hu in format string (no. 18) requires 'unsigned short *' but the argument type is 'intmax_t * {aka long *}'.\n"
|
||||||
"[test.cpp:22]: (warning) %hu in format string (no. 19) requires 'unsigned short *' but the argument type is 'uintmax_t * {aka unsigned long *}'.\n"
|
"[test.cpp:22]: (warning) %hu in format string (no. 19) requires 'unsigned short *' but the argument type is 'uintmax_t * {aka unsigned long *}'.\n"
|
||||||
"[test.cpp:22]: (warning) %hu in format string (no. 20) requires 'unsigned short *' but the argument type is 'void * *'.\n"
|
"[test.cpp:22]: (warning) %hu in format string (no. 20) requires 'unsigned short *' but the argument type is 'void * *'.\n"
|
||||||
"[test.cpp:22]: (warning) %hu in format string (no. 21) requires 'unsigned short *' but the argument type is 'void *'.\n", errout.str());
|
"[test.cpp:22]: (warning) %hu in format string (no. 21) requires 'unsigned short *' but the argument type is 'void *'.\n");
|
||||||
|
std::string result_win64("[test.cpp:22]: (warning) %hu in format string (no. 1) requires 'unsigned short *' but the argument type is 'bool *'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %hu in format string (no. 2) requires 'unsigned short *' but the argument type is 'char *'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %hu in format string (no. 3) requires 'unsigned short *' but the argument type is 'signed char *'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %hu in format string (no. 4) requires 'unsigned short *' but the argument type is 'unsigned char *'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %hu in format string (no. 5) requires 'unsigned short *' but the argument type is 'short *'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %hu in format string (no. 7) requires 'unsigned short *' but the argument type is 'int *'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %hu in format string (no. 8) requires 'unsigned short *' but the argument type is 'unsigned int *'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %hu in format string (no. 9) requires 'unsigned short *' but the argument type is 'long *'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %hu in format string (no. 10) requires 'unsigned short *' but the argument type is 'unsigned long *'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %hu in format string (no. 11) requires 'unsigned short *' but the argument type is 'long long *'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %hu in format string (no. 12) requires 'unsigned short *' but the argument type is 'unsigned long long *'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %hu in format string (no. 13) requires 'unsigned short *' but the argument type is 'float *'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %hu in format string (no. 14) requires 'unsigned short *' but the argument type is 'double *'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %hu in format string (no. 15) requires 'unsigned short *' but the argument type is 'long double *'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %hu in format string (no. 16) requires 'unsigned short *' but the argument type is 'size_t * {aka unsigned long long *}'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %hu in format string (no. 17) requires 'unsigned short *' but the argument type is 'ptrdiff_t * {aka long long *}'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %hu in format string (no. 18) requires 'unsigned short *' but the argument type is 'intmax_t * {aka long long *}'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %hu in format string (no. 19) requires 'unsigned short *' but the argument type is 'uintmax_t * {aka unsigned long long *}'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %hu in format string (no. 20) requires 'unsigned short *' but the argument type is 'void * *'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %hu in format string (no. 21) requires 'unsigned short *' but the argument type is 'void *'.\n");
|
||||||
|
|
||||||
check("void foo() {\n"
|
check(code, true, false, Settings::Unix32);
|
||||||
|
ASSERT_EQUALS(result, errout.str());
|
||||||
|
check(code, true, false, Settings::Unix64);
|
||||||
|
ASSERT_EQUALS(result, errout.str());
|
||||||
|
check(code, true, false, Settings::Win32A);
|
||||||
|
ASSERT_EQUALS(result, errout.str());
|
||||||
|
check(code, true, false, Settings::Win64);
|
||||||
|
ASSERT_EQUALS(result_win64, errout.str());
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
const char * code = "void foo() {\n"
|
||||||
" bool b;\n"
|
" bool b;\n"
|
||||||
" char c;\n"
|
" char c;\n"
|
||||||
" signed char sc;\n"
|
" signed char sc;\n"
|
||||||
|
@ -904,8 +1032,8 @@ private:
|
||||||
" void * vp;\n"
|
" void * vp;\n"
|
||||||
" scanf(\"%hhu %hhu %hhu %hhu %hhu %hhu %hhu %hhu %hhu %hhu %hhu %hhu %hhu %hhu %hhu %hhu %hhu %hhu %hhu %hhu %hhu %hhu %hhu\",\n"
|
" scanf(\"%hhu %hhu %hhu %hhu %hhu %hhu %hhu %hhu %hhu %hhu %hhu %hhu %hhu %hhu %hhu %hhu %hhu %hhu %hhu %hhu %hhu %hhu %hhu\",\n"
|
||||||
" &b, &c, &sc, &uc, &s, &us, &i, &ui, &l, &ul, &ll, &ull, &f, &d, &ld, &st, &pt, &it, &ut, &vp, vp, &unknown, unknown);\n"
|
" &b, &c, &sc, &uc, &s, &us, &i, &ui, &l, &ul, &ll, &ull, &f, &d, &ld, &st, &pt, &it, &ut, &vp, vp, &unknown, unknown);\n"
|
||||||
"}\n", true);
|
"}\n";
|
||||||
ASSERT_EQUALS("[test.cpp:22]: (warning) %hhu in format string (no. 1) requires 'unsigned char *' but the argument type is 'bool *'.\n"
|
std::string result("[test.cpp:22]: (warning) %hhu in format string (no. 1) requires 'unsigned char *' but the argument type is 'bool *'.\n"
|
||||||
"[test.cpp:22]: (warning) %hhu in format string (no. 2) requires 'unsigned char *' but the argument type is 'char *'.\n"
|
"[test.cpp:22]: (warning) %hhu in format string (no. 2) requires 'unsigned char *' but the argument type is 'char *'.\n"
|
||||||
"[test.cpp:22]: (warning) %hhu in format string (no. 3) requires 'unsigned char *' but the argument type is 'signed char *'.\n"
|
"[test.cpp:22]: (warning) %hhu in format string (no. 3) requires 'unsigned char *' but the argument type is 'signed char *'.\n"
|
||||||
"[test.cpp:22]: (warning) %hhu in format string (no. 5) requires 'unsigned char *' but the argument type is 'short *'.\n"
|
"[test.cpp:22]: (warning) %hhu in format string (no. 5) requires 'unsigned char *' but the argument type is 'short *'.\n"
|
||||||
|
@ -924,9 +1052,40 @@ private:
|
||||||
"[test.cpp:22]: (warning) %hhu in format string (no. 18) requires 'unsigned char *' but the argument type is 'intmax_t * {aka long *}'.\n"
|
"[test.cpp:22]: (warning) %hhu in format string (no. 18) requires 'unsigned char *' but the argument type is 'intmax_t * {aka long *}'.\n"
|
||||||
"[test.cpp:22]: (warning) %hhu in format string (no. 19) requires 'unsigned char *' but the argument type is 'uintmax_t * {aka unsigned long *}'.\n"
|
"[test.cpp:22]: (warning) %hhu in format string (no. 19) requires 'unsigned char *' but the argument type is 'uintmax_t * {aka unsigned long *}'.\n"
|
||||||
"[test.cpp:22]: (warning) %hhu in format string (no. 20) requires 'unsigned char *' but the argument type is 'void * *'.\n"
|
"[test.cpp:22]: (warning) %hhu in format string (no. 20) requires 'unsigned char *' but the argument type is 'void * *'.\n"
|
||||||
"[test.cpp:22]: (warning) %hhu in format string (no. 21) requires 'unsigned char *' but the argument type is 'void *'.\n", errout.str());
|
"[test.cpp:22]: (warning) %hhu in format string (no. 21) requires 'unsigned char *' but the argument type is 'void *'.\n");
|
||||||
|
std::string result_win64("[test.cpp:22]: (warning) %hhu in format string (no. 1) requires 'unsigned char *' but the argument type is 'bool *'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %hhu in format string (no. 2) requires 'unsigned char *' but the argument type is 'char *'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %hhu in format string (no. 3) requires 'unsigned char *' but the argument type is 'signed char *'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %hhu in format string (no. 5) requires 'unsigned char *' but the argument type is 'short *'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %hhu in format string (no. 6) requires 'unsigned char *' but the argument type is 'unsigned short *'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %hhu in format string (no. 7) requires 'unsigned char *' but the argument type is 'int *'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %hhu in format string (no. 8) requires 'unsigned char *' but the argument type is 'unsigned int *'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %hhu in format string (no. 9) requires 'unsigned char *' but the argument type is 'long *'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %hhu in format string (no. 10) requires 'unsigned char *' but the argument type is 'unsigned long *'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %hhu in format string (no. 11) requires 'unsigned char *' but the argument type is 'long long *'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %hhu in format string (no. 12) requires 'unsigned char *' but the argument type is 'unsigned long long *'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %hhu in format string (no. 13) requires 'unsigned char *' but the argument type is 'float *'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %hhu in format string (no. 14) requires 'unsigned char *' but the argument type is 'double *'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %hhu in format string (no. 15) requires 'unsigned char *' but the argument type is 'long double *'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %hhu in format string (no. 16) requires 'unsigned char *' but the argument type is 'size_t * {aka unsigned long long *}'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %hhu in format string (no. 17) requires 'unsigned char *' but the argument type is 'ptrdiff_t * {aka long long *}'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %hhu in format string (no. 18) requires 'unsigned char *' but the argument type is 'intmax_t * {aka long long *}'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %hhu in format string (no. 19) requires 'unsigned char *' but the argument type is 'uintmax_t * {aka unsigned long long *}'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %hhu in format string (no. 20) requires 'unsigned char *' but the argument type is 'void * *'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %hhu in format string (no. 21) requires 'unsigned char *' but the argument type is 'void *'.\n");
|
||||||
|
|
||||||
check("void foo() {\n"
|
check(code, true, false, Settings::Unix32);
|
||||||
|
ASSERT_EQUALS(result, errout.str());
|
||||||
|
check(code, true, false, Settings::Unix64);
|
||||||
|
ASSERT_EQUALS(result, errout.str());
|
||||||
|
check(code, true, false, Settings::Win32A);
|
||||||
|
ASSERT_EQUALS(result, errout.str());
|
||||||
|
check(code, true, false, Settings::Win64);
|
||||||
|
ASSERT_EQUALS(result_win64, errout.str());
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
const char * code = "void foo() {\n"
|
||||||
" bool b;\n"
|
" bool b;\n"
|
||||||
" char c;\n"
|
" char c;\n"
|
||||||
" signed char sc;\n"
|
" signed char sc;\n"
|
||||||
|
@ -949,8 +1108,8 @@ private:
|
||||||
" void * vp;\n"
|
" void * vp;\n"
|
||||||
" scanf(\"%Lu %Lu %Lu %Lu %Lu %Lu %Lu %Lu %Lu %Lu %Lu %Lu %Lu %Lu %Lu %Lu %Lu %Lu %Lu %Lu %Lu %Lu %Lu\",\n"
|
" scanf(\"%Lu %Lu %Lu %Lu %Lu %Lu %Lu %Lu %Lu %Lu %Lu %Lu %Lu %Lu %Lu %Lu %Lu %Lu %Lu %Lu %Lu %Lu %Lu\",\n"
|
||||||
" &b, &c, &sc, &uc, &s, &us, &i, &ui, &l, &ul, &ll, &ull, &f, &d, &ld, &st, &pt, &it, &ut, &vp, vp, &unknown, unknown);\n"
|
" &b, &c, &sc, &uc, &s, &us, &i, &ui, &l, &ul, &ll, &ull, &f, &d, &ld, &st, &pt, &it, &ut, &vp, vp, &unknown, unknown);\n"
|
||||||
"}\n", true);
|
"}\n";
|
||||||
ASSERT_EQUALS("[test.cpp:22]: (warning) %Lu in format string (no. 1) requires 'unsigned long long *' but the argument type is 'bool *'.\n"
|
std::string result("[test.cpp:22]: (warning) %Lu in format string (no. 1) requires 'unsigned long long *' but the argument type is 'bool *'.\n"
|
||||||
"[test.cpp:22]: (warning) %Lu in format string (no. 2) requires 'unsigned long long *' but the argument type is 'char *'.\n"
|
"[test.cpp:22]: (warning) %Lu in format string (no. 2) requires 'unsigned long long *' but the argument type is 'char *'.\n"
|
||||||
"[test.cpp:22]: (warning) %Lu in format string (no. 3) requires 'unsigned long long *' but the argument type is 'signed char *'.\n"
|
"[test.cpp:22]: (warning) %Lu in format string (no. 3) requires 'unsigned long long *' but the argument type is 'signed char *'.\n"
|
||||||
"[test.cpp:22]: (warning) %Lu in format string (no. 4) requires 'unsigned long long *' but the argument type is 'unsigned char *'.\n"
|
"[test.cpp:22]: (warning) %Lu in format string (no. 4) requires 'unsigned long long *' but the argument type is 'unsigned char *'.\n"
|
||||||
|
@ -969,9 +1128,40 @@ private:
|
||||||
"[test.cpp:22]: (warning) %Lu in format string (no. 18) requires 'unsigned long long *' but the argument type is 'intmax_t * {aka long *}'.\n"
|
"[test.cpp:22]: (warning) %Lu in format string (no. 18) requires 'unsigned long long *' but the argument type is 'intmax_t * {aka long *}'.\n"
|
||||||
"[test.cpp:22]: (warning) %Lu in format string (no. 19) requires 'unsigned long long *' but the argument type is 'uintmax_t * {aka unsigned long *}'.\n"
|
"[test.cpp:22]: (warning) %Lu in format string (no. 19) requires 'unsigned long long *' but the argument type is 'uintmax_t * {aka unsigned long *}'.\n"
|
||||||
"[test.cpp:22]: (warning) %Lu in format string (no. 20) requires 'unsigned long long *' but the argument type is 'void * *'.\n"
|
"[test.cpp:22]: (warning) %Lu in format string (no. 20) requires 'unsigned long long *' but the argument type is 'void * *'.\n"
|
||||||
"[test.cpp:22]: (warning) %Lu in format string (no. 21) requires 'unsigned long long *' but the argument type is 'void *'.\n", errout.str());
|
"[test.cpp:22]: (warning) %Lu in format string (no. 21) requires 'unsigned long long *' but the argument type is 'void *'.\n");
|
||||||
|
std::string result_win64("[test.cpp:22]: (warning) %Lu in format string (no. 1) requires 'unsigned long long *' but the argument type is 'bool *'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %Lu in format string (no. 2) requires 'unsigned long long *' but the argument type is 'char *'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %Lu in format string (no. 3) requires 'unsigned long long *' but the argument type is 'signed char *'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %Lu in format string (no. 4) requires 'unsigned long long *' but the argument type is 'unsigned char *'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %Lu in format string (no. 5) requires 'unsigned long long *' but the argument type is 'short *'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %Lu in format string (no. 6) requires 'unsigned long long *' but the argument type is 'unsigned short *'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %Lu in format string (no. 7) requires 'unsigned long long *' but the argument type is 'int *'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %Lu in format string (no. 8) requires 'unsigned long long *' but the argument type is 'unsigned int *'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %Lu in format string (no. 9) requires 'unsigned long long *' but the argument type is 'long *'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %Lu in format string (no. 10) requires 'unsigned long long *' but the argument type is 'unsigned long *'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %Lu in format string (no. 11) requires 'unsigned long long *' but the argument type is 'long long *'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %Lu in format string (no. 13) requires 'unsigned long long *' but the argument type is 'float *'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %Lu in format string (no. 14) requires 'unsigned long long *' but the argument type is 'double *'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %Lu in format string (no. 15) requires 'unsigned long long *' but the argument type is 'long double *'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %Lu in format string (no. 16) requires 'unsigned long long *' but the argument type is 'size_t * {aka unsigned long long *}'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %Lu in format string (no. 17) requires 'unsigned long long *' but the argument type is 'ptrdiff_t * {aka long long *}'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %Lu in format string (no. 18) requires 'unsigned long long *' but the argument type is 'intmax_t * {aka long long *}'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %Lu in format string (no. 19) requires 'unsigned long long *' but the argument type is 'uintmax_t * {aka unsigned long long *}'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %Lu in format string (no. 20) requires 'unsigned long long *' but the argument type is 'void * *'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %Lu in format string (no. 21) requires 'unsigned long long *' but the argument type is 'void *'.\n");
|
||||||
|
|
||||||
check("void foo() {\n"
|
check(code, true, false, Settings::Unix32);
|
||||||
|
ASSERT_EQUALS(result, errout.str());
|
||||||
|
check(code, true, false, Settings::Unix64);
|
||||||
|
ASSERT_EQUALS(result, errout.str());
|
||||||
|
check(code, true, false, Settings::Win32A);
|
||||||
|
ASSERT_EQUALS(result, errout.str());
|
||||||
|
check(code, true, false, Settings::Win64);
|
||||||
|
// FIXME ASSERT_EQUALS(result_win64, errout.str());
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
const char * code = "void foo() {\n"
|
||||||
" bool b;\n"
|
" bool b;\n"
|
||||||
" char c;\n"
|
" char c;\n"
|
||||||
" signed char sc;\n"
|
" signed char sc;\n"
|
||||||
|
@ -994,8 +1184,9 @@ private:
|
||||||
" void * vp;\n"
|
" void * vp;\n"
|
||||||
" scanf(\"%ju %ju %ju %ju %ju %ju %ju %ju %ju %ju %ju %ju %ju %ju %ju %ju %ju %ju %ju %ju %ju %ju %ju\",\n"
|
" scanf(\"%ju %ju %ju %ju %ju %ju %ju %ju %ju %ju %ju %ju %ju %ju %ju %ju %ju %ju %ju %ju %ju %ju %ju\",\n"
|
||||||
" &b, &c, &sc, &uc, &s, &us, &i, &ui, &l, &ul, &ll, &ull, &f, &d, &ld, &st, &pt, &it, &ut, &vp, vp, &unknown, unknown);\n"
|
" &b, &c, &sc, &uc, &s, &us, &i, &ui, &l, &ul, &ll, &ull, &f, &d, &ld, &st, &pt, &it, &ut, &vp, vp, &unknown, unknown);\n"
|
||||||
"}\n", true);
|
"}\n";
|
||||||
ASSERT_EQUALS("[test.cpp:22]: (warning) %ju in format string (no. 1) requires 'uintmax_t *' but the argument type is 'bool *'.\n"
|
|
||||||
|
std::string result("[test.cpp:22]: (warning) %ju in format string (no. 1) requires 'uintmax_t *' but the argument type is 'bool *'.\n"
|
||||||
"[test.cpp:22]: (warning) %ju in format string (no. 2) requires 'uintmax_t *' but the argument type is 'char *'.\n"
|
"[test.cpp:22]: (warning) %ju in format string (no. 2) requires 'uintmax_t *' but the argument type is 'char *'.\n"
|
||||||
"[test.cpp:22]: (warning) %ju in format string (no. 3) requires 'uintmax_t *' but the argument type is 'signed char *'.\n"
|
"[test.cpp:22]: (warning) %ju in format string (no. 3) requires 'uintmax_t *' but the argument type is 'signed char *'.\n"
|
||||||
"[test.cpp:22]: (warning) %ju in format string (no. 4) requires 'uintmax_t *' but the argument type is 'unsigned char *'.\n"
|
"[test.cpp:22]: (warning) %ju in format string (no. 4) requires 'uintmax_t *' but the argument type is 'unsigned char *'.\n"
|
||||||
|
@ -1014,9 +1205,40 @@ private:
|
||||||
"[test.cpp:22]: (warning) %ju in format string (no. 17) requires 'uintmax_t *' but the argument type is 'ptrdiff_t * {aka long *}'.\n"
|
"[test.cpp:22]: (warning) %ju in format string (no. 17) requires 'uintmax_t *' but the argument type is 'ptrdiff_t * {aka long *}'.\n"
|
||||||
"[test.cpp:22]: (warning) %ju in format string (no. 18) requires 'uintmax_t *' but the argument type is 'intmax_t * {aka long *}'.\n"
|
"[test.cpp:22]: (warning) %ju in format string (no. 18) requires 'uintmax_t *' but the argument type is 'intmax_t * {aka long *}'.\n"
|
||||||
"[test.cpp:22]: (warning) %ju in format string (no. 20) requires 'uintmax_t *' but the argument type is 'void * *'.\n"
|
"[test.cpp:22]: (warning) %ju in format string (no. 20) requires 'uintmax_t *' but the argument type is 'void * *'.\n"
|
||||||
"[test.cpp:22]: (warning) %ju in format string (no. 21) requires 'uintmax_t *' but the argument type is 'void *'.\n", errout.str());
|
"[test.cpp:22]: (warning) %ju in format string (no. 21) requires 'uintmax_t *' but the argument type is 'void *'.\n");
|
||||||
|
std::string result_win64("[test.cpp:22]: (warning) %ju in format string (no. 1) requires 'uintmax_t *' but the argument type is 'bool *'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %ju in format string (no. 2) requires 'uintmax_t *' but the argument type is 'char *'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %ju in format string (no. 3) requires 'uintmax_t *' but the argument type is 'signed char *'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %ju in format string (no. 4) requires 'uintmax_t *' but the argument type is 'unsigned char *'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %ju in format string (no. 5) requires 'uintmax_t *' but the argument type is 'short *'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %ju in format string (no. 6) requires 'uintmax_t *' but the argument type is 'unsigned short *'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %ju in format string (no. 7) requires 'uintmax_t *' but the argument type is 'int *'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %ju in format string (no. 8) requires 'uintmax_t *' but the argument type is 'unsigned int *'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %ju in format string (no. 9) requires 'uintmax_t *' but the argument type is 'long *'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %ju in format string (no. 10) requires 'uintmax_t *' but the argument type is 'unsigned long *'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %ju in format string (no. 11) requires 'uintmax_t *' but the argument type is 'long long *'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %ju in format string (no. 12) requires 'uintmax_t *' but the argument type is 'unsigned long long *'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %ju in format string (no. 13) requires 'uintmax_t *' but the argument type is 'float *'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %ju in format string (no. 14) requires 'uintmax_t *' but the argument type is 'double *'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %ju in format string (no. 15) requires 'uintmax_t *' but the argument type is 'long double *'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %ju in format string (no. 16) requires 'uintmax_t *' but the argument type is 'size_t * {aka unsigned long long *}'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %ju in format string (no. 17) requires 'uintmax_t *' but the argument type is 'ptrdiff_t * {aka long long *}'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %ju in format string (no. 18) requires 'uintmax_t *' but the argument type is 'intmax_t * {aka long long *}'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %ju in format string (no. 20) requires 'uintmax_t *' but the argument type is 'void * *'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %ju in format string (no. 21) requires 'uintmax_t *' but the argument type is 'void *'.\n");
|
||||||
|
|
||||||
check("void foo() {\n"
|
check(code, true, false, Settings::Unix32);
|
||||||
|
ASSERT_EQUALS(result, errout.str());
|
||||||
|
check(code, true, false, Settings::Unix64);
|
||||||
|
ASSERT_EQUALS(result, errout.str());
|
||||||
|
check(code, true, false, Settings::Win32A);
|
||||||
|
ASSERT_EQUALS(result, errout.str());
|
||||||
|
check(code, true, false, Settings::Win64);
|
||||||
|
ASSERT_EQUALS(result_win64, errout.str());
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
const char * code = "void foo() {\n"
|
||||||
" bool b;\n"
|
" bool b;\n"
|
||||||
" char c;\n"
|
" char c;\n"
|
||||||
" signed char sc;\n"
|
" signed char sc;\n"
|
||||||
|
@ -1039,8 +1261,8 @@ private:
|
||||||
" void * vp;\n"
|
" void * vp;\n"
|
||||||
" scanf(\"%zu %zu %zu %zu %zu %zu %zu %zu %zu %zu %zu %zu %zu %zu %zu %zu %zu %zu %zu %zu %zu %zu %zu\",\n"
|
" scanf(\"%zu %zu %zu %zu %zu %zu %zu %zu %zu %zu %zu %zu %zu %zu %zu %zu %zu %zu %zu %zu %zu %zu %zu\",\n"
|
||||||
" &b, &c, &sc, &uc, &s, &us, &i, &ui, &l, &ul, &ll, &ull, &f, &d, &ld, &st, &pt, &it, &ut, &vp, vp, &unknown, unknown);\n"
|
" &b, &c, &sc, &uc, &s, &us, &i, &ui, &l, &ul, &ll, &ull, &f, &d, &ld, &st, &pt, &it, &ut, &vp, vp, &unknown, unknown);\n"
|
||||||
"}\n", true);
|
"}\n";
|
||||||
ASSERT_EQUALS("[test.cpp:22]: (warning) %zu in format string (no. 1) requires 'size_t *' but the argument type is 'bool *'.\n"
|
std::string result("[test.cpp:22]: (warning) %zu in format string (no. 1) requires 'size_t *' but the argument type is 'bool *'.\n"
|
||||||
"[test.cpp:22]: (warning) %zu in format string (no. 2) requires 'size_t *' but the argument type is 'char *'.\n"
|
"[test.cpp:22]: (warning) %zu in format string (no. 2) requires 'size_t *' but the argument type is 'char *'.\n"
|
||||||
"[test.cpp:22]: (warning) %zu in format string (no. 3) requires 'size_t *' but the argument type is 'signed char *'.\n"
|
"[test.cpp:22]: (warning) %zu in format string (no. 3) requires 'size_t *' but the argument type is 'signed char *'.\n"
|
||||||
"[test.cpp:22]: (warning) %zu in format string (no. 4) requires 'size_t *' but the argument type is 'unsigned char *'.\n"
|
"[test.cpp:22]: (warning) %zu in format string (no. 4) requires 'size_t *' but the argument type is 'unsigned char *'.\n"
|
||||||
|
@ -1059,7 +1281,37 @@ private:
|
||||||
"[test.cpp:22]: (warning) %zu in format string (no. 18) requires 'size_t *' but the argument type is 'intmax_t * {aka long *}'.\n"
|
"[test.cpp:22]: (warning) %zu in format string (no. 18) requires 'size_t *' but the argument type is 'intmax_t * {aka long *}'.\n"
|
||||||
"[test.cpp:22]: (warning) %zu in format string (no. 19) requires 'size_t *' but the argument type is 'uintmax_t * {aka unsigned long *}'.\n"
|
"[test.cpp:22]: (warning) %zu in format string (no. 19) requires 'size_t *' but the argument type is 'uintmax_t * {aka unsigned long *}'.\n"
|
||||||
"[test.cpp:22]: (warning) %zu in format string (no. 20) requires 'size_t *' but the argument type is 'void * *'.\n"
|
"[test.cpp:22]: (warning) %zu in format string (no. 20) requires 'size_t *' but the argument type is 'void * *'.\n"
|
||||||
"[test.cpp:22]: (warning) %zu in format string (no. 21) requires 'size_t *' but the argument type is 'void *'.\n", errout.str());
|
"[test.cpp:22]: (warning) %zu in format string (no. 21) requires 'size_t *' but the argument type is 'void *'.\n");
|
||||||
|
std::string result_win64("[test.cpp:22]: (warning) %zu in format string (no. 1) requires 'size_t *' but the argument type is 'bool *'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %zu in format string (no. 2) requires 'size_t *' but the argument type is 'char *'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %zu in format string (no. 3) requires 'size_t *' but the argument type is 'signed char *'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %zu in format string (no. 4) requires 'size_t *' but the argument type is 'unsigned char *'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %zu in format string (no. 5) requires 'size_t *' but the argument type is 'short *'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %zu in format string (no. 6) requires 'size_t *' but the argument type is 'unsigned short *'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %zu in format string (no. 7) requires 'size_t *' but the argument type is 'int *'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %zu in format string (no. 8) requires 'size_t *' but the argument type is 'unsigned int *'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %zu in format string (no. 9) requires 'size_t *' but the argument type is 'long *'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %zu in format string (no. 10) requires 'size_t *' but the argument type is 'unsigned long *'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %zu in format string (no. 11) requires 'size_t *' but the argument type is 'long long *'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %zu in format string (no. 12) requires 'size_t *' but the argument type is 'unsigned long long *'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %zu in format string (no. 13) requires 'size_t *' but the argument type is 'float *'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %zu in format string (no. 14) requires 'size_t *' but the argument type is 'double *'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %zu in format string (no. 15) requires 'size_t *' but the argument type is 'long double *'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %zu in format string (no. 17) requires 'size_t *' but the argument type is 'ptrdiff_t * {aka long long *}'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %zu in format string (no. 18) requires 'size_t *' but the argument type is 'intmax_t * {aka long long *}'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %zu in format string (no. 19) requires 'size_t *' but the argument type is 'uintmax_t * {aka unsigned long long *}'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %zu in format string (no. 20) requires 'size_t *' but the argument type is 'void * *'.\n"
|
||||||
|
"[test.cpp:22]: (warning) %zu in format string (no. 21) requires 'size_t *' but the argument type is 'void *'.\n");
|
||||||
|
|
||||||
|
check(code, true, false, Settings::Unix32);
|
||||||
|
ASSERT_EQUALS(result, errout.str());
|
||||||
|
check(code, true, false, Settings::Unix64);
|
||||||
|
ASSERT_EQUALS(result, errout.str());
|
||||||
|
check(code, true, false, Settings::Win32A);
|
||||||
|
ASSERT_EQUALS(result, errout.str());
|
||||||
|
check(code, true, false, Settings::Win64);
|
||||||
|
ASSERT_EQUALS(result_win64, errout.str());
|
||||||
|
}
|
||||||
|
|
||||||
check("void foo() {\n"
|
check("void foo() {\n"
|
||||||
" bool b;\n"
|
" bool b;\n"
|
||||||
|
@ -1152,7 +1404,8 @@ private:
|
||||||
"[test.cpp:22]: (warning) %I64u in format string (no. 20) requires 'unsigned __int64 *' but the argument type is 'void * *'.\n"
|
"[test.cpp:22]: (warning) %I64u in format string (no. 20) requires 'unsigned __int64 *' but the argument type is 'void * *'.\n"
|
||||||
"[test.cpp:22]: (warning) %I64u in format string (no. 21) requires 'unsigned __int64 *' but the argument type is 'void *'.\n", errout.str());
|
"[test.cpp:22]: (warning) %I64u in format string (no. 21) requires 'unsigned __int64 *' but the argument type is 'void *'.\n", errout.str());
|
||||||
|
|
||||||
check("const int * foo() { }\n"
|
{
|
||||||
|
const char * code = "const int * foo() { }\n"
|
||||||
"void foo() {\n"
|
"void foo() {\n"
|
||||||
" bool b;\n"
|
" bool b;\n"
|
||||||
" char c;\n"
|
" char c;\n"
|
||||||
|
@ -1176,8 +1429,8 @@ private:
|
||||||
" void * vp;\n"
|
" void * vp;\n"
|
||||||
" scanf(\"%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d\",\n"
|
" scanf(\"%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d\",\n"
|
||||||
" &b, &c, &sc, &uc, &s, &us, &i, &ui, &l, &ul, &ll, &ull, &f, &d, &ld, &st, &pt, &it, &ut, &vp, vp, \"str\", L\"str\", foo(), &unknown, unknown);\n"
|
" &b, &c, &sc, &uc, &s, &us, &i, &ui, &l, &ul, &ll, &ull, &f, &d, &ld, &st, &pt, &it, &ut, &vp, vp, \"str\", L\"str\", foo(), &unknown, unknown);\n"
|
||||||
"}\n", true);
|
"}\n";
|
||||||
ASSERT_EQUALS("[test.cpp:23]: (warning) %d in format string (no. 1) requires 'int *' but the argument type is 'bool *'.\n"
|
std::string result("[test.cpp:23]: (warning) %d in format string (no. 1) requires 'int *' but the argument type is 'bool *'.\n"
|
||||||
"[test.cpp:23]: (warning) %d in format string (no. 2) requires 'int *' but the argument type is 'char *'.\n"
|
"[test.cpp:23]: (warning) %d in format string (no. 2) requires 'int *' but the argument type is 'char *'.\n"
|
||||||
"[test.cpp:23]: (warning) %d in format string (no. 3) requires 'int *' but the argument type is 'signed char *'.\n"
|
"[test.cpp:23]: (warning) %d in format string (no. 3) requires 'int *' but the argument type is 'signed char *'.\n"
|
||||||
"[test.cpp:23]: (warning) %d in format string (no. 4) requires 'int *' but the argument type is 'unsigned char *'.\n"
|
"[test.cpp:23]: (warning) %d in format string (no. 4) requires 'int *' but the argument type is 'unsigned char *'.\n"
|
||||||
|
@ -1199,9 +1452,43 @@ private:
|
||||||
"[test.cpp:23]: (warning) %d in format string (no. 21) requires 'int *' but the argument type is 'void *'.\n"
|
"[test.cpp:23]: (warning) %d in format string (no. 21) requires 'int *' but the argument type is 'void *'.\n"
|
||||||
"[test.cpp:23]: (warning) %d in format string (no. 22) requires 'int *' but the argument type is 'const char *'.\n"
|
"[test.cpp:23]: (warning) %d in format string (no. 22) requires 'int *' but the argument type is 'const char *'.\n"
|
||||||
"[test.cpp:23]: (warning) %d in format string (no. 23) requires 'int *' but the argument type is 'const wchar_t *'.\n"
|
"[test.cpp:23]: (warning) %d in format string (no. 23) requires 'int *' but the argument type is 'const wchar_t *'.\n"
|
||||||
"[test.cpp:23]: (warning) %d in format string (no. 24) requires 'int *' but the argument type is 'const int *'.\n", errout.str());
|
"[test.cpp:23]: (warning) %d in format string (no. 24) requires 'int *' but the argument type is 'const int *'.\n");
|
||||||
|
std::string result_win64("[test.cpp:23]: (warning) %d in format string (no. 1) requires 'int *' but the argument type is 'bool *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %d in format string (no. 2) requires 'int *' but the argument type is 'char *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %d in format string (no. 3) requires 'int *' but the argument type is 'signed char *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %d in format string (no. 4) requires 'int *' but the argument type is 'unsigned char *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %d in format string (no. 5) requires 'int *' but the argument type is 'short *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %d in format string (no. 6) requires 'int *' but the argument type is 'unsigned short *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %d in format string (no. 8) requires 'int *' but the argument type is 'unsigned int *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %d in format string (no. 9) requires 'int *' but the argument type is 'long *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %d in format string (no. 10) requires 'int *' but the argument type is 'unsigned long *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %d in format string (no. 11) requires 'int *' but the argument type is 'long long *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %d in format string (no. 12) requires 'int *' but the argument type is 'unsigned long long *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %d in format string (no. 13) requires 'int *' but the argument type is 'float *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %d in format string (no. 14) requires 'int *' but the argument type is 'double *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %d in format string (no. 15) requires 'int *' but the argument type is 'long double *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %d in format string (no. 16) requires 'int *' but the argument type is 'size_t * {aka unsigned long long *}'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %d in format string (no. 17) requires 'int *' but the argument type is 'ptrdiff_t * {aka long long *}'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %d in format string (no. 18) requires 'int *' but the argument type is 'intmax_t * {aka long long *}'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %d in format string (no. 19) requires 'int *' but the argument type is 'uintmax_t * {aka unsigned long long *}'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %d in format string (no. 20) requires 'int *' but the argument type is 'void * *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %d in format string (no. 21) requires 'int *' but the argument type is 'void *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %d in format string (no. 22) requires 'int *' but the argument type is 'const char *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %d in format string (no. 23) requires 'int *' but the argument type is 'const wchar_t *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %d in format string (no. 24) requires 'int *' but the argument type is 'const int *'.\n");
|
||||||
|
|
||||||
check("const unsigned int * foo() { }\n"
|
check(code, true, false, Settings::Unix32);
|
||||||
|
ASSERT_EQUALS(result, errout.str());
|
||||||
|
check(code, true, false, Settings::Unix64);
|
||||||
|
ASSERT_EQUALS(result, errout.str());
|
||||||
|
check(code, true, false, Settings::Win32A);
|
||||||
|
ASSERT_EQUALS(result, errout.str());
|
||||||
|
check(code, true, false, Settings::Win64);
|
||||||
|
ASSERT_EQUALS(result_win64, errout.str());
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
const char * code = "const unsigned int * foo() { }\n"
|
||||||
"void foo() {\n"
|
"void foo() {\n"
|
||||||
" bool b;\n"
|
" bool b;\n"
|
||||||
" char c;\n"
|
" char c;\n"
|
||||||
|
@ -1225,8 +1512,8 @@ private:
|
||||||
" void * vp;\n"
|
" void * vp;\n"
|
||||||
" scanf(\"%x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x\",\n"
|
" scanf(\"%x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x\",\n"
|
||||||
" &b, &c, &sc, &uc, &s, &us, &i, &ui, &l, &ul, &ll, &ull, &f, &d, &ld, &st, &pt, &it, &ut, &vp, vp, \"str\", L\"str\", foo(), &unknown, unknown);\n"
|
" &b, &c, &sc, &uc, &s, &us, &i, &ui, &l, &ul, &ll, &ull, &f, &d, &ld, &st, &pt, &it, &ut, &vp, vp, \"str\", L\"str\", foo(), &unknown, unknown);\n"
|
||||||
"}\n", true);
|
"}\n";
|
||||||
ASSERT_EQUALS("[test.cpp:23]: (warning) %x in format string (no. 1) requires 'unsigned int *' but the argument type is 'bool *'.\n"
|
std::string result("[test.cpp:23]: (warning) %x in format string (no. 1) requires 'unsigned int *' but the argument type is 'bool *'.\n"
|
||||||
"[test.cpp:23]: (warning) %x in format string (no. 2) requires 'unsigned int *' but the argument type is 'char *'.\n"
|
"[test.cpp:23]: (warning) %x in format string (no. 2) requires 'unsigned int *' but the argument type is 'char *'.\n"
|
||||||
"[test.cpp:23]: (warning) %x in format string (no. 3) requires 'unsigned int *' but the argument type is 'signed char *'.\n"
|
"[test.cpp:23]: (warning) %x in format string (no. 3) requires 'unsigned int *' but the argument type is 'signed char *'.\n"
|
||||||
"[test.cpp:23]: (warning) %x in format string (no. 4) requires 'unsigned int *' but the argument type is 'unsigned char *'.\n"
|
"[test.cpp:23]: (warning) %x in format string (no. 4) requires 'unsigned int *' but the argument type is 'unsigned char *'.\n"
|
||||||
|
@ -1247,9 +1534,42 @@ private:
|
||||||
"[test.cpp:23]: (warning) %x in format string (no. 21) requires 'unsigned int *' but the argument type is 'void *'.\n"
|
"[test.cpp:23]: (warning) %x in format string (no. 21) requires 'unsigned int *' but the argument type is 'void *'.\n"
|
||||||
"[test.cpp:23]: (warning) %x in format string (no. 22) requires 'unsigned int *' but the argument type is 'const char *'.\n"
|
"[test.cpp:23]: (warning) %x in format string (no. 22) requires 'unsigned int *' but the argument type is 'const char *'.\n"
|
||||||
"[test.cpp:23]: (warning) %x in format string (no. 23) requires 'unsigned int *' but the argument type is 'const wchar_t *'.\n"
|
"[test.cpp:23]: (warning) %x in format string (no. 23) requires 'unsigned int *' but the argument type is 'const wchar_t *'.\n"
|
||||||
"[test.cpp:23]: (warning) %x in format string (no. 24) requires 'unsigned int *' but the argument type is 'const unsigned int *'.\n", errout.str());
|
"[test.cpp:23]: (warning) %x in format string (no. 24) requires 'unsigned int *' but the argument type is 'const unsigned int *'.\n");
|
||||||
|
std::string result_win64("[test.cpp:23]: (warning) %x in format string (no. 1) requires 'unsigned int *' but the argument type is 'bool *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %x in format string (no. 2) requires 'unsigned int *' but the argument type is 'char *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %x in format string (no. 3) requires 'unsigned int *' but the argument type is 'signed char *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %x in format string (no. 4) requires 'unsigned int *' but the argument type is 'unsigned char *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %x in format string (no. 5) requires 'unsigned int *' but the argument type is 'short *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %x in format string (no. 6) requires 'unsigned int *' but the argument type is 'unsigned short *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %x in format string (no. 9) requires 'unsigned int *' but the argument type is 'long *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %x in format string (no. 10) requires 'unsigned int *' but the argument type is 'unsigned long *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %x in format string (no. 11) requires 'unsigned int *' but the argument type is 'long long *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %x in format string (no. 12) requires 'unsigned int *' but the argument type is 'unsigned long long *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %x in format string (no. 13) requires 'unsigned int *' but the argument type is 'float *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %x in format string (no. 14) requires 'unsigned int *' but the argument type is 'double *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %x in format string (no. 15) requires 'unsigned int *' but the argument type is 'long double *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %x in format string (no. 16) requires 'unsigned int *' but the argument type is 'size_t * {aka unsigned long long *}'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %x in format string (no. 17) requires 'unsigned int *' but the argument type is 'ptrdiff_t * {aka long long *}'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %x in format string (no. 18) requires 'unsigned int *' but the argument type is 'intmax_t * {aka long long *}'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %x in format string (no. 19) requires 'unsigned int *' but the argument type is 'uintmax_t * {aka unsigned long long *}'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %x in format string (no. 20) requires 'unsigned int *' but the argument type is 'void * *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %x in format string (no. 21) requires 'unsigned int *' but the argument type is 'void *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %x in format string (no. 22) requires 'unsigned int *' but the argument type is 'const char *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %x in format string (no. 23) requires 'unsigned int *' but the argument type is 'const wchar_t *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %x in format string (no. 24) requires 'unsigned int *' but the argument type is 'const unsigned int *'.\n");
|
||||||
|
|
||||||
check("const float * foo() { }\n"
|
check(code, true, false, Settings::Unix32);
|
||||||
|
ASSERT_EQUALS(result, errout.str());
|
||||||
|
check(code, true, false, Settings::Unix64);
|
||||||
|
ASSERT_EQUALS(result, errout.str());
|
||||||
|
check(code, true, false, Settings::Win32A);
|
||||||
|
ASSERT_EQUALS(result, errout.str());
|
||||||
|
check(code, true, false, Settings::Win64);
|
||||||
|
ASSERT_EQUALS(result_win64, errout.str());
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
const char * code = "const float * foo() { }\n"
|
||||||
"void foo() {\n"
|
"void foo() {\n"
|
||||||
" bool b;\n"
|
" bool b;\n"
|
||||||
" char c;\n"
|
" char c;\n"
|
||||||
|
@ -1273,8 +1593,8 @@ private:
|
||||||
" void * vp;\n"
|
" void * vp;\n"
|
||||||
" scanf(\"%f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f\",\n"
|
" scanf(\"%f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f\",\n"
|
||||||
" &b, &c, &sc, &uc, &s, &us, &i, &ui, &l, &ul, &ll, &ull, &f, &d, &ld, &st, &pt, &it, &ut, &vp, vp, \"str\", L\"str\", foo(), &unknown, unknown);\n"
|
" &b, &c, &sc, &uc, &s, &us, &i, &ui, &l, &ul, &ll, &ull, &f, &d, &ld, &st, &pt, &it, &ut, &vp, vp, \"str\", L\"str\", foo(), &unknown, unknown);\n"
|
||||||
"}\n", true);
|
"}\n";
|
||||||
ASSERT_EQUALS("[test.cpp:23]: (warning) %f in format string (no. 1) requires 'float *' but the argument type is 'bool *'.\n"
|
std::string result("[test.cpp:23]: (warning) %f in format string (no. 1) requires 'float *' but the argument type is 'bool *'.\n"
|
||||||
"[test.cpp:23]: (warning) %f in format string (no. 2) requires 'float *' but the argument type is 'char *'.\n"
|
"[test.cpp:23]: (warning) %f in format string (no. 2) requires 'float *' but the argument type is 'char *'.\n"
|
||||||
"[test.cpp:23]: (warning) %f in format string (no. 3) requires 'float *' but the argument type is 'signed char *'.\n"
|
"[test.cpp:23]: (warning) %f in format string (no. 3) requires 'float *' but the argument type is 'signed char *'.\n"
|
||||||
"[test.cpp:23]: (warning) %f in format string (no. 4) requires 'float *' but the argument type is 'unsigned char *'.\n"
|
"[test.cpp:23]: (warning) %f in format string (no. 4) requires 'float *' but the argument type is 'unsigned char *'.\n"
|
||||||
|
@ -1296,9 +1616,43 @@ private:
|
||||||
"[test.cpp:23]: (warning) %f in format string (no. 21) requires 'float *' but the argument type is 'void *'.\n"
|
"[test.cpp:23]: (warning) %f in format string (no. 21) requires 'float *' but the argument type is 'void *'.\n"
|
||||||
"[test.cpp:23]: (warning) %f in format string (no. 22) requires 'float *' but the argument type is 'const char *'.\n"
|
"[test.cpp:23]: (warning) %f in format string (no. 22) requires 'float *' but the argument type is 'const char *'.\n"
|
||||||
"[test.cpp:23]: (warning) %f in format string (no. 23) requires 'float *' but the argument type is 'const wchar_t *'.\n"
|
"[test.cpp:23]: (warning) %f in format string (no. 23) requires 'float *' but the argument type is 'const wchar_t *'.\n"
|
||||||
"[test.cpp:23]: (warning) %f in format string (no. 24) requires 'float *' but the argument type is 'const float *'.\n", errout.str());
|
"[test.cpp:23]: (warning) %f in format string (no. 24) requires 'float *' but the argument type is 'const float *'.\n");
|
||||||
|
std::string result_win64("[test.cpp:23]: (warning) %f in format string (no. 1) requires 'float *' but the argument type is 'bool *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %f in format string (no. 2) requires 'float *' but the argument type is 'char *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %f in format string (no. 3) requires 'float *' but the argument type is 'signed char *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %f in format string (no. 4) requires 'float *' but the argument type is 'unsigned char *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %f in format string (no. 5) requires 'float *' but the argument type is 'short *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %f in format string (no. 6) requires 'float *' but the argument type is 'unsigned short *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %f in format string (no. 7) requires 'float *' but the argument type is 'int *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %f in format string (no. 8) requires 'float *' but the argument type is 'unsigned int *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %f in format string (no. 9) requires 'float *' but the argument type is 'long *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %f in format string (no. 10) requires 'float *' but the argument type is 'unsigned long *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %f in format string (no. 11) requires 'float *' but the argument type is 'long long *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %f in format string (no. 12) requires 'float *' but the argument type is 'unsigned long long *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %f in format string (no. 14) requires 'float *' but the argument type is 'double *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %f in format string (no. 15) requires 'float *' but the argument type is 'long double *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %f in format string (no. 16) requires 'float *' but the argument type is 'size_t * {aka unsigned long long *}'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %f in format string (no. 17) requires 'float *' but the argument type is 'ptrdiff_t * {aka long long *}'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %f in format string (no. 18) requires 'float *' but the argument type is 'intmax_t * {aka long long *}'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %f in format string (no. 19) requires 'float *' but the argument type is 'uintmax_t * {aka unsigned long long *}'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %f in format string (no. 20) requires 'float *' but the argument type is 'void * *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %f in format string (no. 21) requires 'float *' but the argument type is 'void *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %f in format string (no. 22) requires 'float *' but the argument type is 'const char *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %f in format string (no. 23) requires 'float *' but the argument type is 'const wchar_t *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %f in format string (no. 24) requires 'float *' but the argument type is 'const float *'.\n");
|
||||||
|
|
||||||
check("const double * foo() { }\n"
|
check(code, true, false, Settings::Unix32);
|
||||||
|
ASSERT_EQUALS(result, errout.str());
|
||||||
|
check(code, true, false, Settings::Unix64);
|
||||||
|
ASSERT_EQUALS(result, errout.str());
|
||||||
|
check(code, true, false, Settings::Win32A);
|
||||||
|
ASSERT_EQUALS(result, errout.str());
|
||||||
|
check(code, true, false, Settings::Win64);
|
||||||
|
ASSERT_EQUALS(result_win64, errout.str());
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
const char * code = "const double * foo() { }\n"
|
||||||
"void foo() {\n"
|
"void foo() {\n"
|
||||||
" bool b;\n"
|
" bool b;\n"
|
||||||
" char c;\n"
|
" char c;\n"
|
||||||
|
@ -1322,8 +1676,8 @@ private:
|
||||||
" void * vp;\n"
|
" void * vp;\n"
|
||||||
" scanf(\"%lf %lf %lf %lf %lf %lf %lf %lf %lf %lf %lf %lf %lf %lf %lf %lf %lf %lf %lf %lf %lf %lf %lf %lf %lf %lf\",\n"
|
" scanf(\"%lf %lf %lf %lf %lf %lf %lf %lf %lf %lf %lf %lf %lf %lf %lf %lf %lf %lf %lf %lf %lf %lf %lf %lf %lf %lf\",\n"
|
||||||
" &b, &c, &sc, &uc, &s, &us, &i, &ui, &l, &ul, &ll, &ull, &f, &d, &ld, &st, &pt, &it, &ut, &vp, vp, \"str\", L\"str\", foo(), &unknown, unknown);\n"
|
" &b, &c, &sc, &uc, &s, &us, &i, &ui, &l, &ul, &ll, &ull, &f, &d, &ld, &st, &pt, &it, &ut, &vp, vp, \"str\", L\"str\", foo(), &unknown, unknown);\n"
|
||||||
"}\n", true);
|
"}\n";
|
||||||
ASSERT_EQUALS("[test.cpp:23]: (warning) %lf in format string (no. 1) requires 'double *' but the argument type is 'bool *'.\n"
|
std::string result("[test.cpp:23]: (warning) %lf in format string (no. 1) requires 'double *' but the argument type is 'bool *'.\n"
|
||||||
"[test.cpp:23]: (warning) %lf in format string (no. 2) requires 'double *' but the argument type is 'char *'.\n"
|
"[test.cpp:23]: (warning) %lf in format string (no. 2) requires 'double *' but the argument type is 'char *'.\n"
|
||||||
"[test.cpp:23]: (warning) %lf in format string (no. 3) requires 'double *' but the argument type is 'signed char *'.\n"
|
"[test.cpp:23]: (warning) %lf in format string (no. 3) requires 'double *' but the argument type is 'signed char *'.\n"
|
||||||
"[test.cpp:23]: (warning) %lf in format string (no. 4) requires 'double *' but the argument type is 'unsigned char *'.\n"
|
"[test.cpp:23]: (warning) %lf in format string (no. 4) requires 'double *' but the argument type is 'unsigned char *'.\n"
|
||||||
|
@ -1345,9 +1699,43 @@ private:
|
||||||
"[test.cpp:23]: (warning) %lf in format string (no. 21) requires 'double *' but the argument type is 'void *'.\n"
|
"[test.cpp:23]: (warning) %lf in format string (no. 21) requires 'double *' but the argument type is 'void *'.\n"
|
||||||
"[test.cpp:23]: (warning) %lf in format string (no. 22) requires 'double *' but the argument type is 'const char *'.\n"
|
"[test.cpp:23]: (warning) %lf in format string (no. 22) requires 'double *' but the argument type is 'const char *'.\n"
|
||||||
"[test.cpp:23]: (warning) %lf in format string (no. 23) requires 'double *' but the argument type is 'const wchar_t *'.\n"
|
"[test.cpp:23]: (warning) %lf in format string (no. 23) requires 'double *' but the argument type is 'const wchar_t *'.\n"
|
||||||
"[test.cpp:23]: (warning) %lf in format string (no. 24) requires 'double *' but the argument type is 'const double *'.\n", errout.str());
|
"[test.cpp:23]: (warning) %lf in format string (no. 24) requires 'double *' but the argument type is 'const double *'.\n");
|
||||||
|
std::string result_win64("[test.cpp:23]: (warning) %lf in format string (no. 1) requires 'double *' but the argument type is 'bool *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %lf in format string (no. 2) requires 'double *' but the argument type is 'char *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %lf in format string (no. 3) requires 'double *' but the argument type is 'signed char *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %lf in format string (no. 4) requires 'double *' but the argument type is 'unsigned char *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %lf in format string (no. 5) requires 'double *' but the argument type is 'short *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %lf in format string (no. 6) requires 'double *' but the argument type is 'unsigned short *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %lf in format string (no. 7) requires 'double *' but the argument type is 'int *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %lf in format string (no. 8) requires 'double *' but the argument type is 'unsigned int *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %lf in format string (no. 9) requires 'double *' but the argument type is 'long *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %lf in format string (no. 10) requires 'double *' but the argument type is 'unsigned long *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %lf in format string (no. 11) requires 'double *' but the argument type is 'long long *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %lf in format string (no. 12) requires 'double *' but the argument type is 'unsigned long long *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %lf in format string (no. 13) requires 'double *' but the argument type is 'float *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %lf in format string (no. 15) requires 'double *' but the argument type is 'long double *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %lf in format string (no. 16) requires 'double *' but the argument type is 'size_t * {aka unsigned long long *}'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %lf in format string (no. 17) requires 'double *' but the argument type is 'ptrdiff_t * {aka long long *}'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %lf in format string (no. 18) requires 'double *' but the argument type is 'intmax_t * {aka long long *}'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %lf in format string (no. 19) requires 'double *' but the argument type is 'uintmax_t * {aka unsigned long long *}'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %lf in format string (no. 20) requires 'double *' but the argument type is 'void * *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %lf in format string (no. 21) requires 'double *' but the argument type is 'void *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %lf in format string (no. 22) requires 'double *' but the argument type is 'const char *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %lf in format string (no. 23) requires 'double *' but the argument type is 'const wchar_t *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %lf in format string (no. 24) requires 'double *' but the argument type is 'const double *'.\n");
|
||||||
|
|
||||||
check("const long double * foo() { }\n"
|
check(code, false, false, Settings::Unix32);
|
||||||
|
ASSERT_EQUALS(result, errout.str());
|
||||||
|
check(code, false, false, Settings::Unix64);
|
||||||
|
ASSERT_EQUALS(result, errout.str());
|
||||||
|
check(code, false, false, Settings::Win32A);
|
||||||
|
ASSERT_EQUALS(result, errout.str());
|
||||||
|
check(code, false, false, Settings::Win64);
|
||||||
|
ASSERT_EQUALS(result_win64, errout.str());
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
const char * code = "const long double * foo() { }\n"
|
||||||
"void foo() {\n"
|
"void foo() {\n"
|
||||||
" bool b;\n"
|
" bool b;\n"
|
||||||
" char c;\n"
|
" char c;\n"
|
||||||
|
@ -1371,8 +1759,8 @@ private:
|
||||||
" void * vp;\n"
|
" void * vp;\n"
|
||||||
" scanf(\"%Lf %Lf %Lf %Lf %Lf %Lf %Lf %Lf %Lf %Lf %Lf %Lf %Lf %Lf %Lf %Lf %Lf %Lf %Lf %Lf %Lf %Lf %Lf %Lf %Lf %Lf\",\n"
|
" scanf(\"%Lf %Lf %Lf %Lf %Lf %Lf %Lf %Lf %Lf %Lf %Lf %Lf %Lf %Lf %Lf %Lf %Lf %Lf %Lf %Lf %Lf %Lf %Lf %Lf %Lf %Lf\",\n"
|
||||||
" &b, &c, &sc, &uc, &s, &us, &i, &ui, &l, &ul, &ll, &ull, &f, &d, &ld, &st, &pt, &it, &ut, &vp, vp, \"str\", L\"str\", foo(), &unknown, unknown);\n"
|
" &b, &c, &sc, &uc, &s, &us, &i, &ui, &l, &ul, &ll, &ull, &f, &d, &ld, &st, &pt, &it, &ut, &vp, vp, \"str\", L\"str\", foo(), &unknown, unknown);\n"
|
||||||
"}\n", true);
|
"}\n";
|
||||||
ASSERT_EQUALS("[test.cpp:23]: (warning) %Lf in format string (no. 1) requires 'long double *' but the argument type is 'bool *'.\n"
|
std::string result("[test.cpp:23]: (warning) %Lf in format string (no. 1) requires 'long double *' but the argument type is 'bool *'.\n"
|
||||||
"[test.cpp:23]: (warning) %Lf in format string (no. 2) requires 'long double *' but the argument type is 'char *'.\n"
|
"[test.cpp:23]: (warning) %Lf in format string (no. 2) requires 'long double *' but the argument type is 'char *'.\n"
|
||||||
"[test.cpp:23]: (warning) %Lf in format string (no. 3) requires 'long double *' but the argument type is 'signed char *'.\n"
|
"[test.cpp:23]: (warning) %Lf in format string (no. 3) requires 'long double *' but the argument type is 'signed char *'.\n"
|
||||||
"[test.cpp:23]: (warning) %Lf in format string (no. 4) requires 'long double *' but the argument type is 'unsigned char *'.\n"
|
"[test.cpp:23]: (warning) %Lf in format string (no. 4) requires 'long double *' but the argument type is 'unsigned char *'.\n"
|
||||||
|
@ -1394,9 +1782,43 @@ private:
|
||||||
"[test.cpp:23]: (warning) %Lf in format string (no. 21) requires 'long double *' but the argument type is 'void *'.\n"
|
"[test.cpp:23]: (warning) %Lf in format string (no. 21) requires 'long double *' but the argument type is 'void *'.\n"
|
||||||
"[test.cpp:23]: (warning) %Lf in format string (no. 22) requires 'long double *' but the argument type is 'const char *'.\n"
|
"[test.cpp:23]: (warning) %Lf in format string (no. 22) requires 'long double *' but the argument type is 'const char *'.\n"
|
||||||
"[test.cpp:23]: (warning) %Lf in format string (no. 23) requires 'long double *' but the argument type is 'const wchar_t *'.\n"
|
"[test.cpp:23]: (warning) %Lf in format string (no. 23) requires 'long double *' but the argument type is 'const wchar_t *'.\n"
|
||||||
"[test.cpp:23]: (warning) %Lf in format string (no. 24) requires 'long double *' but the argument type is 'const long double *'.\n", errout.str());
|
"[test.cpp:23]: (warning) %Lf in format string (no. 24) requires 'long double *' but the argument type is 'const long double *'.\n");
|
||||||
|
std::string result_win64("[test.cpp:23]: (warning) %Lf in format string (no. 1) requires 'long double *' but the argument type is 'bool *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %Lf in format string (no. 2) requires 'long double *' but the argument type is 'char *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %Lf in format string (no. 3) requires 'long double *' but the argument type is 'signed char *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %Lf in format string (no. 4) requires 'long double *' but the argument type is 'unsigned char *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %Lf in format string (no. 5) requires 'long double *' but the argument type is 'short *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %Lf in format string (no. 6) requires 'long double *' but the argument type is 'unsigned short *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %Lf in format string (no. 7) requires 'long double *' but the argument type is 'int *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %Lf in format string (no. 8) requires 'long double *' but the argument type is 'unsigned int *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %Lf in format string (no. 9) requires 'long double *' but the argument type is 'long *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %Lf in format string (no. 10) requires 'long double *' but the argument type is 'unsigned long *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %Lf in format string (no. 11) requires 'long double *' but the argument type is 'long long *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %Lf in format string (no. 12) requires 'long double *' but the argument type is 'unsigned long long *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %Lf in format string (no. 13) requires 'long double *' but the argument type is 'float *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %Lf in format string (no. 14) requires 'long double *' but the argument type is 'double *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %Lf in format string (no. 16) requires 'long double *' but the argument type is 'size_t * {aka unsigned long long *}'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %Lf in format string (no. 17) requires 'long double *' but the argument type is 'ptrdiff_t * {aka long long *}'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %Lf in format string (no. 18) requires 'long double *' but the argument type is 'intmax_t * {aka long long *}'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %Lf in format string (no. 19) requires 'long double *' but the argument type is 'uintmax_t * {aka unsigned long long *}'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %Lf in format string (no. 20) requires 'long double *' but the argument type is 'void * *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %Lf in format string (no. 21) requires 'long double *' but the argument type is 'void *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %Lf in format string (no. 22) requires 'long double *' but the argument type is 'const char *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %Lf in format string (no. 23) requires 'long double *' but the argument type is 'const wchar_t *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %Lf in format string (no. 24) requires 'long double *' but the argument type is 'const long double *'.\n");
|
||||||
|
|
||||||
check("const int * foo() { }\n"
|
check(code, false, false, Settings::Unix32);
|
||||||
|
ASSERT_EQUALS(result, errout.str());
|
||||||
|
check(code, false, false, Settings::Unix64);
|
||||||
|
ASSERT_EQUALS(result, errout.str());
|
||||||
|
check(code, false, false, Settings::Win32A);
|
||||||
|
ASSERT_EQUALS(result, errout.str());
|
||||||
|
check(code, false, false, Settings::Win64);
|
||||||
|
ASSERT_EQUALS(result_win64, errout.str());
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
const char * code = "const int * foo() { }\n"
|
||||||
"void foo() {\n"
|
"void foo() {\n"
|
||||||
" bool b;\n"
|
" bool b;\n"
|
||||||
" char c;\n"
|
" char c;\n"
|
||||||
|
@ -1420,8 +1842,8 @@ private:
|
||||||
" void * vp;\n"
|
" void * vp;\n"
|
||||||
" scanf(\"%n %n %n %n %n %n %n %n %n %n %n %n %n %n %n %n %n %n %n %n %n %n %n %n %n %n\",\n"
|
" scanf(\"%n %n %n %n %n %n %n %n %n %n %n %n %n %n %n %n %n %n %n %n %n %n %n %n %n %n\",\n"
|
||||||
" &b, &c, &sc, &uc, &s, &us, &i, &ui, &l, &ul, &ll, &ull, &f, &d, &ld, &st, &pt, &it, &ut, &vp, vp, \"str\", L\"str\", foo(), &unknown, unknown);\n"
|
" &b, &c, &sc, &uc, &s, &us, &i, &ui, &l, &ul, &ll, &ull, &f, &d, &ld, &st, &pt, &it, &ut, &vp, vp, \"str\", L\"str\", foo(), &unknown, unknown);\n"
|
||||||
"}\n", true);
|
"}\n";
|
||||||
ASSERT_EQUALS("[test.cpp:23]: (warning) %n in format string (no. 1) requires 'int *' but the argument type is 'bool *'.\n"
|
std::string result("[test.cpp:23]: (warning) %n in format string (no. 1) requires 'int *' but the argument type is 'bool *'.\n"
|
||||||
"[test.cpp:23]: (warning) %n in format string (no. 2) requires 'int *' but the argument type is 'char *'.\n"
|
"[test.cpp:23]: (warning) %n in format string (no. 2) requires 'int *' but the argument type is 'char *'.\n"
|
||||||
"[test.cpp:23]: (warning) %n in format string (no. 3) requires 'int *' but the argument type is 'signed char *'.\n"
|
"[test.cpp:23]: (warning) %n in format string (no. 3) requires 'int *' but the argument type is 'signed char *'.\n"
|
||||||
"[test.cpp:23]: (warning) %n in format string (no. 4) requires 'int *' but the argument type is 'unsigned char *'.\n"
|
"[test.cpp:23]: (warning) %n in format string (no. 4) requires 'int *' but the argument type is 'unsigned char *'.\n"
|
||||||
|
@ -1443,7 +1865,40 @@ private:
|
||||||
"[test.cpp:23]: (warning) %n in format string (no. 21) requires 'int *' but the argument type is 'void *'.\n"
|
"[test.cpp:23]: (warning) %n in format string (no. 21) requires 'int *' but the argument type is 'void *'.\n"
|
||||||
"[test.cpp:23]: (warning) %n in format string (no. 22) requires 'int *' but the argument type is 'const char *'.\n"
|
"[test.cpp:23]: (warning) %n in format string (no. 22) requires 'int *' but the argument type is 'const char *'.\n"
|
||||||
"[test.cpp:23]: (warning) %n in format string (no. 23) requires 'int *' but the argument type is 'const wchar_t *'.\n"
|
"[test.cpp:23]: (warning) %n in format string (no. 23) requires 'int *' but the argument type is 'const wchar_t *'.\n"
|
||||||
"[test.cpp:23]: (warning) %n in format string (no. 24) requires 'int *' but the argument type is 'const int *'.\n", errout.str());
|
"[test.cpp:23]: (warning) %n in format string (no. 24) requires 'int *' but the argument type is 'const int *'.\n");
|
||||||
|
std::string result_win64("[test.cpp:23]: (warning) %n in format string (no. 1) requires 'int *' but the argument type is 'bool *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %n in format string (no. 2) requires 'int *' but the argument type is 'char *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %n in format string (no. 3) requires 'int *' but the argument type is 'signed char *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %n in format string (no. 4) requires 'int *' but the argument type is 'unsigned char *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %n in format string (no. 5) requires 'int *' but the argument type is 'short *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %n in format string (no. 6) requires 'int *' but the argument type is 'unsigned short *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %n in format string (no. 8) requires 'int *' but the argument type is 'unsigned int *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %n in format string (no. 9) requires 'int *' but the argument type is 'long *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %n in format string (no. 10) requires 'int *' but the argument type is 'unsigned long *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %n in format string (no. 11) requires 'int *' but the argument type is 'long long *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %n in format string (no. 12) requires 'int *' but the argument type is 'unsigned long long *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %n in format string (no. 13) requires 'int *' but the argument type is 'float *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %n in format string (no. 14) requires 'int *' but the argument type is 'double *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %n in format string (no. 15) requires 'int *' but the argument type is 'long double *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %n in format string (no. 16) requires 'int *' but the argument type is 'size_t * {aka unsigned long long *}'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %n in format string (no. 17) requires 'int *' but the argument type is 'ptrdiff_t * {aka long long *}'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %n in format string (no. 18) requires 'int *' but the argument type is 'intmax_t * {aka long long *}'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %n in format string (no. 19) requires 'int *' but the argument type is 'uintmax_t * {aka unsigned long long *}'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %n in format string (no. 20) requires 'int *' but the argument type is 'void * *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %n in format string (no. 21) requires 'int *' but the argument type is 'void *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %n in format string (no. 22) requires 'int *' but the argument type is 'const char *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %n in format string (no. 23) requires 'int *' but the argument type is 'const wchar_t *'.\n"
|
||||||
|
"[test.cpp:23]: (warning) %n in format string (no. 24) requires 'int *' but the argument type is 'const int *'.\n");
|
||||||
|
|
||||||
|
check(code, false, false, Settings::Unix32);
|
||||||
|
ASSERT_EQUALS(result, errout.str());
|
||||||
|
check(code, false, false, Settings::Unix64);
|
||||||
|
ASSERT_EQUALS(result, errout.str());
|
||||||
|
check(code, false, false, Settings::Win32A);
|
||||||
|
ASSERT_EQUALS(result, errout.str());
|
||||||
|
check(code, false, false, Settings::Win64);
|
||||||
|
ASSERT_EQUALS(result_win64, errout.str());
|
||||||
|
}
|
||||||
|
|
||||||
check("void g() {\n" // #5104
|
check("void g() {\n" // #5104
|
||||||
" myvector<int> v1(1);\n"
|
" myvector<int> v1(1);\n"
|
||||||
|
@ -1459,15 +1914,27 @@ private:
|
||||||
"}\n");
|
"}\n");
|
||||||
ASSERT_EQUALS("", errout.str());
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
|
||||||
check("void g() {\n" // #5348
|
{
|
||||||
|
const char * code = "void g() {\n" // #5348
|
||||||
" size_t s1;\n"
|
" size_t s1;\n"
|
||||||
" ptrdiff_t s2;\n"
|
" ptrdiff_t s2;\n"
|
||||||
" ssize_t s3;\n"
|
" ssize_t s3;\n"
|
||||||
" scanf(\"%zd\", &s1);\n"
|
" scanf(\"%zd\", &s1);\n"
|
||||||
" scanf(\"%zd\", &s2);\n"
|
" scanf(\"%zd\", &s2);\n"
|
||||||
" scanf(\"%zd\", &s3);\n"
|
" scanf(\"%zd\", &s3);\n"
|
||||||
"}\n");
|
"}\n";
|
||||||
ASSERT_EQUALS("[test.cpp:5]: (warning) %zd in format string (no. 1) requires 'ptrdiff_t *' but the argument type is 'size_t * {aka unsigned long *}'.\n", errout.str());
|
std::string result("[test.cpp:5]: (warning) %zd in format string (no. 1) requires 'ptrdiff_t *' but the argument type is 'size_t * {aka unsigned long *}'.\n");
|
||||||
|
std::string result_win64("[test.cpp:5]: (warning) %zd in format string (no. 1) requires 'ptrdiff_t *' but the argument type is 'size_t * {aka unsigned long long *}'.\n");
|
||||||
|
|
||||||
|
check(code, false, false, Settings::Unix32);
|
||||||
|
ASSERT_EQUALS(result, errout.str());
|
||||||
|
check(code, false, false, Settings::Unix64);
|
||||||
|
ASSERT_EQUALS(result, errout.str());
|
||||||
|
check(code, false, false, Settings::Win32A);
|
||||||
|
ASSERT_EQUALS(result, errout.str());
|
||||||
|
check(code, false, false, Settings::Win64);
|
||||||
|
ASSERT_EQUALS(result_win64, errout.str());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue