Skip to content

Commit

Permalink
Merge pull request #88959 from akien-mga/pre-commit-clang-17.0.6-blac…
Browse files Browse the repository at this point in the history
…k-24.2.0

Pre-commit: Update to clang-format 17.0.6 and black 24.2.0
  • Loading branch information
akien-mga committed Feb 29, 2024
2 parents 9101067 + 3a08c64 commit 7434f8b
Show file tree
Hide file tree
Showing 20 changed files with 29 additions and 21 deletions.
4 changes: 2 additions & 2 deletions .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: v16.0.6
rev: v17.0.6
hooks:
- id: clang-format
files: \.(c|h|cpp|hpp|cc|cxx|m|mm|inc|java|glsl)$
Expand All @@ -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)
Expand Down
1 change: 1 addition & 0 deletions core/core_builders.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion core/extension/gdextension_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion core/math/geometry_3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
Expand Down
2 changes: 1 addition & 1 deletion core/variant/variant_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -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; } \
};

Expand Down
8 changes: 4 additions & 4 deletions core/variant/variant_setget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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; \
Expand Down Expand Up @@ -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; \
Expand Down
2 changes: 1 addition & 1 deletion drivers/windows/file_access_windows.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
1 change: 1 addition & 0 deletions gles3_builders.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions glsl_builders.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions main/main_builders.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
All such functions are invoked in a subprocess on Windows to prevent build flakiness.
"""

from platform_methods import subprocess_main


Expand Down
2 changes: 1 addition & 1 deletion modules/text_server_fb/text_server_fb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion platform/android/export/export_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}
}

Expand Down
1 change: 1 addition & 0 deletions platform/linuxbsd/platform_linuxbsd_builders.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion platform/macos/display_server_macos.mm
Original file line number Diff line number Diff line change
Expand Up @@ -4102,7 +4102,7 @@
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;
}

Expand Down
1 change: 1 addition & 0 deletions platform/macos/platform_macos_builders.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions platform/windows/display_server_windows.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
1 change: 1 addition & 0 deletions platform/windows/platform_windows_builders.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions scu_builders.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Functions used to generate scu build source files during build time
"""

import glob, os
import math
from pathlib import Path
Expand Down
2 changes: 1 addition & 1 deletion servers/physics_3d/godot_soft_body_3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
10 changes: 5 additions & 5 deletions tests/test_macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -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; \
Expand Down

0 comments on commit 7434f8b

Please sign in to comment.