Improve test coverage for %td used with printf

This commit is contained in:
Dmitry-Me 2017-10-18 19:00:40 +03:00
parent bf174f583b
commit 975132bc62
1 changed files with 7 additions and 0 deletions

View File

@ -1960,6 +1960,13 @@ private:
"}");
ASSERT_EQUALS("", errout.str());
check("void foo(long long l, ptrdiff_t p, std::ptrdiff_t sp) {\n"
" printf(\"%td\", p);\n"
" printf(\"%td\", sp);\n"
" printf(\"%td\", l);\n"
"}");
ASSERT_EQUALS("[test.cpp:4]: (warning) %td in format string (no. 1) requires 'ptrdiff_t' but the argument type is 'signed long long'.\n", errout.str());
check("void foo(int i, long double ld) {\n"
" printf(\"%zx %zu\", i, ld);\n"
"}");