Small fixes for compat with clang.

This commit is contained in:
Anish Bhobe 2024-06-16 19:00:10 +02:00
parent 44173ffdbc
commit ce4dd9b096
4 changed files with 50 additions and 7 deletions

45
.clang-tidy Normal file
View File

@ -0,0 +1,45 @@
---
Checks: 'clang-diagnostic-*,clang-analyzer-*,-*,cppcoreguidelines-pro-type-member-init,modernize-redundant-void-arg,modernize-use-bool-literals,modernize-use-default-member-init,modernize-use-nullptr,readability-braces-around-statements,readability-redundant-member-init'
WarningsAsErrors: ''
HeaderFilterRegex: ''
FormatStyle: none
CheckOptions:
- key: cert-dcl16-c.NewSuffixes
value: 'L;LL;LU;LLU'
- key: cert-oop54-cpp.WarnOnlyIfThisHasSuspiciousField
value: '0'
- key: cppcoreguidelines-explicit-virtual-functions.IgnoreDestructors
value: '1'
- key: cppcoreguidelines-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic
value: '1'
- key: cppcoreguidelines-pro-type-member-init.IgnoreArrays
value: '1'
- key: cppcoreguidelines-pro-type-member-init.UseAssignment
value: '1'
- key: google-readability-function-size.StatementThreshold
value: '800'
- key: google-readability-namespace-comments.ShortNamespaceLines
value: '10'
- key: google-readability-namespace-comments.SpacesBeforeComments
value: '2'
- key: modernize-loop-convert.MaxCopySize
value: '16'
- key: modernize-loop-convert.MinConfidence
value: reasonable
- key: modernize-loop-convert.NamingStyle
value: CamelCase
- key: modernize-pass-by-value.IncludeStyle
value: llvm
- key: modernize-replace-auto-ptr.IncludeStyle
value: llvm
- key: modernize-use-bool-literals.IgnoreMacros
value: '0'
- key: modernize-use-default-member-init.IgnoreMacros
value: '0'
- key: modernize-use-default-member-init.UseAssignment
value: '1'
- key: modernize-use-nullptr.NullMacros
value: 'NULL'
- key: readability-braces-around-statements.ShortStatementLines
value: '0'
...

View File

@ -49,21 +49,17 @@ constexpr auto ANSI_Cyan = "\u001b[36m";
constexpr auto ANSI_White = "\u001b[37m"; constexpr auto ANSI_White = "\u001b[37m";
constexpr auto ANSI_Reset = "\u001b[0m"; constexpr auto ANSI_Reset = "\u001b[0m";
using std::forward;
using std::move;
using std::tie;
template <typename T> template <typename T>
using Option = std::optional<T>; using Option = std::optional<T>;
template <typename type_t, typename from_t> template <typename type_t, typename from_t>
constexpr auto cast(from_t &&_in) { constexpr auto cast(from_t &&_in) {
return static_cast<type_t>(forward<from_t>(_in)); return static_cast<type_t>(std::forward<from_t>(_in));
} }
template <typename type_t, typename from_t> template <typename type_t, typename from_t>
constexpr auto recast(from_t &&_in) { constexpr auto recast(from_t &&_in) {
return reinterpret_cast<type_t>(forward<from_t>(_in)); return reinterpret_cast<type_t>(std::forward<from_t>(_in));
} }
constexpr f32 operator""_deg(long double degrees) { constexpr f32 operator""_deg(long double degrees) {

View File

@ -9,7 +9,7 @@
#include <cstdio> #include <cstdio>
#define VMA_IMPLEMENTATION #define VMA_IMPLEMENTATION
#include <vma/vk_mem_alloc.h> #include <vk_mem_alloc.h>
// NOTE: Vulkan Dispatch Loader Storage - Should only appear once. // NOTE: Vulkan Dispatch Loader Storage - Should only appear once.
VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE

View File

@ -38,6 +38,7 @@ struct Logger {
return "[DEBUG]:"; return "[DEBUG]:";
if constexpr (LogLevel == LogType::eVerbose) if constexpr (LogLevel == LogType::eVerbose)
return "[VERB]: "; return "[VERB]: ";
return "";
} }
template <LogType LogLevel> template <LogType LogLevel>
@ -52,6 +53,7 @@ struct Logger {
return ANSI_White; return ANSI_White;
if constexpr (LogLevel == LogType::eVerbose) if constexpr (LogLevel == LogType::eVerbose)
return ANSI_Blue; return ANSI_Blue;
return ANSI_White;
} }
template <LogType LogLevel> template <LogType LogLevel>