#6559 Regression/ false positive: Return value of allocation function OpenFile is not stored. Add required definitions to windows.cfg, include afx_msg. Add test file test/cfg/windows.cpp to check windows configuration. Fix for gnu.cfg. FileLister now features a non-recursive mode.
This commit is contained in:
parent
6646a896f9
commit
b5f0eec44a
|
@ -126,7 +126,7 @@
|
||||||
<arg nr="6"/>
|
<arg nr="6"/>
|
||||||
</function>
|
</function>
|
||||||
<!-- int fcvt_r (double value, int ndigit, int *decpt, int *neg, char *buf, size_t len); -->
|
<!-- int fcvt_r (double value, int ndigit, int *decpt, int *neg, char *buf, size_t len); -->
|
||||||
<function name="ecvt_r">
|
<function name="fcvt_r">
|
||||||
<noreturn>false</noreturn>
|
<noreturn>false</noreturn>
|
||||||
<arg nr="1">
|
<arg nr="1">
|
||||||
<not-uninit/>
|
<not-uninit/>
|
||||||
|
|
|
@ -1444,9 +1444,27 @@
|
||||||
<not-null/>
|
<not-null/>
|
||||||
</arg>
|
</arg>
|
||||||
</function>
|
</function>
|
||||||
|
<function name="CloseHandle">
|
||||||
|
<noreturn>false</noreturn>
|
||||||
|
<arg nr="1">
|
||||||
|
<not-uninit/>
|
||||||
|
</arg>
|
||||||
|
</function>
|
||||||
|
<function name="OpenFile">
|
||||||
|
<noreturn>false</noreturn>
|
||||||
|
<arg nr="1">
|
||||||
|
<not-uninit/>
|
||||||
|
<not-null/>
|
||||||
|
</arg>
|
||||||
|
<arg nr="2"/>
|
||||||
|
<arg nr="3">
|
||||||
|
<not-uninit/>
|
||||||
|
</arg>
|
||||||
|
</function>
|
||||||
<podtype name="LARGE_INTEGER" sign="s" size="8"/>
|
<podtype name="LARGE_INTEGER" sign="s" size="8"/>
|
||||||
<podtype name="POINTER_SIGNED" sign="s"/>
|
<podtype name="POINTER_SIGNED" sign="s"/>
|
||||||
<podtype name="POINTER_UNSIGNED" sign="u"/>
|
<podtype name="POINTER_UNSIGNED" sign="u"/>
|
||||||
<podtype name="ULARGE_INTEGER" sign="u" size="8"/>
|
<podtype name="ULARGE_INTEGER" sign="u" size="8"/>
|
||||||
<define name="INVALID_HANDLE_VALUE" value="0"/>
|
<define name="INVALID_HANDLE_VALUE" value="0"/>
|
||||||
|
<define name="afx_msg" value=""/>
|
||||||
</def>
|
</def>
|
||||||
|
|
|
@ -17,6 +17,10 @@ ${CPPCHECK} --check-library --library=posix --enable=information --enable=style
|
||||||
gcc -fsyntax-only -D_GNU_SOURCE ${DIR}gnu.c
|
gcc -fsyntax-only -D_GNU_SOURCE ${DIR}gnu.c
|
||||||
${CPPCHECK} --check-library --library=gnu --enable=information --enable=style --error-exitcode=1 --suppress=missingIncludeSystem --inline-suppr ${DIR}gnu.c
|
${CPPCHECK} --check-library --library=gnu --enable=information --enable=style --error-exitcode=1 --suppress=missingIncludeSystem --inline-suppr ${DIR}gnu.c
|
||||||
|
|
||||||
|
# windows.cpp
|
||||||
|
#g++ -fsyntax-only ${DIR}windows.cpp
|
||||||
|
${CPPCHECK} --check-library --library=windows --enable=information --enable=style --error-exitcode=1 --suppress=missingIncludeSystem --inline-suppr ${DIR}windows.cpp
|
||||||
|
|
||||||
# std.c
|
# std.c
|
||||||
gcc -fsyntax-only ${DIR}std.c
|
gcc -fsyntax-only ${DIR}std.c
|
||||||
${CPPCHECK} --check-library --enable=information --error-exitcode=1 --enable=style --suppress=missingIncludeSystem --inline-suppr ${DIR}std.c
|
${CPPCHECK} --check-library --enable=information --error-exitcode=1 --enable=style --suppress=missingIncludeSystem --inline-suppr ${DIR}std.c
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
// Test library configuration for windows.cfg
|
||||||
|
//
|
||||||
|
// Usage:
|
||||||
|
// $ cppcheck --check-library --library=windows --enable=information --enable=style --error-exitcode=1 --suppress=missingIncludeSystem --inline-suppr test/cfg/windows.cpp
|
||||||
|
// =>
|
||||||
|
// No warnings about bad library configuration, unmatched suppressions, etc. exitcode=0
|
||||||
|
//
|
||||||
|
|
||||||
|
class CSharedFilesCtrl {
|
||||||
|
void OpenFile(const CShareableFile* file);
|
||||||
|
afx_msg void OnNmDblClk(NMHDR *pNMHDR, LRESULT *pResult);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
void CSharedFilesCtrl::OnNmDblClk(NMHDR* /*pNMHDR*/, LRESULT* pResult) {
|
||||||
|
if (file)
|
||||||
|
OpenFile(file);
|
||||||
|
}
|
|
@ -87,10 +87,11 @@ static void compilefiles(std::ostream &fout, const std::vector<std::string> &fil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void getCppFiles(std::vector<std::string> &files, const std::string &path)
|
static void getCppFiles(std::vector<std::string> &files, const std::string &path, bool recursive)
|
||||||
{
|
{
|
||||||
std::map<std::string,size_t> filemap;
|
std::map<std::string,size_t> filemap;
|
||||||
FileLister::recursiveAddFiles(filemap, path);
|
const std::set<std::string> extra;
|
||||||
|
FileLister::addFiles(filemap, path, extra, recursive);
|
||||||
|
|
||||||
// add *.cpp files to the "files" vector..
|
// add *.cpp files to the "files" vector..
|
||||||
for (std::map<std::string,size_t>::const_iterator it = filemap.begin(); it != filemap.end(); ++it) {
|
for (std::map<std::string,size_t>::const_iterator it = filemap.begin(); it != filemap.end(); ++it) {
|
||||||
|
@ -153,16 +154,16 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
// Get files..
|
// Get files..
|
||||||
std::vector<std::string> libfiles;
|
std::vector<std::string> libfiles;
|
||||||
getCppFiles(libfiles, "lib/");
|
getCppFiles(libfiles, "lib/", false);
|
||||||
|
|
||||||
std::vector<std::string> clifiles;
|
std::vector<std::string> clifiles;
|
||||||
getCppFiles(clifiles, "cli/");
|
getCppFiles(clifiles, "cli/", false);
|
||||||
|
|
||||||
std::vector<std::string> testfiles;
|
std::vector<std::string> testfiles;
|
||||||
getCppFiles(testfiles, "test/");
|
getCppFiles(testfiles, "test/", false);
|
||||||
|
|
||||||
std::vector<std::string> toolsfiles;
|
std::vector<std::string> toolsfiles;
|
||||||
getCppFiles(toolsfiles, "tools/");
|
getCppFiles(toolsfiles, "tools/", false);
|
||||||
|
|
||||||
if (libfiles.empty() && clifiles.empty() && testfiles.empty()) {
|
if (libfiles.empty() && clifiles.empty() && testfiles.empty()) {
|
||||||
std::cerr << "No files found. Are you in the correct directory?" << std::endl;
|
std::cerr << "No files found. Are you in the correct directory?" << std::endl;
|
||||||
|
@ -170,7 +171,7 @@ int main(int argc, char **argv)
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::string> externalfiles;
|
std::vector<std::string> externalfiles;
|
||||||
getCppFiles(externalfiles, "externals/");
|
getCppFiles(externalfiles, "externals/", true);
|
||||||
|
|
||||||
|
|
||||||
// QMAKE - lib/lib.pri
|
// QMAKE - lib/lib.pri
|
||||||
|
|
Loading…
Reference in New Issue