Style: Ensure consistent formatting with clang-format 15

When going from version 14 to 15 it would introduce a tiny change in
`websocket_macros.h` just before the comment re-enabling clang-format,
but this can be solved by just letting it do its work.

Bonus cosmetic change in `math_fieldwise.cpp` where clang-format isn't
used, and bump recommended versions for pre-commit hook to [13; 15].
This commit is contained in:
Rémi Verschelde 2022-09-21 12:48:48 +02:00
parent 307f560b39
commit 5408af1407
3 changed files with 29 additions and 29 deletions

View File

@ -76,6 +76,7 @@ Variant fieldwise_assign(const Variant &p_target, const Variant &p_source, const
return target; return target;
} }
case Variant::VECTOR3I: { case Variant::VECTOR3I: {
SETUP_TYPE(Vector3i) SETUP_TYPE(Vector3i)
@ -85,6 +86,7 @@ Variant fieldwise_assign(const Variant &p_target, const Variant &p_source, const
return target; return target;
} }
case Variant::VECTOR4: { case Variant::VECTOR4: {
SETUP_TYPE(Vector4) SETUP_TYPE(Vector4)
@ -95,6 +97,7 @@ Variant fieldwise_assign(const Variant &p_target, const Variant &p_source, const
return target; return target;
} }
case Variant::VECTOR4I: { case Variant::VECTOR4I: {
SETUP_TYPE(Vector4i) SETUP_TYPE(Vector4i)
@ -106,7 +109,6 @@ Variant fieldwise_assign(const Variant &p_target, const Variant &p_source, const
return target; return target;
} }
case Variant::PLANE: { case Variant::PLANE: {
SETUP_TYPE(Plane) SETUP_TYPE(Plane)

View File

@ -76,8 +76,8 @@ fi
# To get consistent formatting, we recommend contributors to use the same # To get consistent formatting, we recommend contributors to use the same
# clang-format version as CI. # clang-format version as CI.
RECOMMENDED_CLANG_FORMAT_MAJOR_MIN="12" RECOMMENDED_CLANG_FORMAT_MAJOR_MIN="13"
RECOMMENDED_CLANG_FORMAT_MAJOR_MAX="14" RECOMMENDED_CLANG_FORMAT_MAJOR_MAX="15"
if [ ! -x "$CLANG_FORMAT" ] ; then if [ ! -x "$CLANG_FORMAT" ] ; then
message="Error: clang-format executable not found. Please install clang-format $RECOMMENDED_CLANG_FORMAT_MAJOR_MAX." message="Error: clang-format executable not found. Please install clang-format $RECOMMENDED_CLANG_FORMAT_MAJOR_MAX."

View File

@ -35,34 +35,32 @@
#define DEF_PKT_SHIFT 10 #define DEF_PKT_SHIFT 10
#define DEF_BUF_SHIFT 16 #define DEF_BUF_SHIFT 16
/* clang-format off */ #define GDCICLASS(CNAME) \
#define GDCICLASS(CNAME) \ public: \
public:\ static CNAME *(*_create)(); \
static CNAME *(*_create)();\ \
\ static Ref<CNAME> create_ref() { \
static Ref<CNAME > create_ref() {\ if (!_create) \
\ return Ref<CNAME>(); \
if (!_create)\ return Ref<CNAME>(_create()); \
return Ref<CNAME >();\ } \
return Ref<CNAME >(_create());\ \
}\ static CNAME *create() { \
\ if (!_create) \
static CNAME *create() {\ return nullptr; \
\ return _create(); \
if (!_create)\ } \
return nullptr;\ \
return _create();\ protected:
}\
protected:\
#define GDCINULL(CNAME) \ #define GDCINULL(CNAME) \
CNAME *(*CNAME::_create)() = nullptr; CNAME *(*CNAME::_create)() = nullptr;
#define GDCIIMPL(IMPNAME, CNAME) \ #define GDCIIMPL(IMPNAME, CNAME) \
public:\ public: \
static CNAME *_create() { return memnew(IMPNAME); }\ static CNAME *_create() { return memnew(IMPNAME); } \
static void make_default() { CNAME::_create = IMPNAME::_create; }\ static void make_default() { CNAME::_create = IMPNAME::_create; } \
protected:\ \
/* clang-format on */ protected:
#endif // WEBSOCKET_MACROS_H #endif // WEBSOCKET_MACROS_H