mirror of
https://github.com/PancakeTAS/lsfg-vk.git
synced 2026-02-22 13:41:02 +00:00
chore: update clang-tidy warnings
This commit is contained in:
parent
58c494b473
commit
034c431d76
19 changed files with 184 additions and 228 deletions
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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() {
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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}")
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
#include <optional>
|
||||
#include <string>
|
||||
|
||||
#include <getopt.h> // NOLINT
|
||||
#include <getopt.h> // NOLINT (IWYU)
|
||||
#include <bits/getopt_core.h>
|
||||
#include <bits/getopt_ext.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@
|
|||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <cstdlib>
|
||||
#include <ctime>
|
||||
#include <exception>
|
||||
#include <filesystem>
|
||||
#include <iomanip>
|
||||
|
|
@ -22,6 +21,8 @@
|
|||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include <time.h>
|
||||
#include <bits/time.h>
|
||||
#include <vulkan/vulkan_core.h>
|
||||
|
||||
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<uint64_t>(ts.tv_sec) * 1000ULL +
|
||||
static_cast<uint64_t>(ts.tv_nsec) / 1000000ULL;
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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<PFN_vkGetInstanceProcAddr>(
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
|
|
@ -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<VkDevice, vk::Vulkan> devices;
|
||||
std::unordered_map<VkSwapchainKHR, ls::R<vk::Vulkan>> swapchains;
|
||||
std::unordered_map<VkSwapchainKHR, SwapchainInfo> 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<void*>(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<PFN_vkVoidFunction>(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;
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@
|
|||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <vulkan/vulkan_core.h>
|
||||
|
||||
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,
|
||||
|
|
|
|||
|
|
@ -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<VkPresentModeKHR*>(info->pPresentModes)[i] = // NOLINT
|
||||
const_cast<VkPresentModeKHR*>(info->pPresentModes)[i] =
|
||||
VK_PRESENT_MODE_FIFO_KHR;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
/* SPDX-License-Identifier: GPL-3.0-or-later */
|
||||
|
||||
#include <QtContainerFwd>
|
||||
#include <QStringList>
|
||||
#include <QString>
|
||||
|
||||
|
|
@ -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<std::pair<std::string, std::optional<std::string>>> 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(),
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue