From 958cdb82067cc16c2e7a6746b24221240d3e7927 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 2 May 2023 10:15:53 +0200 Subject: [PATCH] [pre-commit.ci] pre-commit autoupdate (#1096) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- include/mbgl/gfx/shader.hpp | 5 ++-- include/mbgl/platform/gl_functions.hpp | 14 +++++---- platform/android/src/example_custom_layer.cpp | 14 +++++---- platform/android/src/test/runtime.cpp | 4 +-- .../src/mbgl/gl/headless_backend_osmesa.cpp | 8 ++--- platform/default/src/mbgl/storage/sqlite3.cpp | 14 +++++---- platform/qt/src/utils/conversion.hpp | 8 ++--- src/mbgl/gfx/attribute.hpp | 4 ++- src/mbgl/gfx/texture.hpp | 10 ++++--- src/mbgl/gfx/uniform.hpp | 30 +++++++++++-------- .../render_location_indicator_layer.cpp | 12 ++------ 12 files changed, 64 insertions(+), 61 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5887c742e71..8abfafd9b27 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/pre-commit/mirrors-clang-format - rev: v14.0.6 + rev: v16.0.2 hooks: - id: clang-format files: '.*\.(hpp|cpp|h)' diff --git a/include/mbgl/gfx/shader.hpp b/include/mbgl/gfx/shader.hpp index 5241ab0341d..c629536d755 100644 --- a/include/mbgl/gfx/shader.hpp +++ b/include/mbgl/gfx/shader.hpp @@ -14,8 +14,9 @@ class Shader; // * Declare a public, unique type name (string_view T::Name) // * Be a final class template -inline constexpr bool is_shader_v = std::is_base_of_v&& - std::is_same_v, std::string_view>&& std::is_final_v; +inline constexpr bool is_shader_v = std::is_base_of_v && + std::is_same_v, std::string_view> && + std::is_final_v; /// @brief A shader is used as the base class for all programs across any supported /// backend API. Shaders are registered with a `gfx::ShaderRegistry` instance. diff --git a/include/mbgl/platform/gl_functions.hpp b/include/mbgl/platform/gl_functions.hpp index ab1766b04a2..9fc3c3f6eb8 100644 --- a/include/mbgl/platform/gl_functions.hpp +++ b/include/mbgl/platform/gl_functions.hpp @@ -7,12 +7,14 @@ // initialized by the platform at linking time. #ifndef NDEBUG -#define MBGL_CHECK_ERROR(cmd) \ - ([&]() { \ - struct __MBGL_CHECK_ERROR { \ - ~__MBGL_CHECK_ERROR() noexcept(false) { mbgl::platform::glCheckError(#cmd, __FILE__, __LINE__); } \ - } __MBGL_CHECK_ERROR; \ - return cmd; \ +#define MBGL_CHECK_ERROR(cmd) \ + ([&]() { \ + struct __MBGL_CHECK_ERROR { \ + ~__MBGL_CHECK_ERROR() noexcept(false) { \ + mbgl::platform::glCheckError(#cmd, __FILE__, __LINE__); \ + } \ + } __MBGL_CHECK_ERROR; \ + return cmd; \ }()) #else #define MBGL_CHECK_ERROR(cmd) (cmd) diff --git a/platform/android/src/example_custom_layer.cpp b/platform/android/src/example_custom_layer.cpp index 93e6ed76325..621a177084d 100644 --- a/platform/android/src/example_custom_layer.cpp +++ b/platform/android/src/example_custom_layer.cpp @@ -72,12 +72,14 @@ void checkError(const char *cmd, const char *file, int line) { } #ifndef NDEBUG -#define GL_CHECK_ERROR(cmd) \ - ([&]() { \ - struct __MBGL_C_E { \ - ~__MBGL_C_E() noexcept(false) { checkError(#cmd, __FILE__, __LINE__); } \ - } __MBGL_C_E; \ - return cmd; \ +#define GL_CHECK_ERROR(cmd) \ + ([&]() { \ + struct __MBGL_C_E { \ + ~__MBGL_C_E() noexcept(false) { \ + checkError(#cmd, __FILE__, __LINE__); \ + } \ + } __MBGL_C_E; \ + return cmd; \ }()) #else #define GL_CHECK_ERROR(cmd) (cmd) diff --git a/platform/android/src/test/runtime.cpp b/platform/android/src/test/runtime.cpp index 10f203db207..80f8105173b 100644 --- a/platform/android/src/test/runtime.cpp +++ b/platform/android/src/test/runtime.cpp @@ -26,7 +26,7 @@ bool initRuntime(int argc, char* argv[]) { void* vmHandle = dlopen("libart.so", RTLD_NOW); assert(vmHandle != nullptr); - using CreateJavaVMFn = jint (*)(JavaVM * *vm, JNIEnv * *env, void* vmArgs); + using CreateJavaVMFn = jint (*)(JavaVM** vm, JNIEnv** env, void* vmArgs); CreateJavaVMFn createJavaVMFn = reinterpret_cast(dlsym(vmHandle, "JNI_CreateJavaVM")); assert(createJavaVMFn != nullptr); @@ -58,7 +58,7 @@ bool initRuntime(int argc, char* argv[]) { void* runtimeHandle = dlopen("libandroid_runtime.so", RTLD_NOW); assert(runtimeHandle != nullptr); - using RegisterNativesFn = jint (*)(JNIEnv * env); + using RegisterNativesFn = jint (*)(JNIEnv* env); RegisterNativesFn registerNativesFn = reinterpret_cast( dlsym(runtimeHandle, "registerFrameworkNatives")); assert(registerNativesFn != nullptr); diff --git a/platform/default/src/mbgl/gl/headless_backend_osmesa.cpp b/platform/default/src/mbgl/gl/headless_backend_osmesa.cpp index 75e5dc8ab21..e1f4f907e4c 100644 --- a/platform/default/src/mbgl/gl/headless_backend_osmesa.cpp +++ b/platform/default/src/mbgl/gl/headless_backend_osmesa.cpp @@ -21,13 +21,9 @@ class OSMesaBackendImpl : public HeadlessBackend::Impl { } } - ~OSMesaBackendImpl() final { - OSMesaDestroyContext(glContext); - } + ~OSMesaBackendImpl() final { OSMesaDestroyContext(glContext); } - gl::ProcAddress getExtensionFunctionPointer(const char* name) final { - return OSMesaGetProcAddress(name); - } + gl::ProcAddress getExtensionFunctionPointer(const char* name) final { return OSMesaGetProcAddress(name); } void activateContext() final { if (!OSMesaMakeCurrent(glContext, &fakeBuffer, GL_UNSIGNED_BYTE, 1, 1)) { diff --git a/platform/default/src/mbgl/storage/sqlite3.cpp b/platform/default/src/mbgl/storage/sqlite3.cpp index 28e5351eb12..6a41c52fcae 100644 --- a/platform/default/src/mbgl/storage/sqlite3.cpp +++ b/platform/default/src/mbgl/storage/sqlite3.cpp @@ -11,12 +11,14 @@ #include #include -#define MBGL_CONSTRUCTOR(f) \ - static void f(void); \ - struct f##_t_ { \ - f##_t_(void) { f(); } \ - }; \ - static f##_t_ f##_; \ +#define MBGL_CONSTRUCTOR(f) \ + static void f(void); \ + struct f##_t_ { \ + f##_t_(void) { \ + f(); \ + } \ + }; \ + static f##_t_ f##_; \ static void f(void) namespace mapbox { diff --git a/platform/qt/src/utils/conversion.hpp b/platform/qt/src/utils/conversion.hpp index 9bd5ec46a4f..6e8af00cefe 100644 --- a/platform/qt/src/utils/conversion.hpp +++ b/platform/qt/src/utils/conversion.hpp @@ -31,13 +31,9 @@ class ConversionTraits { #endif } - static std::size_t arrayLength(const QVariant& value) { - return value.toList().size(); - } + static std::size_t arrayLength(const QVariant& value) { return value.toList().size(); } - static QVariant arrayMember(const QVariant& value, std::size_t i) { - return value.toList()[static_cast(i)]; - } + static QVariant arrayMember(const QVariant& value, std::size_t i) { return value.toList()[static_cast(i)]; } static bool isObject(const QVariant& value) { #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) diff --git a/src/mbgl/gfx/attribute.hpp b/src/mbgl/gfx/attribute.hpp index 1f4826beba1..db84f8b002c 100644 --- a/src/mbgl/gfx/attribute.hpp +++ b/src/mbgl/gfx/attribute.hpp @@ -14,7 +14,9 @@ #define MBGL_DEFINE_ATTRIBUTE(type_, n_, name_) \ struct name_ { \ using Type = ::mbgl::gfx::AttributeType; \ - static constexpr auto name() { return #name_; } \ + static constexpr auto name() { \ + return #name_; \ + } \ } #if defined(_MSC_VER) && !defined(__clang__) diff --git a/src/mbgl/gfx/texture.hpp b/src/mbgl/gfx/texture.hpp index 851daa464f6..b2f40d85569 100644 --- a/src/mbgl/gfx/texture.hpp +++ b/src/mbgl/gfx/texture.hpp @@ -8,10 +8,12 @@ #include #include -#define MBGL_DEFINE_TEXTURE(name_) \ - struct name_ { \ - using Value = ::mbgl::gfx::TextureBinding; \ - static constexpr auto name() { return #name_; } \ +#define MBGL_DEFINE_TEXTURE(name_) \ + struct name_ { \ + using Value = ::mbgl::gfx::TextureBinding; \ + static constexpr auto name() { \ + return #name_; \ + } \ } namespace mbgl { diff --git a/src/mbgl/gfx/uniform.hpp b/src/mbgl/gfx/uniform.hpp index c69d6f0141d..3ce9f278bdb 100644 --- a/src/mbgl/gfx/uniform.hpp +++ b/src/mbgl/gfx/uniform.hpp @@ -5,22 +5,28 @@ #include -#define MBGL_DEFINE_UNIFORM_SCALAR(type_, name_) \ - struct name_ { \ - using Value = type_; \ - static constexpr auto name() { return #name_; } \ +#define MBGL_DEFINE_UNIFORM_SCALAR(type_, name_) \ + struct name_ { \ + using Value = type_; \ + static constexpr auto name() { \ + return #name_; \ + } \ } -#define MBGL_DEFINE_UNIFORM_VECTOR(type_, n_, name_) \ - struct name_ { \ - using Value = std::array; \ - static constexpr auto name() { return #name_; } \ +#define MBGL_DEFINE_UNIFORM_VECTOR(type_, n_, name_) \ + struct name_ { \ + using Value = std::array; \ + static constexpr auto name() { \ + return #name_; \ + } \ } -#define MBGL_DEFINE_UNIFORM_MATRIX(type_, n_, name_) \ - struct name_ { \ - using Value = std::array; \ - static constexpr auto name() { return #name_; } \ +#define MBGL_DEFINE_UNIFORM_MATRIX(type_, n_, name_) \ + struct name_ { \ + using Value = std::array; \ + static constexpr auto name() { \ + return #name_; \ + } \ } namespace mbgl { diff --git a/src/mbgl/renderer/layers/render_location_indicator_layer.cpp b/src/mbgl/renderer/layers/render_location_indicator_layer.cpp index 00996f25176..a12301000da 100644 --- a/src/mbgl/renderer/layers/render_location_indicator_layer.cpp +++ b/src/mbgl/renderer/layers/render_location_indicator_layer.cpp @@ -673,17 +673,11 @@ void main() { texturedShader.detach(); } - void drawShadow() { - drawQuad(shadowBuffer, shadowGeometry, texShadow); - } + void drawShadow() { drawQuad(shadowBuffer, shadowGeometry, texShadow); } - void drawPuck() { - drawQuad(puckBuffer, puckGeometry, texPuck); - } + void drawPuck() { drawQuad(puckBuffer, puckGeometry, texPuck); } - void drawHat() { - drawQuad(hatBuffer, hatGeometry, texPuckHat); - } + void drawHat() { drawQuad(hatBuffer, hatGeometry, texPuckHat); } static LatLng screenCoordinateToLatLng(const ScreenCoordinate& p, const TransformState& s,