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>
|
<valid>0:</valid>
|
||||||
</arg>
|
</arg>
|
||||||
</function>
|
</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);
|
<!-- 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); -->
|
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);
|
<!-- 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
|
# Compiler settings
|
||||||
CXX=g++
|
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=gcc
|
||||||
CC_OPT='-Wno-format -Wno-stringop-overread -Wno-nonnull -Wno-implicit-function-declaration -Wno-deprecated-declarations -Wno-format-security -Wno-nonnull -fsyntax-only'
|
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
|
// No warnings about bad library configuration, unmatched suppressions, etc. exitcode=0
|
||||||
//
|
//
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
#include <bitset>
|
#include <bitset>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <cctype>
|
#include <cctype>
|
||||||
|
@ -34,10 +35,10 @@
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <istream>
|
#include <istream>
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
#include <vector>
|
|
||||||
#include <unordered_set>
|
|
||||||
#include <algorithm>
|
|
||||||
#include <numeric>
|
#include <numeric>
|
||||||
|
#include <string_view>
|
||||||
|
#include <unordered_set>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
int zerodiv_ldexp()
|
int zerodiv_ldexp()
|
||||||
{
|
{
|
||||||
|
@ -4555,4 +4556,10 @@ void addressof(int a)
|
||||||
{
|
{
|
||||||
// cppcheck-suppress ignoredReturnValue
|
// cppcheck-suppress ignoredReturnValue
|
||||||
std::addressof(a);
|
std::addressof(a);
|
||||||
|
}
|
||||||
|
|
||||||
|
void string_view_unused(std::string_view v)
|
||||||
|
{
|
||||||
|
// cppcheck-suppress ignoredReturnValue
|
||||||
|
v.substr(1, 3);
|
||||||
}
|
}
|
Loading…
Reference in New Issue