Skip to content

Commit

Permalink
CMake: disable some warnings that have been introduced in LLVM 11
Browse files Browse the repository at this point in the history
  • Loading branch information
agarny committed Nov 9, 2020
2 parents 5d91ec0 + 66417e9 commit 491fc10
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 10 deletions.
20 changes: 14 additions & 6 deletions cmake/common.cmake
Expand Up @@ -124,9 +124,16 @@ function(configure_clang_and_clang_tidy_settings _TARGET)

if(CLANG_TIDY_AVAILABLE)
if(NOT "${_TARGET}" STREQUAL "cellml")
set(_NO_BUGPRONE_EXCEPTION_ESCAPE -bugprone-exception-escape)
set(_NO_CPPCOREGUIDELINES_PRO_TYPE_VARARG -cppcoreguidelines-pro-type-vararg)
set(_NO_HICPP_VARARG -hicpp-vararg)
set(_DISABLED_BUGPRONE_CHECKS
-bugprone-exception-escape
)
set(_DISABLED_CPPCOREGUIDELINES_CHECKS
-cppcoreguidelines-avoid-non-const-global-variables
-cppcoreguidelines-pro-type-vararg
)
set(_DISABLED_HICPP_CHECKS
-hicpp-vararg
)
endif()

# The full list of Clang-Tidy checks can be found at
Expand All @@ -135,17 +142,17 @@ function(configure_clang_and_clang_tidy_settings _TARGET)
-*
bugprone-*
-bugprone-branch-clone
${_NO_BUGPRONE_EXCEPTION_ESCAPE}
${_DISABLED_BUGPRONE_CHECKS}
cert-*
-cert-err58-cpp
cppcoreguidelines-*
-cppcoreguidelines-avoid-magic-numbers
-cppcoreguidelines-init-variables
-cppcoreguidelines-owning-memory
-cppcoreguidelines-pro-type-reinterpret-cast
${_NO_CPPCOREGUIDELINES_PRO_TYPE_VARARG}
-cppcoreguidelines-slicing
-cppcoreguidelines-special-member-functions
${_DISABLED_CPPCOREGUIDELINES_CHECKS}
fuchsia-*
-fuchsia-default-arguments
-fuchsia-default-arguments-calls
Expand All @@ -158,12 +165,13 @@ function(configure_clang_and_clang_tidy_settings _TARGET)
-google-runtime-references
hicpp-*
-hicpp-special-member-functions
${_NO_HICPP_VARARG}
${_DISABLED_HICPP_CHECKS}
llvm-*
-llvm-qualified-auto
-llvm-header-guard
misc-*
-misc-non-private-member-variables-in-classes
-misc-no-recursion
modernize-*
-modernize-make-shared
-modernize-pass-by-value
Expand Down
6 changes: 3 additions & 3 deletions src/analyser.cpp
Expand Up @@ -282,7 +282,7 @@ bool AnalyserInternalEquation::check(size_t &equationOrder, size_t &stateIndex,
if (variable->mType == AnalyserInternalVariable::Type::UNKNOWN) {
variable->mType = mComputedTrueConstant ?
AnalyserInternalVariable::Type::COMPUTED_TRUE_CONSTANT :
mComputedVariableBasedConstant ?
mComputedVariableBasedConstant ?
AnalyserInternalVariable::Type::COMPUTED_VARIABLE_BASED_CONSTANT :
AnalyserInternalVariable::Type::ALGEBRAIC;
}
Expand All @@ -298,9 +298,9 @@ bool AnalyserInternalEquation::check(size_t &equationOrder, size_t &stateIndex,
mOrder = ++equationOrder;
mType = (variable->mType == AnalyserInternalVariable::Type::STATE) ?
Type::RATE :
(variable->mType == AnalyserInternalVariable::Type::COMPUTED_TRUE_CONSTANT) ?
(variable->mType == AnalyserInternalVariable::Type::COMPUTED_TRUE_CONSTANT) ?
Type::TRUE_CONSTANT :
(variable->mType == AnalyserInternalVariable::Type::COMPUTED_VARIABLE_BASED_CONSTANT) ?
(variable->mType == AnalyserInternalVariable::Type::COMPUTED_VARIABLE_BASED_CONSTANT) ?
Type::VARIABLE_BASED_CONSTANT :
Type::ALGEBRAIC;

Expand Down
2 changes: 1 addition & 1 deletion tests/test_utils.cpp
Expand Up @@ -52,7 +52,7 @@ std::chrono::steady_clock::time_point timeNow()

int elapsedTime(const std::chrono::steady_clock::time_point &startTime)
{
return std::chrono::duration_cast<std::chrono::milliseconds>(timeNow() - startTime).count();
return int(std::chrono::duration_cast<std::chrono::milliseconds>(timeNow() - startTime).count());
}

void printIssues(const libcellml::LoggerPtr &l, bool headings, bool cellmlElementTypes, bool rule)
Expand Down

0 comments on commit 491fc10

Please sign in to comment.