diff --git a/lib/checkbufferoverrun.cpp b/lib/checkbufferoverrun.cpp index 3ac75db37..ef4e757ec 100644 --- a/lib/checkbufferoverrun.cpp +++ b/lib/checkbufferoverrun.cpp @@ -85,6 +85,8 @@ void CheckBufferOverrun::arrayIndexOutOfBoundsError(const Token *tok, const Arra } if (condition != nullptr) { + if (!_settings->isEnabled("warning")) + return; errmsg << " Otherwise condition '" << condition->expressionString() << "' is redundant."; std::list callstack; callstack.push_back(tok);