Skip to content

Commit e2f38fd

Browse files
authored
removed experimental and safe from Certainty (#4819)
1 parent 9ed21fb commit e2f38fd

7 files changed

Lines changed: 97 additions & 106 deletions

File tree

lib/checkbufferoverrun.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1156,7 +1156,7 @@ void CheckBufferOverrun::negativeArraySizeError(const Token* tok)
11561156
const std::string line1 = arrayName.empty() ? std::string() : ("$symbol:" + arrayName + '\n');
11571157
reportError(tok, Severity::error, "negativeArraySize",
11581158
line1 +
1159-
"Declaration of array '" + arrayName + "' with negative size is undefined behaviour", CWE758, Certainty::safe);
1159+
"Declaration of array '" + arrayName + "' with negative size is undefined behaviour", CWE758, Certainty::normal);
11601160
}
11611161

11621162
void CheckBufferOverrun::negativeMemoryAllocationSizeError(const Token* tok, const ValueFlow::Value* value)
@@ -1165,5 +1165,5 @@ void CheckBufferOverrun::negativeMemoryAllocationSizeError(const Token* tok, con
11651165
const ErrorPath errorPath = getErrorPath(tok, value, msg);
11661166
const bool inconclusive = value != nullptr && !value->isKnown();
11671167
reportError(errorPath, inconclusive ? Severity::warning : Severity::error, "negativeMemoryAllocationSize",
1168-
msg, CWE131, inconclusive ? Certainty::inconclusive : Certainty::safe);
1168+
msg, CWE131, inconclusive ? Certainty::inconclusive : Certainty::normal);
11691169
}

lib/checkother.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1097,10 +1097,7 @@ void CheckOther::variableScopeError(const Token *tok, const std::string &varname
10971097
void CheckOther::checkCommaSeparatedReturn()
10981098
{
10991099
// This is experimental for now. See #5076
1100-
if (!mSettings->certainty.isEnabled(Certainty::experimental))
1101-
return;
1102-
1103-
if (!mSettings->severity.isEnabled(Severity::style))
1100+
if ((true) || !mSettings->severity.isEnabled(Severity::style))
11041101
return;
11051102

11061103
for (const Token *tok = mTokenizer->tokens(); tok; tok = tok->next()) {

lib/checkuninitvar.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1486,7 +1486,8 @@ bool CheckUninitVar::isMemberVariableUsage(const Token *tok, bool isPointer, All
14861486
tok->astParent()->astParent()->astParent()->astOperand2() == tok->astParent()->astParent())
14871487
return true;
14881488

1489-
else if (mSettings->certainty.isEnabled(Certainty::experimental) &&
1489+
// TODO: this used to be experimental - enable or remove see #5586
1490+
else if ((false) &&
14901491
!isPointer &&
14911492
Token::Match(tok->tokAt(-2), "[(,] & %name% [,)]") &&
14921493
isVariableUsage(tok, isPointer, alloc))

lib/errortypes.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class TerminateException : public std::runtime_error {
4848
};
4949

5050
enum class Certainty {
51-
normal, inconclusive, safe, experimental
51+
normal, inconclusive
5252
};
5353

5454
enum class Checks {

test/testbufferoverrun.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ class TestBufferOverrun : public TestFixture {
8484
settings->standards.c = Standards::CLatest;
8585
settings->standards.cpp = Standards::CPPLatest;
8686
settings->certainty.enable(Certainty::inconclusive);
87-
settings->certainty.disable(Certainty::experimental);
8887

8988
// Raw tokens..
9089
std::vector<std::string> files(1, filename);

0 commit comments

Comments
 (0)