Pre-commit: Update to clang-format 17.0.6 and black 24.2.0

This commit is contained in:
Rémi Verschelde 2024-02-28 14:25:35 +01:00
parent df78c0636d
commit 3a08c646ee
No known key found for this signature in database
GPG Key ID: C3336907360768E1
20 changed files with 29 additions and 21 deletions

View File

@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v16.0.6
rev: v17.0.6
hooks:
- id: clang-format
files: \.(c|h|cpp|hpp|cc|cxx|m|mm|inc|java|glsl)$
@ -14,7 +14,7 @@ repos:
)
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 23.3.0
rev: 24.2.0
hooks:
- id: black
files: (\.py$|SConstruct|SCsub)

View File

@ -2,6 +2,7 @@
All such functions are invoked in a subprocess on Windows to prevent build flakiness.
"""
import zlib
from platform_methods import subprocess_main

View File

@ -1415,7 +1415,7 @@ static void gdextension_editor_help_load_xml_from_utf8_chars(const char *p_data)
#endif
}
#define REGISTER_INTERFACE_FUNC(m_name) GDExtension::register_interface_function(#m_name, (GDExtensionInterfaceFunctionPtr)&gdextension_##m_name)
#define REGISTER_INTERFACE_FUNC(m_name) GDExtension::register_interface_function(#m_name, (GDExtensionInterfaceFunctionPtr) & gdextension_##m_name)
void gdextension_setup_interface() {
REGISTER_INTERFACE_FUNC(get_godot_version);

View File

@ -393,7 +393,7 @@ static inline void _build_faces(uint8_t ***p_cell_status, int x, int y, int z, i
return;
}
#define vert(m_idx) Vector3(((m_idx)&4) >> 2, ((m_idx)&2) >> 1, (m_idx)&1)
#define vert(m_idx) Vector3(((m_idx) & 4) >> 2, ((m_idx) & 2) >> 1, (m_idx) & 1)
static const uint8_t indices[6][4] = {
{ 7, 6, 4, 5 },

View File

@ -810,7 +810,7 @@ struct VariantInternalAccessor<bool> {
#define VARIANT_ACCESSOR_NUMBER(m_type) \
template <> \
struct VariantInternalAccessor<m_type> { \
static _FORCE_INLINE_ m_type get(const Variant *v) { return (m_type)*VariantInternal::get_int(v); } \
static _FORCE_INLINE_ m_type get(const Variant *v) { return (m_type) * VariantInternal::get_int(v); } \
static _FORCE_INLINE_ void set(Variant *v, m_type p_value) { *VariantInternal::get_int(v) = p_value; } \
};

View File

@ -433,9 +433,9 @@ Variant Variant::get_named(const StringName &p_member, bool &r_valid) const {
} \
m_assign_type num; \
if (value->get_type() == Variant::INT) { \
num = (m_assign_type)*VariantGetInternalPtr<int64_t>::get_ptr(value); \
num = (m_assign_type) * VariantGetInternalPtr<int64_t>::get_ptr(value); \
} else if (value->get_type() == Variant::FLOAT) { \
num = (m_assign_type)*VariantGetInternalPtr<double>::get_ptr(value); \
num = (m_assign_type) * VariantGetInternalPtr<double>::get_ptr(value); \
} else { \
*oob = false; \
*valid = false; \
@ -495,9 +495,9 @@ Variant Variant::get_named(const StringName &p_member, bool &r_valid) const {
} \
m_assign_type num; \
if (value->get_type() == Variant::INT) { \
num = (m_assign_type)*VariantGetInternalPtr<int64_t>::get_ptr(value); \
num = (m_assign_type) * VariantGetInternalPtr<int64_t>::get_ptr(value); \
} else if (value->get_type() == Variant::FLOAT) { \
num = (m_assign_type)*VariantGetInternalPtr<double>::get_ptr(value); \
num = (m_assign_type) * VariantGetInternalPtr<double>::get_ptr(value); \
} else { \
*oob = false; \
*valid = false; \

View File

@ -47,7 +47,7 @@
#include <wchar.h>
#ifdef _MSC_VER
#define S_ISREG(m) ((m)&_S_IFREG)
#define S_ISREG(m) ((m) & _S_IFREG)
#endif
void FileAccessWindows::check_errors() const {

View File

@ -3,6 +3,7 @@
All such functions are invoked in a subprocess on Windows to prevent build flakiness.
"""
import os.path
from typing import Optional

View File

@ -3,6 +3,7 @@
All such functions are invoked in a subprocess on Windows to prevent build flakiness.
"""
import os.path
from typing import Optional, Iterable

View File

@ -3,6 +3,7 @@
All such functions are invoked in a subprocess on Windows to prevent build flakiness.
"""
from platform_methods import subprocess_main

View File

@ -73,7 +73,7 @@ using namespace godot;
/*************************************************************************/
#define OT_TAG(c1, c2, c3, c4) ((int32_t)((((uint32_t)(c1)&0xff) << 24) | (((uint32_t)(c2)&0xff) << 16) | (((uint32_t)(c3)&0xff) << 8) | ((uint32_t)(c4)&0xff)))
#define OT_TAG(c1, c2, c3, c4) ((int32_t)((((uint32_t)(c1) & 0xff) << 24) | (((uint32_t)(c2) & 0xff) << 16) | (((uint32_t)(c3) & 0xff) << 8) | ((uint32_t)(c4) & 0xff)))
bool TextServerFallback::_has_feature(Feature p_feature) const {
switch (p_feature) {

View File

@ -387,7 +387,7 @@ void EditorExportPlatformAndroid::_check_for_changes_poll_thread(void *ud) {
d.description += "Chipset: " + p.get_slice("=", 1).strip_edges() + "\n";
} else if (p.begins_with("ro.opengles.version=")) {
uint32_t opengl = p.get_slice("=", 1).to_int();
d.description += "OpenGL: " + itos(opengl >> 16) + "." + itos((opengl >> 8) & 0xFF) + "." + itos((opengl)&0xFF) + "\n";
d.description += "OpenGL: " + itos(opengl >> 16) + "." + itos((opengl >> 8) & 0xFF) + "." + itos((opengl) & 0xFF) + "\n";
}
}

View File

@ -3,6 +3,7 @@
All such functions are invoked in a subprocess on Windows to prevent build flakiness.
"""
import os
from platform_methods import subprocess_main

View File

@ -4102,7 +4102,7 @@ void DisplayServerMacOS::cursor_set_custom_image(const Ref<Resource> &p_cursor,
uint8_t alpha = (color >> 24) & 0xFF;
pixels[i * 4 + 0] = ((color >> 16) & 0xFF) * alpha / 255;
pixels[i * 4 + 1] = ((color >> 8) & 0xFF) * alpha / 255;
pixels[i * 4 + 2] = ((color)&0xFF) * alpha / 255;
pixels[i * 4 + 2] = ((color) & 0xFF) * alpha / 255;
pixels[i * 4 + 3] = alpha;
}

View File

@ -3,6 +3,7 @@
All such functions are invoked in a subprocess on Windows to prevent build flakiness.
"""
import os
from platform_methods import subprocess_main

View File

@ -3094,9 +3094,9 @@ void DisplayServerWindows::set_context(Context p_context) {
#define SIGNATURE_MASK 0xFFFFFF00
// Keeping the name suggested by Microsoft, but this macro really answers:
// Is this mouse event emulated from touch or pen input?
#define IsPenEvent(dw) (((dw)&SIGNATURE_MASK) == MI_WP_SIGNATURE)
#define IsPenEvent(dw) (((dw) & SIGNATURE_MASK) == MI_WP_SIGNATURE)
// This one tells whether the event comes from touchscreen (and not from pen).
#define IsTouchEvent(dw) (IsPenEvent(dw) && ((dw)&0x80))
#define IsTouchEvent(dw) (IsPenEvent(dw) && ((dw) & 0x80))
void DisplayServerWindows::_touch_event(WindowID p_window, bool p_pressed, float p_x, float p_y, int idx) {
if (touch_state.has(idx) == p_pressed) {

View File

@ -3,6 +3,7 @@
All such functions are invoked in a subprocess on Windows to prevent build flakiness.
"""
import os
from detect import get_mingw_bin_prefix
from detect import try_cmd

View File

@ -1,5 +1,6 @@
"""Functions used to generate scu build source files during build time
"""
import glob, os
import math
from pathlib import Path

View File

@ -595,7 +595,7 @@ void GodotSoftBody3D::generate_bending_constraints(int p_distance) {
const uint32_t adj_size = n * n;
unsigned *adj = memnew_arr(unsigned, adj_size);
#define IDX(_x_, _y_) ((_y_)*n + (_x_))
#define IDX(_x_, _y_) ((_y_) * n + (_x_))
for (j = 0; j < n; ++j) {
for (i = 0; i < n; ++i) {
int idx_ij = j * n + i;

View File

@ -161,11 +161,11 @@ int register_test_command(String p_command, TestFunc p_function);
MessageQueue::get_singleton()->flush(); \
}
#define _UPDATE_EVENT_MODIFERS(m_event, m_modifers) \
m_event->set_shift_pressed(((m_modifers)&KeyModifierMask::SHIFT) != Key::NONE); \
m_event->set_alt_pressed(((m_modifers)&KeyModifierMask::ALT) != Key::NONE); \
m_event->set_ctrl_pressed(((m_modifers)&KeyModifierMask::CTRL) != Key::NONE); \
m_event->set_meta_pressed(((m_modifers)&KeyModifierMask::META) != Key::NONE);
#define _UPDATE_EVENT_MODIFERS(m_event, m_modifers) \
m_event->set_shift_pressed(((m_modifers) & KeyModifierMask::SHIFT) != Key::NONE); \
m_event->set_alt_pressed(((m_modifers) & KeyModifierMask::ALT) != Key::NONE); \
m_event->set_ctrl_pressed(((m_modifers) & KeyModifierMask::CTRL) != Key::NONE); \
m_event->set_meta_pressed(((m_modifers) & KeyModifierMask::META) != Key::NONE);
#define _CREATE_GUI_MOUSE_EVENT(m_screen_pos, m_input, m_mask, m_modifers) \
Ref<InputEventMouseButton> event; \