Fixed #7711 (QString::asprintf format string checking.)
This commit is contained in:
parent
706877df2d
commit
28e14f0b94
10
cfg/qt.cfg
10
cfg/qt.cfg
|
@ -78,6 +78,16 @@
|
|||
<not-uninit/>
|
||||
</arg>
|
||||
</function>
|
||||
<!-- QString & QString::asprintf(const char * cformat, ...); -->
|
||||
<function name="QString::asprintf">
|
||||
<noreturn>false</noreturn>
|
||||
<leak-ignore/>
|
||||
<formatstr/>
|
||||
<arg nr="1">
|
||||
<formatstr/>
|
||||
<not-uninit/>
|
||||
</arg>
|
||||
</function>
|
||||
<define name="Q_DECL_EXPORT" value=""/>
|
||||
<define name="Q_DECL_IMPORT" value=""/>
|
||||
<define name="Q_DECLARE_FLAGS(x,y)" value=""/>
|
||||
|
|
|
@ -2828,6 +2828,12 @@ private:
|
|||
" string.sprintf(\"%d\", f);\n"
|
||||
"}", false, false, Settings::Win32A);
|
||||
ASSERT_EQUALS("[test.cpp:3]: (warning) %d in format string (no. 1) requires 'int' but the argument type is 'float'.\n", errout.str());
|
||||
|
||||
check("void foo(float f) {\n"
|
||||
" QString string;\n"
|
||||
" string = QString::asprintf(\"%d\", f);\n"
|
||||
"}", false, false, Settings::Win32A);
|
||||
ASSERT_EQUALS("[test.cpp:3]: (warning) %d in format string (no. 1) requires 'int' but the argument type is 'float'.\n", errout.str());
|
||||
}
|
||||
|
||||
void testTernary() { // ticket #6182
|
||||
|
|
Loading…
Reference in New Issue