From fa8a8369250270217ccde93e046ee3c04fa16712 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20St=C3=B6neberg?= Date: Sat, 26 Dec 2020 13:46:28 +0100 Subject: [PATCH] fixed some clang warnings (#2980) --- cmake/compileroptions.cmake | 1 + lib/exprengine.cpp | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/cmake/compileroptions.cmake b/cmake/compileroptions.cmake index 1021707a2..1e09275cb 100644 --- a/cmake/compileroptions.cmake +++ b/cmake/compileroptions.cmake @@ -47,6 +47,7 @@ elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang") add_compile_options(-Wno-missing-braces) add_compile_options(-Wno-unused-function) add_compile_options_safe(-Wextra-semi-stmt) + add_compile_options_safe(-Wcomma) if(ENABLE_COVERAGE OR ENABLE_COVERAGE_XML) message(FATAL_ERROR "Do not use clang for generate code coverage. Use gcc.") diff --git a/lib/exprengine.cpp b/lib/exprengine.cpp index 8176373f1..d646ec5b8 100644 --- a/lib/exprengine.cpp +++ b/lib/exprengine.cpp @@ -198,7 +198,7 @@ static std::string str(ExprEngine::ValuePtr val) case ExprEngine::ValueType::BailoutValue: typestr = "BailoutValue"; break; - }; + } std::ostringstream ret; ret << val->name << "=" << typestr << "(" << val->getRange() << ")"; @@ -2520,7 +2520,7 @@ static std::string execute(const Token *start, const Token *end, Data &data) // This is intended for testing throw ExprEngineException(tok, "__CPPCHECK_BAILOUT__"); - if (Token::simpleMatch(tok, "while (") && (tok->linkAt(1), ") ;") && tok->next()->astOperand1()->hasKnownIntValue() && tok->next()->astOperand1()->getKnownIntValue() == 0) { + if (Token::simpleMatch(tok, "while (") && Token::simpleMatch(tok->linkAt(1), ") ;") && tok->next()->astOperand1()->hasKnownIntValue() && tok->next()->astOperand1()->getKnownIntValue() == 0) { tok = tok->tokAt(4); continue; }