std.cfg: add support for smartptr member functions (#5113)
* std.cfg: add support for smartptr member functions * Fix test * Fix
This commit is contained in:
parent
1b98be458d
commit
f2976e5bb5
17
cfg/std.cfg
17
cfg/std.cfg
|
@ -7373,9 +7373,10 @@ initializer list (7) string& replace (const_iterator i1, const_iterator i2, init
|
|||
</arg>
|
||||
</function>
|
||||
<!-- void std::ifstream::close(); -->
|
||||
<function name="std::ifstream::close">
|
||||
<!-- void std::ofstream::close(); -->
|
||||
<!-- void std::fstream::close(); -->
|
||||
<function name="std::ifstream::close,std::ofstream::close,std::fstream::close">
|
||||
<noreturn>false</noreturn>
|
||||
<leak-ignore/>
|
||||
<returnValue type="void"/>
|
||||
</function>
|
||||
<!-- void std::fstream::open(const char* filename, ios_base::openmode mode = ios_base::in | ios_base::out); -->
|
||||
|
@ -8588,6 +8589,18 @@ initializer list (7) string& replace (const_iterator i1, const_iterator i2, init
|
|||
<const/>
|
||||
<returnValue type="void *"/>
|
||||
</function>
|
||||
<function name="std::auto_ptr::reset,std::shared_ptr::reset,std::unique_ptr::reset,std::weak_ptr::reset">
|
||||
<noreturn>false</noreturn>
|
||||
<arg nr="1" direction="in" default="0">
|
||||
<not-uninit/>
|
||||
</arg>
|
||||
<returnValue type="void *"/>
|
||||
</function>
|
||||
<function name="std::auto_ptr::release,std::unique_ptr::release">
|
||||
<use-retval/>
|
||||
<noreturn>false</noreturn>
|
||||
<returnValue type="void *"/>
|
||||
</function>
|
||||
<memory>
|
||||
<alloc init="false" buffer-size="malloc">malloc</alloc>
|
||||
<alloc init="true" buffer-size="calloc">calloc</alloc>
|
||||
|
|
|
@ -4723,3 +4723,20 @@ void smartPtr_get()
|
|||
//cppcheck-suppress nullPointer
|
||||
*p = 1;
|
||||
}
|
||||
|
||||
void smartPtr_reset()
|
||||
{
|
||||
std::unique_ptr<int> p(new int());
|
||||
p.reset(nullptr);
|
||||
//cppcheck-suppress nullPointer
|
||||
*p = 1;
|
||||
}
|
||||
|
||||
void smartPtr_release()
|
||||
{
|
||||
std::unique_ptr<int> p{ new int() };
|
||||
//cppcheck-suppress ignoredReturnValue
|
||||
p.release();
|
||||
//cppcheck-suppress nullPointer
|
||||
*p = 1;
|
||||
}
|
|
@ -2002,9 +2002,7 @@ private:
|
|||
" p->h(i);\n"
|
||||
" p.reset(nullptr);\n"
|
||||
"}\n", "test.cpp", &s);
|
||||
TODO_ASSERT_EQUALS("[test.cpp:5]: (information) --check-library: There is no matching configuration for function T::h()\n",
|
||||
"[test.cpp:5]: (information) --check-library: There is no matching configuration for function T::h()\n"
|
||||
"[test.cpp:6]: (information) --check-library: There is no matching configuration for function std::shared_ptr::reset()\n",
|
||||
ASSERT_EQUALS("[test.cpp:5]: (information) --check-library: There is no matching configuration for function T::h()\n",
|
||||
errout.str());
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue