Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pre-commit.ci] pre-commit autoupdate #1096

Merged
merged 2 commits into from
May 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -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)'
Expand Down
5 changes: 3 additions & 2 deletions include/mbgl/gfx/shader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ class Shader;
// * Declare a public, unique type name (string_view T::Name)
// * Be a final class
template <typename T>
inline constexpr bool is_shader_v = std::is_base_of_v<gfx::Shader, T>&&
std::is_same_v<std::remove_cv_t<decltype(T::Name)>, std::string_view>&& std::is_final_v<T>;
inline constexpr bool is_shader_v = std::is_base_of_v<gfx::Shader, T> &&
std::is_same_v<std::remove_cv_t<decltype(T::Name)>, std::string_view> &&
std::is_final_v<T>;

/// @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.
Expand Down
14 changes: 8 additions & 6 deletions include/mbgl/platform/gl_functions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
14 changes: 8 additions & 6 deletions platform/android/src/example_custom_layer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions platform/android/src/test/runtime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<CreateJavaVMFn>(dlsym(vmHandle, "JNI_CreateJavaVM"));
assert(createJavaVMFn != nullptr);

Expand Down Expand Up @@ -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<RegisterNativesFn>(
dlsym(runtimeHandle, "registerFrameworkNatives"));
assert(registerNativesFn != nullptr);
Expand Down
8 changes: 2 additions & 6 deletions platform/default/src/mbgl/gl/headless_backend_osmesa.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down
14 changes: 8 additions & 6 deletions platform/default/src/mbgl/storage/sqlite3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@
#include <mbgl/util/traits.hpp>
#include <mbgl/util/logging.hpp>

#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 {
Expand Down
8 changes: 2 additions & 6 deletions platform/qt/src/utils/conversion.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,9 @@ class ConversionTraits<QVariant> {
#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<int>(i)];
}
static QVariant arrayMember(const QVariant& value, std::size_t i) { return value.toList()[static_cast<int>(i)]; }

static bool isObject(const QVariant& value) {
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
Expand Down
4 changes: 3 additions & 1 deletion src/mbgl/gfx/attribute.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
#define MBGL_DEFINE_ATTRIBUTE(type_, n_, name_) \
struct name_ { \
using Type = ::mbgl::gfx::AttributeType<type_, n_>; \
static constexpr auto name() { return #name_; } \
static constexpr auto name() { \
return #name_; \
} \
}

#if defined(_MSC_VER) && !defined(__clang__)
Expand Down
10 changes: 6 additions & 4 deletions src/mbgl/gfx/texture.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@
#include <memory>
#include <cassert>

#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 {
Expand Down
30 changes: 18 additions & 12 deletions src/mbgl/gfx/uniform.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,28 @@

#include <array>

#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<type_, n_>; \
static constexpr auto name() { return #name_; } \
#define MBGL_DEFINE_UNIFORM_VECTOR(type_, n_, name_) \
struct name_ { \
using Value = std::array<type_, n_>; \
static constexpr auto name() { \
return #name_; \
} \
}

#define MBGL_DEFINE_UNIFORM_MATRIX(type_, n_, name_) \
struct name_ { \
using Value = std::array<type_, n_ * n_>; \
static constexpr auto name() { return #name_; } \
#define MBGL_DEFINE_UNIFORM_MATRIX(type_, n_, name_) \
struct name_ { \
using Value = std::array<type_, n_ * n_>; \
static constexpr auto name() { \
return #name_; \
} \
}

namespace mbgl {
Expand Down
12 changes: 3 additions & 9 deletions src/mbgl/renderer/layers/render_location_indicator_layer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down