diff --git a/.clang-tidy b/.clang-tidy index 1494fa877b0..e50cf88144e 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -109,7 +109,11 @@ Checks: [ -readability-suspicious-call-argument, -readability-uppercase-literal-suffix, -readability-use-anyofallof, - -modernize-loop-convert # since C++20 this complains about reverse loops with iterators, but good ranges support only landed in clang 15 + -modernize-loop-convert, # since C++20 this complains about reverse loops with iterators, but good ranges support only landed in clang 15 + -performance-enum-size, + -misc-include-cleaner, + -readability-redundant-inline-specifier, + -readability-avoid-nested-conditional-operator ] WarningsAsErrors: '*' HeaderFilterRegex: '.*' diff --git a/include/mbgl/gfx/shader_group.hpp b/include/mbgl/gfx/shader_group.hpp index 26ba0082ee5..6b99628f00e 100644 --- a/include/mbgl/gfx/shader_group.hpp +++ b/include/mbgl/gfx/shader_group.hpp @@ -130,8 +130,10 @@ class ShaderGroup { /// @tparam T Derived type, inheriting `gfx::Shader` /// @param to Location to store the shader /// @return True if 'to' has a valid program object, false otherwise. - template , bool>* = nullptr> - bool populate(std::shared_ptr& to) noexcept { + template + bool populate(std::shared_ptr& to) noexcept + requires(is_shader_v) + { if (to) { return true; } diff --git a/include/mbgl/gfx/vertex_attribute.hpp b/include/mbgl/gfx/vertex_attribute.hpp index 7733eda1c94..4048c0de26c 100644 --- a/include/mbgl/gfx/vertex_attribute.hpp +++ b/include/mbgl/gfx/vertex_attribute.hpp @@ -191,12 +191,15 @@ class VertexAttribute { } template - inline typename std::enable_if_t set(std::size_t, std::tuple, std::size_t) {} + inline void set(std::size_t, std::tuple, std::size_t) + requires(I == sizeof...(Tp)) + {} /// Set item value template - inline typename std::enable_if_t < - I set(std::size_t i, std::tuple tuple, std::size_t tupleIndex) { + inline void set(std::size_t i, std::tuple tuple, std::size_t tupleIndex) + requires(I < sizeof...(Tp)) + { if (tupleIndex == 0) { set(i, std::get(tuple).a1); } else { diff --git a/include/mbgl/util/string.hpp b/include/mbgl/util/string.hpp index 9ce3abf550d..ded4df9d081 100644 --- a/include/mbgl/util/string.hpp +++ b/include/mbgl/util/string.hpp @@ -50,6 +50,8 @@ inline std::string toString(uint8_t t) { return toString(static_cast(t)); } +// NOLINTBEGIN(bugprone-incorrect-enable-if) + template >> inline std::string toString(unsigned long t) { return toString(static_cast(t)); @@ -70,6 +72,8 @@ inline std::string toString(long long t) { return toString(static_cast(t)); } +// NOLINTEND(bugprone-incorrect-enable-if) + inline std::string toString(float t, bool decimal = false) { return toString(static_cast(t), decimal); }