diff --git a/CMakeLists.txt b/CMakeLists.txt index c0b7f95..4b146ba 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,25 +21,24 @@ set(CMAKE_SKIP_RPATH ON) if(CMAKE_BUILD_TYPE STREQUAL "Debug") set(CMAKE_EXPORT_COMPILE_COMMANDS ON) - if(NOT CMAKE_CXX_COMPILER_ID STREQUAL "Clang") - message(WARNING "Debug builds should use Clang for better diagnostics") - else() - message(STATUS "Building with further diagnostics") + if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + message(STATUS "Building with clang-specific diagnostics") - set(CMAKE_CXX_CLANG_TIDY clang-tidy) + set(CMAKE_CXX_CLANG_TIDY clang-tidy) # See .clang-tidy files add_compile_options( + # By default, enable all warnings -Weverything - # disable incompatible warnings + # Some warnings are incompatible with each other -Wno-pre-c++20-compat-pedantic -Wno-c++98-compat-pedantic -Wno-switch-default - -Wno-switch-enum - # disable noisy warnings + # Then there's code-style things I don't care about -Wno-missing-designated-field-initializers + -Wno-shadow + # And functional warning I don't care about either -Wno-cast-function-type-strict -Wno-padded - -Wno-shadow ) endif() endif() diff --git a/lsfg-vk-backend/.clang-tidy b/lsfg-vk-backend/.clang-tidy index 9567cc4..a659a27 100644 --- a/lsfg-vk-backend/.clang-tidy +++ b/lsfg-vk-backend/.clang-tidy @@ -1,36 +1,26 @@ Checks: -# enable basic checks -- "clang-analyzer-*" -# configure performance checks -- "performance-*" -- "-performance-enum-size" -# configure readability and bugprone checks -- "readability-*" +# COMMON: Usually, we keep all checks enabled - "bugprone-*" -- "misc-*" -- "-readability-braces-around-statements" -- "-readability-function-cognitive-complexity" -- "-readability-identifier-length" -- "-readability-implicit-bool-conversion" -- "-readability-magic-numbers" -- "-readability-math-missing-parentheses" -- "-readability-named-parameter" -- "-bugprone-easily-swappable-parameters" -# configure modernization -- "modernize-*" -- "-modernize-use-trailing-return-type" -# configure cppcoreguidelines +- "clang-analyzer-*" - "cppcoreguidelines-*" -- "-cppcoreguidelines-avoid-magic-numbers" -- "-cppcoreguidelines-pro-type-reinterpret-cast" -- "-cppcoreguidelines-macro-usage" -# disable slow and pointless checks -- "-modernize-use-std-numbers" -- "-modernize-type-traits" -- "-cppcoreguidelines-owning-memory" -- "-cppcoreguidelines-macro-to-enum" -- "-readability-container-contains" -- "-bugprone-reserved-identifier" -- "-bugprone-stringview-nullptr" -- "-bugprone-standalone-empty" -- "-misc-unused-using-decls" +- "misc-*" +- "modernize-*" +- "performance-*" +- "portability-*" +- "readability-*" +# COMMON: Some checks related purely to code-style are disabled +- -modernize-use-designated-initializers +- -modernize-use-trailing-return-type +- -modernize-deprecated-headers +- -readability-function-cognitive-complexity +- -readability-math-missing-parentheses +- -readability-braces-around-statements +- -readability-implicit-bool-conversion +- -readability-identifier-length +- -readability-magic-numbers +- -cppcoreguidelines-avoid-magic-numbers +- -cppcoreguidelines-macro-usage +- -bugprone-easily-swappable-parameters +# Vulkan requires the use of reinterpret/const casts in many places +- -cppcoreguidelines-pro-type-reinterpret-cast +- -cppcoreguidelines-pro-type-const-cast diff --git a/lsfg-vk-backend/include/lsfg-vk-backend/lsfgvk.hpp b/lsfg-vk-backend/include/lsfg-vk-backend/lsfgvk.hpp index 919e14a..eacb98e 100644 --- a/lsfg-vk-backend/include/lsfg-vk-backend/lsfgvk.hpp +++ b/lsfg-vk-backend/include/lsfg-vk-backend/lsfgvk.hpp @@ -21,24 +21,28 @@ namespace lsfgvk::backend { /// /// Primitive exception class that deliveres a detailed error message /// - class [[gnu::visibility("default")]] error : public std::runtime_error { // NOLINT - public: - /// - /// Construct an error - /// - /// @param msg Error message. - /// @param inner Inner exception. - /// - explicit error(const std::string& msg, const std::exception& inner); + class [[gnu::visibility("default")]] error : public std::runtime_error { + public: + /// + /// Construct an error + /// + /// @param msg Error message. + /// @param inner Inner exception. + /// + explicit error(const std::string &msg, const std::exception &inner); - /// - /// Construct an error - /// - /// @param msg Error message. - /// - explicit error(const std::string& msg); + /// + /// Construct an error + /// + /// @param msg Error message. + /// + explicit error(const std::string &msg); - ~error() override; + error(const error &) = default; + error &operator=(const error &) = default; + error(error &&) = default; + error &operator=(error &&) = default; + ~error() override; }; /// Function type for picking a device based on its name and IDs diff --git a/lsfg-vk-backend/src/lsfgvk.cpp b/lsfg-vk-backend/src/lsfgvk.cpp index 6e97d4e..6579413 100644 --- a/lsfg-vk-backend/src/lsfgvk.cpp +++ b/lsfg-vk-backend/src/lsfgvk.cpp @@ -547,7 +547,7 @@ ContextImpl::ContextImpl(const InstanceImpl& instance, cmdbuf.submit(ctx.vk); // wait for completion } -void Instance::scheduleFrames(Context& context) { // NOLINT (static) +void Instance::scheduleFrames(Context& context) { #ifdef LSFGVK_TESTING_RENDERDOC const auto& impl = this->m_impl; if (impl->getRenderDocAPI()) { @@ -645,7 +645,7 @@ Instance::~Instance() = default; // leaking shenanigans namespace { - bool leaking{false}; // NOLINT + bool leaking{false}; // NOLINT (global variable) } InstanceImpl::~InstanceImpl() { diff --git a/lsfg-vk-cli/.clang-tidy b/lsfg-vk-cli/.clang-tidy index c7f1ea2..b89842d 100644 --- a/lsfg-vk-cli/.clang-tidy +++ b/lsfg-vk-cli/.clang-tidy @@ -1,39 +1,25 @@ Checks: -# enable basic checks -- "clang-analyzer-*" -# configure performance checks -- "performance-*" -- "-performance-enum-size" -# configure readability and bugprone checks -- "readability-*" +# COMMON: Usually, we keep all checks enabled - "bugprone-*" -- "misc-*" -- "-readability-braces-around-statements" -- "-readability-function-cognitive-complexity" -- "-readability-identifier-length" -- "-readability-implicit-bool-conversion" -- "-readability-magic-numbers" -- "-readability-math-missing-parentheses" -- "-readability-named-parameter" -- "-bugprone-easily-swappable-parameters" -- "-misc-non-private-member-variables-in-classes" -# configure modernization -- "modernize-*" -- "-modernize-use-trailing-return-type" -- "-modernize-use-designated-initializers" -# configure cppcoreguidelines +- "clang-analyzer-*" - "cppcoreguidelines-*" -- "-cppcoreguidelines-avoid-magic-numbers" -- "-cppcoreguidelines-pro-type-reinterpret-cast" -- "-cppcoreguidelines-macro-usage" -- "-cppcoreguidelines-pro-bounds-pointer-arithmetic" -# disable slow and pointless checks -- "-modernize-use-std-numbers" -- "-modernize-type-traits" -- "-cppcoreguidelines-owning-memory" -- "-cppcoreguidelines-macro-to-enum" -- "-readability-container-contains" -- "-bugprone-reserved-identifier" -- "-bugprone-stringview-nullptr" -- "-bugprone-standalone-empty" -- "-misc-unused-using-decls" +- "misc-*" +- "modernize-*" +- "performance-*" +- "portability-*" +- "readability-*" +# COMMON: Some checks related purely to code-style are disabled +- -modernize-use-designated-initializers +- -modernize-use-trailing-return-type +- -modernize-deprecated-headers +- -readability-function-cognitive-complexity +- -readability-math-missing-parentheses +- -readability-braces-around-statements +- -readability-implicit-bool-conversion +- -readability-identifier-length +- -readability-magic-numbers +- -cppcoreguidelines-avoid-magic-numbers +- -cppcoreguidelines-macro-usage +- -bugprone-easily-swappable-parameters +# Pointer arithmetic is used plenty for parsing cli arguments +- -cppcoreguidelines-pro-bounds-pointer-arithmetic diff --git a/lsfg-vk-cli/CMakeLists.txt b/lsfg-vk-cli/CMakeLists.txt index 45f25e3..ca53131 100644 --- a/lsfg-vk-cli/CMakeLists.txt +++ b/lsfg-vk-cli/CMakeLists.txt @@ -12,7 +12,7 @@ target_link_libraries(lsfg-vk-cli target_compile_options(lsfg-vk-cli PRIVATE -Wno-unknown-warning-option - -Wno-unsafe-buffer-usage) + -Wno-unsafe-buffer-usage) # CLI parsing install(TARGETS lsfg-vk-cli RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") diff --git a/lsfg-vk-cli/src/main.cpp b/lsfg-vk-cli/src/main.cpp index 71815d5..446ca8f 100644 --- a/lsfg-vk-cli/src/main.cpp +++ b/lsfg-vk-cli/src/main.cpp @@ -11,7 +11,7 @@ #include #include -#include // NOLINT +#include // NOLINT (IWYU) #include #include diff --git a/lsfg-vk-cli/src/tools/benchmark.cpp b/lsfg-vk-cli/src/tools/benchmark.cpp index bee3647..3738a20 100644 --- a/lsfg-vk-cli/src/tools/benchmark.cpp +++ b/lsfg-vk-cli/src/tools/benchmark.cpp @@ -12,7 +12,6 @@ #include #include #include -#include #include #include #include @@ -22,6 +21,8 @@ #include #include +#include +#include #include using namespace lsfgvk::cli; @@ -31,7 +32,7 @@ namespace { // get current time in milliseconds uint64_t ms() { struct timespec ts{}; - clock_gettime(CLOCK_MONOTONIC, &ts); // NOLINT (IWYU) + clock_gettime(CLOCK_MONOTONIC, &ts); return static_cast(ts.tv_sec) * 1000ULL + static_cast(ts.tv_nsec) / 1000000ULL; diff --git a/lsfg-vk-common/.clang-tidy b/lsfg-vk-common/.clang-tidy index 9567cc4..a659a27 100644 --- a/lsfg-vk-common/.clang-tidy +++ b/lsfg-vk-common/.clang-tidy @@ -1,36 +1,26 @@ Checks: -# enable basic checks -- "clang-analyzer-*" -# configure performance checks -- "performance-*" -- "-performance-enum-size" -# configure readability and bugprone checks -- "readability-*" +# COMMON: Usually, we keep all checks enabled - "bugprone-*" -- "misc-*" -- "-readability-braces-around-statements" -- "-readability-function-cognitive-complexity" -- "-readability-identifier-length" -- "-readability-implicit-bool-conversion" -- "-readability-magic-numbers" -- "-readability-math-missing-parentheses" -- "-readability-named-parameter" -- "-bugprone-easily-swappable-parameters" -# configure modernization -- "modernize-*" -- "-modernize-use-trailing-return-type" -# configure cppcoreguidelines +- "clang-analyzer-*" - "cppcoreguidelines-*" -- "-cppcoreguidelines-avoid-magic-numbers" -- "-cppcoreguidelines-pro-type-reinterpret-cast" -- "-cppcoreguidelines-macro-usage" -# disable slow and pointless checks -- "-modernize-use-std-numbers" -- "-modernize-type-traits" -- "-cppcoreguidelines-owning-memory" -- "-cppcoreguidelines-macro-to-enum" -- "-readability-container-contains" -- "-bugprone-reserved-identifier" -- "-bugprone-stringview-nullptr" -- "-bugprone-standalone-empty" -- "-misc-unused-using-decls" +- "misc-*" +- "modernize-*" +- "performance-*" +- "portability-*" +- "readability-*" +# COMMON: Some checks related purely to code-style are disabled +- -modernize-use-designated-initializers +- -modernize-use-trailing-return-type +- -modernize-deprecated-headers +- -readability-function-cognitive-complexity +- -readability-math-missing-parentheses +- -readability-braces-around-statements +- -readability-implicit-bool-conversion +- -readability-identifier-length +- -readability-magic-numbers +- -cppcoreguidelines-avoid-magic-numbers +- -cppcoreguidelines-macro-usage +- -bugprone-easily-swappable-parameters +# Vulkan requires the use of reinterpret/const casts in many places +- -cppcoreguidelines-pro-type-reinterpret-cast +- -cppcoreguidelines-pro-type-const-cast diff --git a/lsfg-vk-common/src/vulkan/vulkan.cpp b/lsfg-vk-common/src/vulkan/vulkan.cpp index 731a918..b6a2c7a 100644 --- a/lsfg-vk-common/src/vulkan/vulkan.cpp +++ b/lsfg-vk-common/src/vulkan/vulkan.cpp @@ -24,7 +24,7 @@ using namespace vk; namespace { /// load libvulkan.so.1 and return its handle void* get_vulkan_handle() { - static void* handle{nullptr}; // NOLINT + static void* handle{nullptr}; // NOLINT (const correctness) if (handle) return handle; handle = dlopen("libvulkan.so.1", RTLD_NOW | RTLD_LOCAL); @@ -37,7 +37,7 @@ namespace { /// get the main proc addr function PFN_vkGetInstanceProcAddr get_mpa() { - static PFN_vkGetInstanceProcAddr mpa{nullptr}; // NOLINT + static PFN_vkGetInstanceProcAddr mpa{nullptr}; if (mpa) return mpa; mpa = reinterpret_cast( diff --git a/lsfg-vk-layer/.clang-tidy b/lsfg-vk-layer/.clang-tidy index 8a9ce4f..0939c9a 100644 --- a/lsfg-vk-layer/.clang-tidy +++ b/lsfg-vk-layer/.clang-tidy @@ -1,39 +1,30 @@ Checks: -# enable basic checks -- "clang-analyzer-*" -# configure performance checks -- "performance-*" -- "-performance-enum-size" -# configure readability and bugprone checks -- "readability-*" +# COMMON: Usually, we keep all checks enabled - "bugprone-*" -- "misc-*" -- "-readability-braces-around-statements" -- "-readability-function-cognitive-complexity" -- "-readability-identifier-length" -- "-readability-implicit-bool-conversion" -- "-readability-magic-numbers" -- "-readability-math-missing-parentheses" -- "-readability-named-parameter" -- "-bugprone-easily-swappable-parameters" -# configure modernization -- "modernize-*" -- "-modernize-use-trailing-return-type" -# configure cppcoreguidelines +- "clang-analyzer-*" - "cppcoreguidelines-*" -- "-cppcoreguidelines-avoid-magic-numbers" -- "-cppcoreguidelines-pro-type-reinterpret-cast" -- "-cppcoreguidelines-macro-usage" -- "-cppcoreguidelines-pro-type-union-access" -- "-cppcoreguidelines-avoid-non-const-global-variables" -- "-cppcoreguidelines-pro-type-const-cast" -# disable slow and pointless checks -- "-modernize-use-std-numbers" -- "-modernize-type-traits" -- "-cppcoreguidelines-owning-memory" -- "-cppcoreguidelines-macro-to-enum" -- "-readability-container-contains" -- "-bugprone-reserved-identifier" -- "-bugprone-stringview-nullptr" -- "-bugprone-standalone-empty" -- "-misc-unused-using-decls" +- "misc-*" +- "modernize-*" +- "performance-*" +- "portability-*" +- "readability-*" +# COMMON: Some checks related purely to code-style are disabled +- -modernize-use-designated-initializers +- -modernize-use-trailing-return-type +- -modernize-deprecated-headers +- -readability-function-cognitive-complexity +- -readability-math-missing-parentheses +- -readability-braces-around-statements +- -readability-implicit-bool-conversion +- -readability-identifier-length +- -readability-magic-numbers +- -cppcoreguidelines-avoid-magic-numbers +- -cppcoreguidelines-macro-usage +- -bugprone-easily-swappable-parameters +# Vulkan requires the use of reinterpret/const casts in many places +- -cppcoreguidelines-pro-type-reinterpret-cast +- -cppcoreguidelines-pro-type-const-cast +# Vulkan layers often require C-style memory access +- -cppcoreguidelines-pro-bounds-pointer-arithmetic +- -cppcoreguidelines-pro-type-union-access +- -clang-diagnostic-unsafe-buffer-usage diff --git a/lsfg-vk-layer/CMakeLists.txt b/lsfg-vk-layer/CMakeLists.txt index f379f71..0413479 100644 --- a/lsfg-vk-layer/CMakeLists.txt +++ b/lsfg-vk-layer/CMakeLists.txt @@ -9,6 +9,10 @@ target_link_libraries(lsfg-vk-layer PUBLIC lsfg-vk-common PUBLIC lsfg-vk-backend) +target_compile_options(lsfg-vk-layer PRIVATE + -Wno-unknown-warning-option + -Wno-unsafe-buffer-usage) # Array indexing + set_target_properties(lsfg-vk-layer PROPERTIES CXX_VISIBILITY_PRESET hidden) diff --git a/lsfg-vk-layer/src/entrypoint.cpp b/lsfg-vk-layer/src/entrypoint.cpp index e9f0542..6256b9f 100644 --- a/lsfg-vk-layer/src/entrypoint.cpp +++ b/lsfg-vk-layer/src/entrypoint.cpp @@ -28,7 +28,7 @@ namespace { PFN_vkGetInstanceProcAddr GetInstanceProcAddr; Root root; - }* layer_info; + }* layer_info; // NOLINT (global variable) // instance-wide info initialized at instance creation(s) struct InstanceInfo { @@ -38,7 +38,7 @@ namespace { std::unordered_map devices; std::unordered_map> swapchains; std::unordered_map swapchainInfos; - }* instance_info; + }* instance_info; // NOLINT (global variable) // create instance VkResult myvkCreateInstance( @@ -93,7 +93,7 @@ namespace { ); if (!instance_info) - instance_info = new InstanceInfo{ + instance_info = new InstanceInfo{ // NOLINT (memory management) .funcs = vk::initVulkanInstanceFuncs(*instance, layer_info->GetInstanceProcAddr, true), }; @@ -224,7 +224,7 @@ namespace { // destroy instance info if no handles remain if (instance_info->handles.empty()) { - delete instance_info; + delete instance_info; // NOLINT (memory management) instance_info = nullptr; } @@ -379,7 +379,7 @@ namespace { // present each swapchain for (size_t i = 0; i < info->swapchainCount; i++) { - const auto& swapchain = info->pSwapchains[i]; // NOLINT (array index) + const auto& swapchain = info->pSwapchains[i]; const auto& it = instance_info->swapchains.find(swapchain); if (it == instance_info->swapchains.end()) @@ -390,13 +390,13 @@ namespace { waitSemaphores.reserve(info->waitSemaphoreCount); for (size_t j = 0; j < info->waitSemaphoreCount; j++) - waitSemaphores.push_back(info->pWaitSemaphores[j]); // NOLINT (array index) + waitSemaphores.push_back(info->pWaitSemaphores[j]); auto& context = layer_info->root.getSwapchainContext(swapchain); result = context.present(it->second, queue, swapchain, const_cast(info->pNext), - info->pImageIndices[i], // NOLINT (array index) + info->pImageIndices[i], { waitSemaphores.begin(), waitSemaphores.end() } ); } catch (const ls::vulkan_error& e) { @@ -413,7 +413,7 @@ namespace { } if (result != VK_SUCCESS && info->pResults) - info->pResults[i] = result; // NOLINT (array index) + info->pResults[i] = result; } return result; @@ -463,7 +463,7 @@ VkResult vkNegotiateLoaderLayerInterfaceVersion(VkNegotiateLayerInterface* pVers // load the layer configuration try { - layer_info = new LayerInfo { + layer_info = new LayerInfo { // NOLINT (memory management) .map = { #define VKPTR(name) reinterpret_cast(name) { "vkCreateInstance", VKPTR(myvkCreateInstance) }, @@ -479,7 +479,7 @@ VkResult vkNegotiateLoaderLayerInterfaceVersion(VkNegotiateLayerInterface* pVers }; if (!layer_info->root.active()) { // skip inactive - delete layer_info; + delete layer_info; // NOLINT (memory management) layer_info = nullptr; return VK_ERROR_INITIALIZATION_FAILED; diff --git a/lsfg-vk-layer/src/instance.cpp b/lsfg-vk-layer/src/instance.cpp index 8ef93f5..8708638 100644 --- a/lsfg-vk-layer/src/instance.cpp +++ b/lsfg-vk-layer/src/instance.cpp @@ -18,6 +18,7 @@ #include #include +#include #include using namespace lsfgvk; @@ -172,7 +173,7 @@ void Root::createSwapchainContext(const vk::Vulkan& vk, if (!this->backend.has_value()) { // emplace backend late, due to loader bug const auto& global = this->config.get().global(); - setenv("DISABLE_LSFGVK", "1", 1); // NOLINT (c++-include) + setenv("DISABLE_LSFGVK", "1", 1); try { std::string dll{}; @@ -197,11 +198,11 @@ void Root::createSwapchainContext(const vk::Vulkan& vk, dll, global.allow_fp16 ); } catch (const std::exception& e) { - unsetenv("DISABLE_LSFGVK"); // NOLINT (c++-include) + unsetenv("DISABLE_LSFGVK"); throw ls::error("failed to create backend instance", e); } - unsetenv("DISABLE_LSFGVK"); // NOLINT (c++-include) + unsetenv("DISABLE_LSFGVK"); } this->swapchains.emplace(swapchain, diff --git a/lsfg-vk-layer/src/swapchain.cpp b/lsfg-vk-layer/src/swapchain.cpp index cf447f6..85033ae 100644 --- a/lsfg-vk-layer/src/swapchain.cpp +++ b/lsfg-vk-layer/src/swapchain.cpp @@ -151,7 +151,7 @@ VkResult Swapchain::present(const vk::Vulkan& vk, while (info) { if (info->sType == VK_STRUCTURE_TYPE_SWAPCHAIN_PRESENT_MODE_INFO_EXT) { for (size_t i = 0; i < info->swapchainCount; i++) - const_cast(info->pPresentModes)[i] = // NOLINT + const_cast(info->pPresentModes)[i] = VK_PRESENT_MODE_FIFO_KHR; } diff --git a/lsfg-vk-ui/.clang-tidy b/lsfg-vk-ui/.clang-tidy index 50758ca..8d8a825 100644 --- a/lsfg-vk-ui/.clang-tidy +++ b/lsfg-vk-ui/.clang-tidy @@ -1,38 +1,25 @@ Checks: -# enable basic checks -- "clang-analyzer-*" -# configure performance checks -- "performance-*" -- "-performance-enum-size" -# configure readability and bugprone checks -- "readability-*" +# COMMON: Usually, we keep all checks enabled - "bugprone-*" -- "misc-*" -- "-readability-braces-around-statements" -- "-readability-function-cognitive-complexity" -- "-readability-identifier-length" -- "-readability-implicit-bool-conversion" -- "-readability-magic-numbers" -- "-readability-math-missing-parentheses" -- "-readability-named-parameter" -- "-bugprone-easily-swappable-parameters" -# configure modernization -- "modernize-*" -- "-modernize-use-trailing-return-type" -# configure cppcoreguidelines +- "clang-analyzer-*" - "cppcoreguidelines-*" -- "-cppcoreguidelines-avoid-magic-numbers" -- "-cppcoreguidelines-pro-type-reinterpret-cast" -- "-cppcoreguidelines-macro-usage" -- "-cppcoreguidelines-pro-type-member-init" -- "-cppcoreguidelines-prefer-member-initializer" -# disable slow and pointless checks -- "-modernize-use-std-numbers" -- "-modernize-type-traits" -- "-cppcoreguidelines-owning-memory" -- "-cppcoreguidelines-macro-to-enum" -- "-readability-container-contains" -- "-bugprone-reserved-identifier" -- "-bugprone-stringview-nullptr" -- "-bugprone-standalone-empty" -- "-misc-unused-using-decls" +- "misc-*" +- "modernize-*" +- "performance-*" +- "portability-*" +- "readability-*" +# COMMON: Some checks related purely to code-style are disabled +- -modernize-use-designated-initializers +- -modernize-use-trailing-return-type +- -modernize-deprecated-headers +- -readability-function-cognitive-complexity +- -readability-math-missing-parentheses +- -readability-braces-around-statements +- -readability-implicit-bool-conversion +- -readability-identifier-length +- -readability-magic-numbers +- -cppcoreguidelines-avoid-magic-numbers +- -cppcoreguidelines-macro-usage +- -bugprone-easily-swappable-parameters +# Qt requires use of raw pointers in many places +- -cppcoreguidelines-owning-memory diff --git a/lsfg-vk-ui/CMakeLists.txt b/lsfg-vk-ui/CMakeLists.txt index f151e98..edd23c1 100644 --- a/lsfg-vk-ui/CMakeLists.txt +++ b/lsfg-vk-ui/CMakeLists.txt @@ -27,7 +27,7 @@ set_target_properties(lsfg-vk-ui PROPERTIES AUTOMOC ON AUTOUIC ON) -target_compile_options(lsfg-vk-ui PRIVATE +target_compile_options(lsfg-vk-ui PRIVATE # QT-codegen warnings -Wno-unknown-warning-option -Wno-ctad-maybe-unsupported -Wno-unsafe-buffer-usage-in-libc-call diff --git a/lsfg-vk-ui/src/backend.cpp b/lsfg-vk-ui/src/backend.cpp index 0161c4f..4d00607 100644 --- a/lsfg-vk-ui/src/backend.cpp +++ b/lsfg-vk-ui/src/backend.cpp @@ -38,7 +38,7 @@ Backend::Backend() { this->m_gpu_list = ui::getAvailableGPUs(); // create profile list model - QStringList profiles; // NOLINT (IWYU) + QStringList profiles; for (const auto& profile : this->m_profiles) profiles.append(QString::fromStdString(profile.name)); @@ -47,7 +47,7 @@ Backend::Backend() { // create active_in list models this->m_active_in_list_models.reserve(this->m_profiles.size()); for (const auto& profile : this->m_profiles) { - QStringList active_in; // NOLINT (IWYU) + QStringList active_in; for (const auto& path : profile.active_in) active_in.append(QString::fromStdString(path)); diff --git a/lsfg-vk-ui/src/utils.cpp b/lsfg-vk-ui/src/utils.cpp index 7fdec90..0866b48 100644 --- a/lsfg-vk-ui/src/utils.cpp +++ b/lsfg-vk-ui/src/utils.cpp @@ -1,5 +1,6 @@ /* SPDX-License-Identifier: GPL-3.0-or-later */ +#include #include #include @@ -16,7 +17,7 @@ using namespace lsfgvk; using namespace lsfgvk::ui; -QStringList ui::getAvailableGPUs() { // NOLINT (IWYU) +QStringList ui::getAvailableGPUs() { // list of found GPUs and their optional PCI IDs std::vector>> gpus{}; @@ -33,16 +34,18 @@ QStringList ui::getAvailableGPUs() { // NOLINT (IWYU) const backend::Instance instance{picker, "/non/existent/path", false}; throw std::runtime_error("???"); - } catch (const backend::error&) { // NOLINT + } catch (const backend::error&) { // NOLINT (empty catch) // expected } + // NOLINTBEGIN (ranges) [GCC has some issues with ranges] // first remove 1:1 duplicates - std::sort(gpus.begin(), gpus.end()); // NOLINT (ranges [thanks gcc!]) - gpus.erase(std::unique(gpus.begin(), gpus.end()), gpus.end()); // NOLINT + std::sort(gpus.begin(), gpus.end()); + gpus.erase(std::unique(gpus.begin(), gpus.end()), gpus.end()); + // NOLINTEND // build the frontend list - QStringList list{"Default"}; // NOLINT (IWYU) + QStringList list{"Default"}; for (const auto& gpu : gpus) { // check if GPU is in list more than once auto count = std::count_if(gpus.begin(), gpus.end(),