Improve std.cfg: std::addressof(), std::stringstream::str() (#4710)

* Improve std.cfg: std::addressof(), std::stringstream::str()

* Format

* Add <leak-ignore/>
This commit is contained in:
chrchr-github 2023-01-16 22:08:31 +01:00 committed by GitHub
parent 6e2cc450b8
commit f8f66aeea9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 0 deletions

View File

@ -6426,6 +6426,13 @@ The obsolete function 'gets' is called. With 'gets' you'll get a buffer overrun
<leak-ignore/>
<arg nr="any"/>
</function>
<!-- std::basic_string<CharT,Traits,Allocator> str() const; -->
<!-- void str( const std::basic_string<CharT,Traits,Allocator>& s ); -->
<function name="std::stringstream::str,std::istringstream::str,std::ostringstream::str">
<noreturn>false</noreturn>
<leak-ignore/>
<arg nr="any"/>
</function>
<!-- /*unspecified*/ setbase(int base); -->
<function name="setbase,std::setbase">
<noreturn>false</noreturn>
@ -6764,6 +6771,7 @@ The obsolete function 'gets' is called. With 'gets' you'll get a buffer overrun
<!-- template< class T2, std::size_t N > void swap( T2 (&a)[N], T2 (&b)[N]) -->
<!-- template< class T2, std::size_t N > constexpr void swap( T2 (&a)[N], T2 (&b)[N]) -->
<function name="std::swap">
<leak-ignore/>
<noreturn>false</noreturn>
<returnValue type="void"/>
<arg nr="1">
@ -6773,6 +6781,16 @@ The obsolete function 'gets' is called. With 'gets' you'll get a buffer overrun
<not-uninit/>
</arg>
</function>
<!-- https://en.cppreference.com/w/cpp/memory/addressof -->
<!-- template< class T > constexpr T* addressof( T& arg ) noexcept; -->
<function name="std::addressof">
<leak-ignore/>
<use-retval/>
<noreturn>false</noreturn>
<returnValue type="void*">&amp; arg1</returnValue>
<arg nr="1">
</arg>
</function>
<function name="std::stack::pop,std::queue::pop">
<noreturn>false</noreturn>
</function>

View File

@ -4550,3 +4550,9 @@ public:
for (std::vector<std::string>::reverse_iterator it = m_str.rbegin(); it != m_str.rend(); ++it) {;}
}
};
void addressof(int a)
{
// cppcheck-suppress ignoredReturnValue
std::addressof(a);
}