Skip to content

Commit f8f66ae

Browse files
Improve std.cfg: std::addressof(), std::stringstream::str() (#4710)
* Improve std.cfg: std::addressof(), std::stringstream::str() * Format * Add <leak-ignore/>
1 parent 6e2cc45 commit f8f66ae

2 files changed

Lines changed: 24 additions & 0 deletions

File tree

cfg/std.cfg

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6426,6 +6426,13 @@ The obsolete function 'gets' is called. With 'gets' you'll get a buffer overrun
64266426
<leak-ignore/>
64276427
<arg nr="any"/>
64286428
</function>
6429+
<!-- std::basic_string<CharT,Traits,Allocator> str() const; -->
6430+
<!-- void str( const std::basic_string<CharT,Traits,Allocator>& s ); -->
6431+
<function name="std::stringstream::str,std::istringstream::str,std::ostringstream::str">
6432+
<noreturn>false</noreturn>
6433+
<leak-ignore/>
6434+
<arg nr="any"/>
6435+
</function>
64296436
<!-- /*unspecified*/ setbase(int base); -->
64306437
<function name="setbase,std::setbase">
64316438
<noreturn>false</noreturn>
@@ -6764,6 +6771,7 @@ The obsolete function 'gets' is called. With 'gets' you'll get a buffer overrun
67646771
<!-- template< class T2, std::size_t N > void swap( T2 (&a)[N], T2 (&b)[N]) -->
67656772
<!-- template< class T2, std::size_t N > constexpr void swap( T2 (&a)[N], T2 (&b)[N]) -->
67666773
<function name="std::swap">
6774+
<leak-ignore/>
67676775
<noreturn>false</noreturn>
67686776
<returnValue type="void"/>
67696777
<arg nr="1">
@@ -6773,6 +6781,16 @@ The obsolete function 'gets' is called. With 'gets' you'll get a buffer overrun
67736781
<not-uninit/>
67746782
</arg>
67756783
</function>
6784+
<!-- https://en.cppreference.com/w/cpp/memory/addressof -->
6785+
<!-- template< class T > constexpr T* addressof( T& arg ) noexcept; -->
6786+
<function name="std::addressof">
6787+
<leak-ignore/>
6788+
<use-retval/>
6789+
<noreturn>false</noreturn>
6790+
<returnValue type="void*">&amp; arg1</returnValue>
6791+
<arg nr="1">
6792+
</arg>
6793+
</function>
67766794
<function name="std::stack::pop,std::queue::pop">
67776795
<noreturn>false</noreturn>
67786796
</function>

test/cfg/std.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4550,3 +4550,9 @@ class A
45504550
for (std::vector<std::string>::reverse_iterator it = m_str.rbegin(); it != m_str.rend(); ++it) {;}
45514551
}
45524552
};
4553+
4554+
void addressof(int a)
4555+
{
4556+
// cppcheck-suppress ignoredReturnValue
4557+
std::addressof(a);
4558+
}

0 commit comments

Comments
 (0)