std.cfg: Improved configuration of std::*stream::open().

This commit is contained in:
orbitcowboy 2022-05-10 10:07:55 +02:00
parent 6a3520164a
commit 1382cd837e
2 changed files with 74 additions and 2 deletions

View File

@ -7166,12 +7166,16 @@ initializer list (7) string& replace (const_iterator i1, const_iterator i2, init
<not-uninit/> <not-uninit/>
</arg> </arg>
</function> </function>
<!-- void std::ofstream::open(const char* filename , ios_base::openmode mode = ios_base::out); -->
<!-- void std::ofstream::open(const std::string & filename, ios_base::openmode mode = ios_base::out); --> <!-- void std::ofstream::open(const std::string & filename, ios_base::openmode mode = ios_base::out); -->
<function name="std::ofstream::open"> <function name="std::ofstream::open">
<noreturn>false</noreturn> <noreturn>false</noreturn>
<leak-ignore/> <leak-ignore/>
<returnValue type="void"/> <returnValue type="void"/>
<arg nr="1" direction="in"/> <arg nr="1" direction="in">
<not-null/>
<not-uninit/>
</arg>
<arg nr="2" direction="in" default="std::ios_base::out"> <arg nr="2" direction="in" default="std::ios_base::out">
<not-uninit/> <not-uninit/>
</arg> </arg>
@ -7184,6 +7188,7 @@ initializer list (7) string& replace (const_iterator i1, const_iterator i2, init
<returnValue type="void"/> <returnValue type="void"/>
<arg nr="1" direction="in"> <arg nr="1" direction="in">
<not-null/> <not-null/>
<not-uninit/>
</arg> </arg>
<arg nr="2" direction="in" default="std::ios_base::in"> <arg nr="2" direction="in" default="std::ios_base::in">
<not-uninit/> <not-uninit/>
@ -7197,6 +7202,7 @@ initializer list (7) string& replace (const_iterator i1, const_iterator i2, init
<returnValue type="void"/> <returnValue type="void"/>
<arg nr="1" direction="in"> <arg nr="1" direction="in">
<not-null/> <not-null/>
<not-uninit/>
</arg> </arg>
<arg nr="2" direction="in" default="std::ios_base::in | std::ios_base::out"> <arg nr="2" direction="in" default="std::ios_base::in | std::ios_base::out">
<not-uninit/> <not-uninit/>

View File

@ -33,7 +33,73 @@
#include <iterator> #include <iterator>
#include <vector> #include <vector>
void nullPointer_std_ifstream_open(std::fstream &fs, const std::string &strFileName, const char* filename, std::ios_base::openmode mode) void uninitvar_std_fstream_open(std::fstream &fs, const std::string &strFileName, const char* filename, std::ios_base::openmode mode)
{
std::string s;
const char *ptr;
std::ios_base::openmode m;
fs.open(s, mode);
// cppcheck-suppress uninitvar
fs.open(ptr, mode);
// TODO cppcheck-suppress uninitvar
fs.open(filename, m);
// TODO cppcheck-suppress uninitvar
fs.open(strFileName, m);
fs.open(s);
// TODO cppcheck-suppress uninitvar
fs.open(ptr);
}
void uninitvar_std_ifstream_open(std::ifstream &ifs, const std::string &strFileName, const char* filename, std::ios_base::openmode mode)
{
std::string s;
const char *ptr;
std::ios_base::openmode m;
ifs.open(s, mode);
// cppcheck-suppress uninitvar
ifs.open(ptr, mode);
// TODO cppcheck-suppress uninitvar
ifs.open(filename, m);
// TODO cppcheck-suppress uninitvar
ifs.open(strFileName, m);
ifs.open(s);
// TODO cppcheck-suppress uninitvar
ifs.open(ptr);
}
void uninitvar_std_ofstream_open(std::ofstream &os, const std::string &strFileName, const char* filename, std::ios_base::openmode mode)
{
std::string s;
const char *ptr;
std::ios_base::openmode m;
os.open(s, mode);
// cppcheck-suppress uninitvar
os.open(ptr, mode);
// TODO cppcheck-suppress uninitvar
os.open(filename, m);
// TODO cppcheck-suppress uninitvar
os.open(strFileName, m);
os.open(s);
// TODO cppcheck-suppress uninitvar
os.open(ptr);
}
void nullPointer_std_ofstream_open(std::ofstream &os, const std::string &strFileName, const char* filename, std::ios_base::openmode mode)
{
// cppcheck-suppress nullPointer
os.open(nullptr, mode);
os.open(filename, mode);
os.open(strFileName, mode);
// cppcheck-suppress nullPointer
os.open(nullptr);
os.open(filename);
os.open(strFileName);
}
void nullPointer_std_fstream_open(std::fstream &fs, const std::string &strFileName, const char* filename, std::ios_base::openmode mode)
{ {
// cppcheck-suppress nullPointer // cppcheck-suppress nullPointer
fs.open(nullptr, mode); fs.open(nullptr, mode);