std.cfg: Add std::vector function configurations and tests (#1180)
This commit is contained in:
parent
e256ce8ea8
commit
b53c4b2032
25
cfg/std.cfg
25
cfg/std.cfg
|
@ -6058,6 +6058,31 @@ The obsolete function 'gets' is called. With 'gets' you'll get a buffer overrun
|
||||||
<noreturn>false</noreturn>
|
<noreturn>false</noreturn>
|
||||||
<returnValue type="void"/>
|
<returnValue type="void"/>
|
||||||
</function>
|
</function>
|
||||||
|
<!-- void reserve(size_type new_capacity); -->
|
||||||
|
<function name="std::vector::reserve">
|
||||||
|
<noreturn>false</noreturn>
|
||||||
|
<returnValue type="void"/>
|
||||||
|
<arg nr="1">
|
||||||
|
<not-uninit/>
|
||||||
|
<not-bool/>
|
||||||
|
<valid>0:</valid>
|
||||||
|
</arg>
|
||||||
|
</function>
|
||||||
|
<!-- void resize(size_type count, T value = T()); // until C++11 -->
|
||||||
|
<!-- void resize(size_type count); // since C++11 -->
|
||||||
|
<!-- void resize(size_type count, const value_type& value); // since C++11 -->
|
||||||
|
<function name="std::vector::resize">
|
||||||
|
<noreturn>false</noreturn>
|
||||||
|
<returnValue type="void"/>
|
||||||
|
<arg nr="1">
|
||||||
|
<not-uninit/>
|
||||||
|
<not-bool/>
|
||||||
|
<valid>0:</valid>
|
||||||
|
</arg>
|
||||||
|
<arg nr="2" default="0">
|
||||||
|
<not-uninit/>
|
||||||
|
</arg>
|
||||||
|
</function>
|
||||||
<function name="std::stack::pop,std::queue::pop">
|
<function name="std::stack::pop,std::queue::pop">
|
||||||
<noreturn>false</noreturn>
|
<noreturn>false</noreturn>
|
||||||
</function>
|
</function>
|
||||||
|
|
|
@ -3277,8 +3277,28 @@ void stdvector()
|
||||||
std::vector<int> v;
|
std::vector<int> v;
|
||||||
// cppcheck-suppress ignoredReturnValue
|
// cppcheck-suppress ignoredReturnValue
|
||||||
v.size();
|
v.size();
|
||||||
|
// cppcheck-suppress ignoredReturnValue
|
||||||
|
v.capacity();
|
||||||
|
// cppcheck-suppress uselessCallsEmpty
|
||||||
|
// cppcheck-suppress ignoredReturnValue
|
||||||
|
v.empty();
|
||||||
|
// cppcheck-suppress ignoredReturnValue
|
||||||
|
v.max_size();
|
||||||
// cppcheck-suppress uninitvar
|
// cppcheck-suppress uninitvar
|
||||||
v.push_back(uninit);
|
v.push_back(uninit);
|
||||||
|
// cppcheck-suppress uninitvar
|
||||||
|
v.reserve(uninit);
|
||||||
|
// cppcheck-suppress invalidFunctionArg
|
||||||
|
v.reserve(-1);
|
||||||
|
// no warning is expected for capacity 0 as it simply has no effect
|
||||||
|
v.reserve(0);
|
||||||
|
// cppcheck-suppress uninitvar
|
||||||
|
v.resize(uninit);
|
||||||
|
// cppcheck-suppress invalidFunctionArg
|
||||||
|
v.resize(-1);
|
||||||
|
|
||||||
|
v.clear();
|
||||||
|
v.shrink_to_fit();
|
||||||
|
|
||||||
// no warning is expected for pop_back()
|
// no warning is expected for pop_back()
|
||||||
v.push_back(42);
|
v.push_back(42);
|
||||||
|
@ -3287,4 +3307,6 @@ void stdvector()
|
||||||
v.push_back(42);
|
v.push_back(42);
|
||||||
// cppcheck-suppress ignoredReturnValue
|
// cppcheck-suppress ignoredReturnValue
|
||||||
v.back();
|
v.back();
|
||||||
|
// cppcheck-suppress ignoredReturnValue
|
||||||
|
v.front();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue