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

View File

@ -33,7 +33,73 @@
#include <iterator>
#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
fs.open(nullptr, mode);