Skip to content

Commit 5aecba2

Browse files
authored
Revert "Fix #9157 False negative: stlOutOfBounds, cast (#7233)" (#7254)
This reverts commit 841baa3.
1 parent a1a415d commit 5aecba2

File tree

3 files changed

+1
-11
lines changed

3 files changed

+1
-11
lines changed

lib/astutils.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1991,8 +1991,6 @@ bool isConstFunctionCall(const Token* ftok, const Library& library)
19911991
return true;
19921992
if (!Token::Match(ftok, "%name% ("))
19931993
return false;
1994-
if (ftok->isStandardType())
1995-
return true;
19961994
if (const Function* f = ftok->function()) {
19971995
if (f->isAttributePure() || f->isAttributeConst())
19981996
return true;

lib/tokenlist.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -734,8 +734,6 @@ static void compileBinOp(Token *&tok, AST_state& state, void (*f)(Token *&tok, A
734734
if (!state.op.empty()) {
735735
binop->astOperand1(state.op.top());
736736
state.op.pop();
737-
if (binop->str() == "(" && binop->astOperand1()->isStandardType())
738-
binop->isCast(true);
739737
}
740738
state.op.push(binop);
741739
}

test/teststl.cpp

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -699,19 +699,13 @@ class TestStl : public TestFixture {
699699
" if (i <= static_cast<int>(v.size())) {\n"
700700
" if (v[i]) {}\n"
701701
" }\n"
702-
" if (i <= int(v.size())) {\n"
703-
" if (v[i]) {}\n"
704-
" }\n"
705702
"}\n");
706703
ASSERT_EQUALS("test.cpp:3:warning:Either the condition 'i<=(int)v.size()' is redundant or 'i' can have the value v.size(). Expression 'v[i]' causes access out of bounds.\n"
707704
"test.cpp:2:note:condition 'i<=(int)v.size()'\n"
708705
"test.cpp:3:note:Access out of bounds\n"
709706
"test.cpp:6:warning:Either the condition 'i<=static_cast<int>(v.size())' is redundant or 'i' can have the value v.size(). Expression 'v[i]' causes access out of bounds.\n"
710707
"test.cpp:5:note:condition 'i<=static_cast<int>(v.size())'\n"
711-
"test.cpp:6:note:Access out of bounds\n"
712-
"test.cpp:9:warning:Either the condition 'i<=int(v.size())' is redundant or 'i' can have the value v.size(). Expression 'v[i]' causes access out of bounds.\n"
713-
"test.cpp:8:note:condition 'i<=int(v.size())'\n"
714-
"test.cpp:9:note:Access out of bounds\n",
708+
"test.cpp:6:note:Access out of bounds\n",
715709
errout_str());
716710

717711
check("template<class Iterator>\n"

0 commit comments

Comments
 (0)