some changes for clang/clang-tidy 15 (#4310)

This commit is contained in:
Oliver Stöneberg 2022-07-26 15:30:53 +02:00 committed by GitHub
parent 3fc276fb51
commit d6eb3a8f40
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 11 additions and 10 deletions

View File

@ -1,5 +1,5 @@
---
Checks: '*,-abseil-*,-altera-*,-android-*,-boost-*,-cert-*,-cppcoreguidelines-*,-darwin-*,-fuchsia-*,-google-*,-hicpp-*,-linuxkernel-*,-llvm-*,-llvmlibc-*,-mpi-*,-objc-*,-openmp-*,-zircon-*,-readability-braces-around-statements,-readability-magic-numbers,-bugprone-macro-parentheses,-readability-isolate-declaration,-readability-function-size,-modernize-use-trailing-return-type,-readability-implicit-bool-conversion,-readability-uppercase-literal-suffix,-modernize-use-auto,-readability-else-after-return,-modernize-use-default-member-init,-readability-named-parameter,-readability-redundant-member-init,-performance-faster-string-find,-modernize-avoid-c-arrays,-modernize-use-equals-default,-readability-container-size-empty,-readability-simplify-boolean-expr,-modernize-pass-by-value,-bugprone-branch-clone,-bugprone-narrowing-conversions,-modernize-raw-string-literal,-readability-convert-member-functions-to-static,-modernize-loop-convert,-readability-const-return-type,-performance-unnecessary-value-param,-modernize-return-braced-init-list,-performance-inefficient-string-concatenation,-misc-throw-by-value-catch-by-reference,-readability-avoid-const-params-in-decls,-readability-non-const-parameter,-misc-non-private-member-variables-in-classes,-bugprone-suspicious-string-compare,-clang-analyzer-*,-bugprone-signed-char-misuse,-readability-make-member-function-const,-misc-no-recursion,-readability-use-anyofallof,-performance-no-automatic-move,-bugprone-suspicious-include,-modernize-replace-random-shuffle,-readability-function-cognitive-complexity,-readability-redundant-access-specifiers,-performance-noexcept-move-constructor,-concurrency-mt-unsafe,-bugprone-easily-swappable-parameters,-readability-suspicious-call-argument,-readability-identifier-length,-readability-container-data-pointer'
Checks: '*,-abseil-*,-altera-*,-android-*,-boost-*,-cert-*,-cppcoreguidelines-*,-darwin-*,-fuchsia-*,-google-*,-hicpp-*,-linuxkernel-*,-llvm-*,-llvmlibc-*,-mpi-*,-objc-*,-openmp-*,-zircon-*,-readability-braces-around-statements,-readability-magic-numbers,-bugprone-macro-parentheses,-readability-isolate-declaration,-readability-function-size,-modernize-use-trailing-return-type,-readability-implicit-bool-conversion,-readability-uppercase-literal-suffix,-modernize-use-auto,-readability-else-after-return,-modernize-use-default-member-init,-readability-named-parameter,-readability-redundant-member-init,-performance-faster-string-find,-modernize-avoid-c-arrays,-modernize-use-equals-default,-readability-container-size-empty,-readability-simplify-boolean-expr,-modernize-pass-by-value,-bugprone-branch-clone,-bugprone-narrowing-conversions,-modernize-raw-string-literal,-readability-convert-member-functions-to-static,-modernize-loop-convert,-readability-const-return-type,-performance-unnecessary-value-param,-modernize-return-braced-init-list,-performance-inefficient-string-concatenation,-misc-throw-by-value-catch-by-reference,-readability-avoid-const-params-in-decls,-readability-non-const-parameter,-misc-non-private-member-variables-in-classes,-bugprone-suspicious-string-compare,-clang-analyzer-*,-bugprone-signed-char-misuse,-readability-make-member-function-const,-misc-no-recursion,-readability-use-anyofallof,-performance-no-automatic-move,-bugprone-suspicious-include,-modernize-replace-random-shuffle,-readability-function-cognitive-complexity,-readability-redundant-access-specifiers,-performance-noexcept-move-constructor,-concurrency-mt-unsafe,-bugprone-easily-swappable-parameters,-readability-suspicious-call-argument,-readability-identifier-length,-readability-container-data-pointer,-bugprone-assignment-in-if-condition,-misc-const-correctness'
WarningsAsErrors: '*'
CheckOptions:
- key: misc-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic

View File

@ -7,7 +7,7 @@ if (NOT NPROC)
endif()
message(STATUS "NPROC=${NPROC}")
find_program(RUN_CLANG_TIDY NAMES run-clang-tidy run-clang-tidy-14 run-clang-tidy-13 run-clang-tidy-12 run-clang-tidy-11 run-clang-tidy-10 run-clang-tidy-9 run-clang-tidy-8)
find_program(RUN_CLANG_TIDY NAMES run-clang-tidy run-clang-tidy-15 run-clang-tidy-14 run-clang-tidy-13 run-clang-tidy-12 run-clang-tidy-11 run-clang-tidy-10 run-clang-tidy-9 run-clang-tidy-8)
message(STATUS "RUN_CLANG_TIDY=${RUN_CLANG_TIDY}")
if (RUN_CLANG_TIDY)
# disable all compiler warnings since we are just interested in the tidy ones

View File

@ -51,7 +51,8 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
add_compile_options(-Wsuggest-attribute=noreturn)
add_compile_options(-Wno-shadow) # whenever a local variable or type declaration shadows another one
elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
if (CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 14)
if (CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 14 OR CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 14)
# TODO: verify this regression still exists in clang-15
if (CMAKE_BUILD_TYPE STREQUAL "Release" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
# work around performance regression - see https://github.com/llvm/llvm-project/issues/53555
add_compile_options(-mllvm -inline-deferral)

View File

@ -1389,7 +1389,7 @@ void CppCheck::executeAddons(const std::vector<std::string>& files)
const std::string fileName = obj["file"].get<std::string>();
const int64_t lineNumber = obj["linenr"].get<int64_t>();
const int64_t column = obj["column"].get<int64_t>();
errmsg.callStack.emplace_back(ErrorMessage::FileLocation(fileName, lineNumber, column));
errmsg.callStack.emplace_back(fileName, lineNumber, column);
} else if (obj.count("loc") > 0) {
for (const picojson::value &locvalue: obj["loc"].get<picojson::array>()) {
picojson::object loc = locvalue.get<picojson::object>();
@ -1397,7 +1397,7 @@ void CppCheck::executeAddons(const std::vector<std::string>& files)
const int64_t lineNumber = loc["linenr"].get<int64_t>();
const int64_t column = loc["column"].get<int64_t>();
const std::string info = loc["info"].get<std::string>();
errmsg.callStack.emplace_back(ErrorMessage::FileLocation(fileName, info, lineNumber, column));
errmsg.callStack.emplace_back(fileName, info, lineNumber, column);
}
}
@ -1655,7 +1655,7 @@ void CppCheck::analyseClangTidy(const ImportProject::FileSettings &fileSettings)
fixedpath = Path::toNativeSeparators(fixedpath);
ErrorMessage errmsg;
errmsg.callStack.emplace_back(ErrorMessage::FileLocation(fixedpath, lineNumber, column));
errmsg.callStack.emplace_back(fixedpath, lineNumber, column);
errmsg.id = "clang-tidy-" + errorString.substr(1, errorString.length() - 2);
if (errmsg.id.find("performance") != std::string::npos)

View File

@ -439,8 +439,8 @@ static void getConfigs(const simplecpp::TokenList &tokens, std::set<std::string>
}
}
if (includeGuard) {
configs_if.emplace_back(std::string());
configs_ifndef.emplace_back(std::string());
configs_if.emplace_back(/*std::string()*/);
configs_ifndef.emplace_back(/*std::string()*/);
continue;
}
}

View File

@ -609,7 +609,7 @@ void Tokenizer::simplifyTypedef()
bool goback = false;
// add global namespace
spaceInfo.emplace_back(Space{});
spaceInfo.emplace_back(/*Space{}*/);
// Convert "using a::b;" to corresponding typedef statements
simplifyUsingToTypedef();
@ -9466,7 +9466,7 @@ void Tokenizer::printUnknownTypes() const
}
}
unknowns.emplace_back(std::make_pair(name, nameTok));
unknowns.emplace_back(name, nameTok);
}
if (!unknowns.empty()) {