qt.cfg: Add support and tests for QFile::exists function (#1645)
Found by daca@home
This commit is contained in:
parent
b6681c2a2e
commit
55ce6d2073
12
cfg/qt.cfg
12
cfg/qt.cfg
|
@ -1137,6 +1137,18 @@
|
||||||
<not-uninit/>
|
<not-uninit/>
|
||||||
</arg>
|
</arg>
|
||||||
</function>
|
</function>
|
||||||
|
<!-- bool QFile::exists(const QString &fileName) // static -->
|
||||||
|
<!-- bool QFile::exists() const -->
|
||||||
|
<function name="QFile::exists">
|
||||||
|
<noreturn>false</noreturn>
|
||||||
|
<returnValue type="bool"/>
|
||||||
|
<use-retval/>
|
||||||
|
<leak-ignore/>
|
||||||
|
<arg nr="1" default="""">
|
||||||
|
<not-uninit/>
|
||||||
|
<not-bool/>
|
||||||
|
</arg>
|
||||||
|
</function>
|
||||||
<!-- bool QFile::open(OpenMode mode) -->
|
<!-- bool QFile::open(OpenMode mode) -->
|
||||||
<!-- bool QFile::open(FILE *fh, OpenMode mode, FileHandleFlags handleFlags = DontCloseHandle) -->
|
<!-- bool QFile::open(FILE *fh, OpenMode mode, FileHandleFlags handleFlags = DontCloseHandle) -->
|
||||||
<!-- bool QFile::open(int fd, OpenMode mode, FileHandleFlags handleFlags = DontCloseHandle) -->
|
<!-- bool QFile::open(int fd, OpenMode mode, FileHandleFlags handleFlags = DontCloseHandle) -->
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QtPlugin>
|
#include <QtPlugin>
|
||||||
|
#include <QFile>
|
||||||
|
|
||||||
|
|
||||||
void QString1(QString s)
|
void QString1(QString s)
|
||||||
|
@ -36,3 +37,18 @@ public:
|
||||||
explicit MacroTest1(QObject *parent = 0);
|
explicit MacroTest1(QObject *parent = 0);
|
||||||
~MacroTest1();
|
~MacroTest1();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void validCode()
|
||||||
|
{
|
||||||
|
if (QFile::exists("test"))
|
||||||
|
{}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ignoredReturnValue()
|
||||||
|
{
|
||||||
|
// cppcheck-suppress ignoredReturnValue
|
||||||
|
QFile::exists("test");
|
||||||
|
QFile file1("test");
|
||||||
|
// cppcheck-suppress ignoredReturnValue
|
||||||
|
file1.exists();
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue