From c92a6c7e27cc51e1161425fd2d6e85a63d4b81fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Thu, 26 Sep 2024 11:26:17 +0200 Subject: [PATCH] CI: Update `clang-format` pre-commit hook to 19.1.0 --- .pre-commit-config.yaml | 2 +- core/math/convex_hull.cpp | 2 +- drivers/d3d12/rendering_device_driver_d3d12.cpp | 2 +- drivers/metal/metal_objects.mm | 2 +- drivers/vulkan/rendering_context_driver_vulkan.h | 4 ++-- drivers/xaudio2/audio_driver_xaudio2.cpp | 4 ++-- modules/lightmapper_rd/lm_compute.glsl | 2 +- modules/mono/mono_gd/gd_mono.cpp | 2 +- platform/android/api/java_class_wrapper.h | 2 +- platform/linuxbsd/wayland/wayland_thread.h | 4 ++-- scene/gui/scroll_bar.cpp | 2 +- servers/audio/audio_driver_dummy.cpp | 2 +- servers/rendering/rendering_device.h | 2 +- servers/rendering_server.h | 2 +- 14 files changed, 17 insertions(+), 17 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8cfb00fd8ee..572eaf67912 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -9,7 +9,7 @@ exclude: | repos: - repo: https://github.com/pre-commit/mirrors-clang-format - rev: v18.1.8 + rev: v19.1.0 hooks: - id: clang-format files: \.(c|h|cpp|hpp|cc|hh|cxx|hxx|m|mm|inc|java|glsl)$ diff --git a/core/math/convex_hull.cpp b/core/math/convex_hull.cpp index 80662c1b07b..620a7541e45 100644 --- a/core/math/convex_hull.cpp +++ b/core/math/convex_hull.cpp @@ -204,7 +204,7 @@ public: static Int128 mul(uint64_t a, uint64_t b); Int128 operator-() const { - return Int128((uint64_t) - (int64_t)low, ~high + (low == 0)); + return Int128(uint64_t(-int64_t(low)), ~high + (low == 0)); } Int128 operator+(const Int128 &b) const { diff --git a/drivers/d3d12/rendering_device_driver_d3d12.cpp b/drivers/d3d12/rendering_device_driver_d3d12.cpp index a445006058c..52883de45e6 100644 --- a/drivers/d3d12/rendering_device_driver_d3d12.cpp +++ b/drivers/d3d12/rendering_device_driver_d3d12.cpp @@ -3244,7 +3244,7 @@ Vector RenderingDeviceDriverD3D12::shader_compile_binary_from_spirv(Vec DEV_ASSERT(binding_info.res_class == (uint32_t)RES_CLASS_INVALID || binding_info.res_class == (uint32_t)res_class); binding_info.res_class = res_class; } else if (p_dxil_type == DXIL_RES_SAMPLER) { - binding_info.has_sampler = (uint32_t) true; + binding_info.has_sampler = (uint32_t)true; } else { CRASH_NOW(); } diff --git a/drivers/metal/metal_objects.mm b/drivers/metal/metal_objects.mm index 1d08a10781d..596728212a5 100644 --- a/drivers/metal/metal_objects.mm +++ b/drivers/metal/metal_objects.mm @@ -1212,7 +1212,7 @@ vertex VaryingsPos vertClear(AttributesPos attributes [[stage_in]], constant Cle return varyings; } )", - ClearAttKey::DEPTH_INDEX]; + ClearAttKey::DEPTH_INDEX]; return new_func(msl, @"vertClear", nil); } diff --git a/drivers/vulkan/rendering_context_driver_vulkan.h b/drivers/vulkan/rendering_context_driver_vulkan.h index 4fbca012c61..f9352d617b8 100644 --- a/drivers/vulkan/rendering_context_driver_vulkan.h +++ b/drivers/vulkan/rendering_context_driver_vulkan.h @@ -169,7 +169,7 @@ public: static VkAllocationCallbacks *get_allocation_callbacks(VkObjectType p_type); #if defined(VK_TRACK_DRIVER_MEMORY) || defined(VK_TRACK_DEVICE_MEMORY) - enum VkTrackedObjectType{ + enum VkTrackedObjectType { VK_TRACKED_OBJECT_DESCRIPTOR_UPDATE_TEMPLATE_KHR = VK_OBJECT_TYPE_COMMAND_POOL + 1, VK_TRACKED_OBJECT_TYPE_SURFACE, VK_TRACKED_OBJECT_TYPE_SWAPCHAIN, @@ -180,7 +180,7 @@ public: VK_TRACKED_OBJECT_TYPE_COUNT }; - enum VkTrackedSystemAllocationScope{ + enum VkTrackedSystemAllocationScope { VK_TRACKED_SYSTEM_ALLOCATION_SCOPE_COUNT = VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE + 1 }; #endif diff --git a/drivers/xaudio2/audio_driver_xaudio2.cpp b/drivers/xaudio2/audio_driver_xaudio2.cpp index 3fe3ea058b3..0c2fdb64df7 100644 --- a/drivers/xaudio2/audio_driver_xaudio2.cpp +++ b/drivers/xaudio2/audio_driver_xaudio2.cpp @@ -48,9 +48,9 @@ Error AudioDriverXAudio2::init() { int latency = Engine::get_singleton()->get_audio_output_latency(); buffer_size = closest_power_of_2(latency * mix_rate / 1000); - samples_in = memnew_arr(int32_t, buffer_size * channels); + samples_in = memnew_arr(int32_t, size_t(buffer_size) * channels); for (int i = 0; i < AUDIO_BUFFERS; i++) { - samples_out[i] = memnew_arr(int16_t, buffer_size * channels); + samples_out[i] = memnew_arr(int16_t, size_t(buffer_size) * channels); xaudio_buffer[i].AudioBytes = buffer_size * channels * sizeof(int16_t); xaudio_buffer[i].pAudioData = (const BYTE *)(samples_out[i]); xaudio_buffer[i].Flags = 0; diff --git a/modules/lightmapper_rd/lm_compute.glsl b/modules/lightmapper_rd/lm_compute.glsl index 2c85fff6f38..31b721bb20c 100644 --- a/modules/lightmapper_rd/lm_compute.glsl +++ b/modules/lightmapper_rd/lm_compute.glsl @@ -485,7 +485,7 @@ void trace_direct_light(vec3 p_position, vec3 p_normal, uint p_light_index, bool float a = randomize(r_noise) * 2.0 * PI; float vogel_index = float(total_ray_count - 1 - (i * shadowing_ray_count + j)); // Start from (total_ray_count - 1) so we check the outer points first. - vec2 light_disk_sample = (get_vogel_disk(vogel_index, a, shadowing_ray_count_sqrt)) * soft_shadowing_disk_size * light_data.shadow_blur; + vec2 light_disk_sample = get_vogel_disk(vogel_index, a, shadowing_ray_count_sqrt) * soft_shadowing_disk_size * light_data.shadow_blur; vec3 light_disk_to_point = normalize(light_to_point + light_disk_sample.x * light_to_point_tan + light_disk_sample.y * light_to_point_bitan); // Offset the ray origin for AA, offset the light position for soft shadows. if (trace_ray_any_hit(origin - light_disk_to_point * (bake_params.bias + length(disk_sample)), p_position - light_disk_to_point * dist) == RAY_MISS) { diff --git a/modules/mono/mono_gd/gd_mono.cpp b/modules/mono/mono_gd/gd_mono.cpp index 6abf0193cfa..c81aa91fa5f 100644 --- a/modules/mono/mono_gd/gd_mono.cpp +++ b/modules/mono/mono_gd/gd_mono.cpp @@ -388,7 +388,7 @@ godot_plugins_initialize_fn initialize_hostfxr_and_godot_plugins(bool &r_runtime String assembly_name = path::get_csharp_project_name(); HostFxrCharString assembly_path = str_to_hostfxr(GodotSharpDirs::get_api_assemblies_dir() - .path_join(assembly_name + ".dll")); + .path_join(assembly_name + ".dll")); load_assembly_and_get_function_pointer_fn load_assembly_and_get_function_pointer = initialize_hostfxr_self_contained(get_data(assembly_path)); diff --git a/platform/android/api/java_class_wrapper.h b/platform/android/api/java_class_wrapper.h index 52df1644be8..71f9c32318f 100644 --- a/platform/android/api/java_class_wrapper.h +++ b/platform/android/api/java_class_wrapper.h @@ -47,7 +47,7 @@ class JavaClass : public RefCounted { GDCLASS(JavaClass, RefCounted); #ifdef ANDROID_ENABLED - enum ArgumentType{ + enum ArgumentType { ARG_TYPE_VOID, ARG_TYPE_BOOLEAN, ARG_TYPE_BYTE, diff --git a/platform/linuxbsd/wayland/wayland_thread.h b/platform/linuxbsd/wayland/wayland_thread.h index ad2e843a748..819a1205d68 100644 --- a/platform/linuxbsd/wayland/wayland_thread.h +++ b/platform/linuxbsd/wayland/wayland_thread.h @@ -665,7 +665,7 @@ private: .preferred_buffer_transform = _wl_surface_on_preferred_buffer_transform, }; - static constexpr struct wl_callback_listener frame_wl_callback_listener { + static constexpr struct wl_callback_listener frame_wl_callback_listener = { .done = _frame_wl_callback_on_done, }; @@ -683,7 +683,7 @@ private: .name = _wl_seat_on_name, }; - static constexpr struct wl_callback_listener cursor_frame_callback_listener { + static constexpr struct wl_callback_listener cursor_frame_callback_listener = { .done = _cursor_frame_callback_on_done, }; diff --git a/scene/gui/scroll_bar.cpp b/scene/gui/scroll_bar.cpp index af9f08e389b..eb69dab4780 100644 --- a/scene/gui/scroll_bar.cpp +++ b/scene/gui/scroll_bar.cpp @@ -472,7 +472,7 @@ double ScrollBar::get_area_size() const { } double ScrollBar::get_grabber_offset() const { - return (get_area_size()) * get_as_ratio(); + return get_area_size() * get_as_ratio(); } Size2 ScrollBar::get_minimum_size() const { diff --git a/servers/audio/audio_driver_dummy.cpp b/servers/audio/audio_driver_dummy.cpp index e1bfcbaca19..d41aa752ed0 100644 --- a/servers/audio/audio_driver_dummy.cpp +++ b/servers/audio/audio_driver_dummy.cpp @@ -45,7 +45,7 @@ Error AudioDriverDummy::init() { } channels = get_channels(); - samples_in = memnew_arr(int32_t, (size_t)buffer_frames * channels); + samples_in = memnew_arr(int32_t, size_t(buffer_frames) * channels); if (use_threads) { thread.start(AudioDriverDummy::thread_func, this); diff --git a/servers/rendering/rendering_device.h b/servers/rendering/rendering_device.h index 1405f585b24..d8bf8457560 100644 --- a/servers/rendering/rendering_device.h +++ b/servers/rendering/rendering_device.h @@ -800,7 +800,7 @@ private: #ifndef DISABLE_DEPRECATED public: - enum BarrierMask{ + enum BarrierMask { BARRIER_MASK_VERTEX = 1, BARRIER_MASK_FRAGMENT = 8, BARRIER_MASK_COMPUTE = 2, diff --git a/servers/rendering_server.h b/servers/rendering_server.h index a130ae0ba27..878b02eaf13 100644 --- a/servers/rendering_server.h +++ b/servers/rendering_server.h @@ -1740,7 +1740,7 @@ public: #ifndef DISABLE_DEPRECATED // Never actually used, should be removed when we can break compatibility. - enum Features{ + enum Features { FEATURE_SHADERS, FEATURE_MULTITHREADED, };