Add support for std::string_view::substr() (#4729)
This commit is contained in:
parent
99acd3145e
commit
7945b835e1
28
cfg/std.cfg
28
cfg/std.cfg
|
@ -7369,6 +7369,34 @@ initializer list (7) string& replace (const_iterator i1, const_iterator i2, init
|
|||
<valid>0:</valid>
|
||||
</arg>
|
||||
</function>
|
||||
<!-- https://en.cppreference.com/w/cpp/string/basic_string_view/substr -->
|
||||
<!-- constexpr basic_string_view substr( size_type pos = 0, size_type count = npos ) const; -->
|
||||
<function name="std::string_view::substr">
|
||||
<use-retval/>
|
||||
<returnValue type="std::string_view"/>
|
||||
<noreturn>false</noreturn>
|
||||
<arg nr="1" default="0" direction="in">
|
||||
<not-uninit/>
|
||||
<valid>0:</valid>
|
||||
</arg>
|
||||
<arg nr="2" default="0" direction="in">
|
||||
<not-uninit/>
|
||||
<valid>0:</valid>
|
||||
</arg>
|
||||
</function>
|
||||
<function name="std::wstring_view::substr">
|
||||
<use-retval/>
|
||||
<returnValue type="std::wstring_view"/>
|
||||
<noreturn>false</noreturn>
|
||||
<arg nr="1" default="0" direction="in">
|
||||
<not-uninit/>
|
||||
<valid>0:</valid>
|
||||
</arg>
|
||||
<arg nr="2" default="0" direction="in">
|
||||
<not-uninit/>
|
||||
<valid>0:</valid>
|
||||
</arg>
|
||||
</function>
|
||||
<!-- default (1) template <class ForwardIterator> ForwardIterator std::min_element (ForwardIterator first, ForwardIterator last);
|
||||
custom (2) template <class ForwardIterator, class Compare> ForwardIterator std::min_element (ForwardIterator first, ForwardIterator last, Compare comp); -->
|
||||
<!-- default (1) template <class ForwardIterator> ForwardIterator std::max_element (ForwardIterator first, ForwardIterator last);
|
||||
|
|
|
@ -27,7 +27,7 @@ CPPCHECK_OPT='--check-library --platform=unix64 --enable=information --enable=st
|
|||
|
||||
# Compiler settings
|
||||
CXX=g++
|
||||
CXX_OPT='-fsyntax-only -std=c++0x -Wno-format -Wno-format-security -Wno-deprecated-declarations'
|
||||
CXX_OPT='-fsyntax-only -std=c++17 -Wno-format -Wno-format-security -Wno-deprecated-declarations'
|
||||
CC=gcc
|
||||
CC_OPT='-Wno-format -Wno-stringop-overread -Wno-nonnull -Wno-implicit-function-declaration -Wno-deprecated-declarations -Wno-format-security -Wno-nonnull -fsyntax-only'
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
// No warnings about bad library configuration, unmatched suppressions, etc. exitcode=0
|
||||
//
|
||||
|
||||
#include <algorithm>
|
||||
#include <bitset>
|
||||
#include <cassert>
|
||||
#include <cctype>
|
||||
|
@ -34,10 +35,10 @@
|
|||
#include <iostream>
|
||||
#include <istream>
|
||||
#include <iterator>
|
||||
#include <vector>
|
||||
#include <unordered_set>
|
||||
#include <algorithm>
|
||||
#include <numeric>
|
||||
#include <string_view>
|
||||
#include <unordered_set>
|
||||
#include <vector>
|
||||
|
||||
int zerodiv_ldexp()
|
||||
{
|
||||
|
@ -4556,3 +4557,9 @@ void addressof(int a)
|
|||
// cppcheck-suppress ignoredReturnValue
|
||||
std::addressof(a);
|
||||
}
|
||||
|
||||
void string_view_unused(std::string_view v)
|
||||
{
|
||||
// cppcheck-suppress ignoredReturnValue
|
||||
v.substr(1, 3);
|
||||
}
|
Loading…
Reference in New Issue