diff --git a/core/math/math_fieldwise.cpp b/core/math/math_fieldwise.cpp index ff3ee364b..26d9b9f06 100644 --- a/core/math/math_fieldwise.cpp +++ b/core/math/math_fieldwise.cpp @@ -47,9 +47,7 @@ Variant fieldwise_assign(const Variant &p_target, const Variant &p_source, const /* clang-format off */ switch (p_source.get_type()) { - case Variant::RECT2: { - SETUP_TYPE(Rect2) /**/ TRY_TRANSFER_FIELD("x", position.x) @@ -61,7 +59,6 @@ Variant fieldwise_assign(const Variant &p_target, const Variant &p_source, const } case Variant::RECT2I: { - SETUP_TYPE(Rect2i) /**/ TRY_TRANSFER_FIELD("x", position.x) @@ -93,7 +90,6 @@ Variant fieldwise_assign(const Variant &p_target, const Variant &p_source, const } case Variant::VECTOR3: { - SETUP_TYPE(Vector3) /**/ TRY_TRANSFER_FIELD("x", x) @@ -137,7 +133,6 @@ Variant fieldwise_assign(const Variant &p_target, const Variant &p_source, const } case Variant::PLANE: { - SETUP_TYPE(Plane) /**/ TRY_TRANSFER_FIELD("x", normal.x) @@ -149,7 +144,6 @@ Variant fieldwise_assign(const Variant &p_target, const Variant &p_source, const } case Variant::QUATERNION: { - SETUP_TYPE(Quaternion) /**/ TRY_TRANSFER_FIELD("x", x) @@ -161,7 +155,6 @@ Variant fieldwise_assign(const Variant &p_target, const Variant &p_source, const } case Variant::AABB: { - SETUP_TYPE(AABB) /**/ TRY_TRANSFER_FIELD("px", position.x) @@ -175,7 +168,6 @@ Variant fieldwise_assign(const Variant &p_target, const Variant &p_source, const } case Variant::BASIS: { - SETUP_TYPE(Basis) /**/ TRY_TRANSFER_FIELD("xx", rows[0][0]) @@ -192,7 +184,6 @@ Variant fieldwise_assign(const Variant &p_target, const Variant &p_source, const } case Variant::TRANSFORM: { - SETUP_TYPE(Transform) /**/ TRY_TRANSFER_FIELD("xx", basis.rows[0][0]) diff --git a/core/variant/variant_op.cpp b/core/variant/variant_op.cpp index 01ed80753..d74c50489 100644 --- a/core/variant/variant_op.cpp +++ b/core/variant/variant_op.cpp @@ -2273,8 +2273,12 @@ Variant Variant::get_named(const StringName &p_index, bool *r_valid) const { } \ } break; +// clang-format 14 wants to add a space after the last return, +// and clang-format 15 removes it... +/* clang-format off */ #define DEFAULT_OP_DVECTOR_SET(m_name, dv_type, skip_cond) \ - DEFAULT_OP_ARRAY_CMD(m_name, PoolVector, if (skip_cond) return;, arr->set(index, p_value); return ) + DEFAULT_OP_ARRAY_CMD(m_name, PoolVector, if (skip_cond) return;, arr->set(index, p_value); return) +/* clang-format on */ #define DEFAULT_OP_DVECTOR_GET(m_name, dv_type) \ DEFAULT_OP_ARRAY_CMD(m_name, const PoolVector, ;, return arr->get(index)) @@ -3300,7 +3304,11 @@ void Variant::set(const Variant &p_index, const Variant &p_value, bool *r_valid) valid = true; //always valid, i guess? should this really be ok? return; } break; - DEFAULT_OP_ARRAY_CMD(ARRAY, Array, ;, (*arr)[index] = p_value; return ) // 20 + // clang-format 14 wants to add a space after the last return, + // and clang-format 15 removes it... + /* clang-format off */ + DEFAULT_OP_ARRAY_CMD(ARRAY, Array, ;, (*arr)[index] = p_value; return) // 20 + /* clang-format on */ DEFAULT_OP_DVECTOR_SET(POOL_BYTE_ARRAY, uint8_t, p_value.type != Variant::REAL && p_value.type != Variant::INT) DEFAULT_OP_DVECTOR_SET(POOL_INT_ARRAY, int, p_value.type != Variant::REAL && p_value.type != Variant::INT) DEFAULT_OP_DVECTOR_SET(POOL_REAL_ARRAY, real_t, p_value.type != Variant::REAL && p_value.type != Variant::INT) diff --git a/misc/hooks/README.md b/misc/hooks/README.md index 0e2157507..230ec6161 100644 --- a/misc/hooks/README.md +++ b/misc/hooks/README.md @@ -28,7 +28,7 @@ so they should work out of the box on Linux/macOS. #### Windows ##### clang-format -- Download LLVM for Windows (version 8 or later) from +- Download LLVM for Windows (version 13 or later) from - Make sure LLVM is added to the `PATH` during installation diff --git a/misc/hooks/pre-commit-clang-format b/misc/hooks/pre-commit-clang-format index e0a255541..e24495409 100755 --- a/misc/hooks/pre-commit-clang-format +++ b/misc/hooks/pre-commit-clang-format @@ -76,8 +76,8 @@ fi # To get consistent formatting, we recommend contributors to use the same # clang-format version as CI. -RECOMMENDED_CLANG_FORMAT_MAJOR_MIN="12" -RECOMMENDED_CLANG_FORMAT_MAJOR_MAX="14" +RECOMMENDED_CLANG_FORMAT_MAJOR_MIN="13" +RECOMMENDED_CLANG_FORMAT_MAJOR_MAX="15" if [ ! -x "$CLANG_FORMAT" ] ; then message="Error: clang-format executable not found. Please install clang-format $RECOMMENDED_CLANG_FORMAT_MAJOR_MAX." diff --git a/modules/websocket/websocket_macros.h b/modules/websocket/websocket_macros.h index 70a43ce9c..8528d78f6 100644 --- a/modules/websocket/websocket_macros.h +++ b/modules/websocket/websocket_macros.h @@ -40,34 +40,32 @@ #define WSS_OUT_BUF "network/limits/websocket_server/max_out_buffer_kb" #define WSS_OUT_PKT "network/limits/websocket_server/max_out_packets" -/* clang-format off */ -#define GDCICLASS(CNAME) \ -public:\ - static CNAME *(*_create)();\ -\ - static Ref create_ref() {\ -\ - if (!_create)\ - return Ref();\ - return Ref(_create());\ - }\ -\ - static CNAME *create() {\ -\ - if (!_create)\ - return NULL;\ - return _create();\ - }\ -protected:\ +#define GDCICLASS(CNAME) \ +public: \ + static CNAME *(*_create)(); \ + \ + static Ref create_ref() { \ + if (!_create) \ + return Ref(); \ + return Ref(_create()); \ + } \ + \ + static CNAME *create() { \ + if (!_create) \ + return NULL; \ + return _create(); \ + } \ + \ +protected: #define GDCINULL(CNAME) \ -CNAME *(*CNAME::_create)() = NULL; + CNAME *(*CNAME::_create)() = NULL; -#define GDCIIMPL(IMPNAME, CNAME) \ -public:\ - static CNAME *_create() { return memnew(IMPNAME); }\ - static void make_default() { CNAME::_create = IMPNAME::_create; }\ -protected:\ -/* clang-format on */ +#define GDCIIMPL(IMPNAME, CNAME) \ +public: \ + static CNAME *_create() { return memnew(IMPNAME); } \ + static void make_default() { CNAME::_create = IMPNAME::_create; } \ + \ +protected: #endif // WEBSOCKETMACTOS_H