diff --git a/.clang-format b/.clang-format index 277834e3b..6b2f88687 100644 --- a/.clang-format +++ b/.clang-format @@ -1,12 +1,13 @@ --- -# Requires LLVM 15.0 +# Requires LLVM 16.0 # General Language: Cpp Standard: c++17 TabWidth: 4 UseTab: Always -UseCRLF: false +LineEnding: LF +InsertNewlineAtEOF: true # Braces BreakBeforeBraces: Custom @@ -48,6 +49,7 @@ IndentWrappedFunctionNames: false LambdaBodyIndentation: Signature NamespaceIndentation: None PPIndentWidth: -1 +RequiresExpressionIndentation: OuterScope # Spaces BitFieldColonSpacing: Both @@ -94,8 +96,10 @@ AlwaysBreakBeforeMultilineStrings: true AlwaysBreakTemplateDeclarations: Yes BinPackArguments: false BinPackParameters: false +BreakAfterAttributes: Always BreakBeforeBinaryOperators: None BreakBeforeConceptDeclarations: Always +BreakBeforeInlineASMColon: OnlyMultiline BreakBeforeTernaryOperators: true BreakConstructorInitializers: BeforeComma BreakInheritanceList: BeforeComma @@ -153,7 +157,8 @@ AlignConsecutiveDeclarations: None AlignConsecutiveMacros: None AlignEscapedNewlines: Left AlignOperands: DontAlign -AlignTrailingComments: false +AlignTrailingComments: + Kind: Never # Macros AttributeMacros: [] @@ -168,12 +173,18 @@ WhitespaceSensitiveMacros: [] # Miscellaneous FixNamespaceComments: true InsertTrailingCommas: None +IntegerLiteralSeparator: + Binary: 0 + Decimal: 0 + Hex: 0 QualifierAlignment: Left RawStringFormats: [] +RemoveSemicolon: false SortUsingDeclarations: false # BasedOnStyle # BreakAfterJavaFieldAnnotations +# BreakArrays # DisableFormat # IncludeIsMainRegex # IncludeIsMainSourceRegex diff --git a/.clang-tidy b/.clang-tidy index 2909c4286..9211b8d2f 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -1,5 +1,5 @@ --- -# Requires LLVM 15.0 +# Requires LLVM 16.0 # The checks are split it into 4 groups: # @@ -70,6 +70,7 @@ Checks: > bugprone-suspicious-memory-comparison, bugprone-suspicious-memset-usage, bugprone-suspicious-missing-comma, + bugprone-suspicious-realloc-usage, bugprone-suspicious-semicolon, bugprone-suspicious-string-compare, bugprone-swapped-arguments, @@ -85,8 +86,11 @@ Checks: > -clang-diagnostic-pragma-once-outside-header, concurrency-mt-unsafe, -concurrency-thread-canceltype-asynchronous, + cppcoreguidelines-avoid-const-or-ref-data-members, + -cppcoreguidelines-avoid-do-while, cppcoreguidelines-avoid-goto, -cppcoreguidelines-avoid-non-const-global-variables, + -cppcoreguidelines-avoid-reference-coroutine-parameters cppcoreguidelines-init-variables, cppcoreguidelines-interfaces-global-init, -cppcoreguidelines-macro-usage, @@ -127,6 +131,7 @@ Checks: > misc-unused-alias-decls, misc-unused-parameters, misc-unused-using-decls, + misc-use-anonymous-namespace, modernize-concat-nested-namespaces, modernize-deprecated-headers, modernize-loop-convert, @@ -196,6 +201,7 @@ Checks: > bugprone-inaccurate-erase, -bugprone-shared-ptr-array-mismatch, bugprone-sizeof-container, + -bugprone-standalone-empty, bugprone-string-constructor, bugprone-string-integer-assignment, -bugprone-stringview-nullptr, diff --git a/.github/actions/setup-linux/action.yml b/.github/actions/setup-linux/action.yml index 09a2eb1e1..8c8f2ea75 100644 --- a/.github/actions/setup-linux/action.yml +++ b/.github/actions/setup-linux/action.yml @@ -4,9 +4,9 @@ inputs: toolchain: required: true version-gcc: - default: 11 + default: 13 version-llvm: - default: 15 + default: 16 runs: using: composite diff --git a/.github/actions/setup-macos/action.yml b/.github/actions/setup-macos/action.yml index c661853e6..445c8f24e 100644 --- a/.github/actions/setup-macos/action.yml +++ b/.github/actions/setup-macos/action.yml @@ -2,7 +2,7 @@ name: Setup macOS inputs: version: - default: 14.3 + default: 15.2 runs: using: composite diff --git a/docs/building.md b/docs/building.md index a30af2ef6..270faabee 100644 --- a/docs/building.md +++ b/docs/building.md @@ -82,7 +82,7 @@ Prerequisites: - CMake 3.22 or newer - Python 3.8 or newer - GCC 11 or newer -- (Optional) Clang 15.0.0 or newer +- (Optional) Clang 16.0.0 or newer - If you wish to compile with LLVM/Clang instead of GCC ⚠️ These commands will build binaries for 64-bit systems. If you instead wish to build binaries for diff --git a/docs/hacking.md b/docs/hacking.md index f8e83e1da..203cca050 100644 --- a/docs/hacking.md +++ b/docs/hacking.md @@ -199,7 +199,7 @@ Prerequisites: you to use clang-format from within the editor of your choosing, such as [the C++ extension][cpp] for Visual Studio Code, which can save you from the hassle of running the commands shown below. -⚠️ The clang-format configuration that Godot Jolt uses is written for **LLVM 15.0** and won't work +⚠️ The clang-format configuration that Godot Jolt uses is written for **LLVM 16.0** and won't work with earlier versions, possibly not newer ones either. There is a PowerShell script, `scripts/run_clang_format.ps1`, that runs clang-format on all source @@ -227,7 +227,7 @@ Prerequisites: to use clang-tidy from within the editor of your choosing, such as [the C++ extension][cpp] for Visual Studio Code, which can save you from the hassle of running the commands shown below. -⚠️ The clang-tidy configuration that Godot Jolt uses is written for **LLVM 15.0** and won't work +⚠️ The clang-tidy configuration that Godot Jolt uses is written for **LLVM 16.0** and won't work with earlier versions, possibly not newer ones either. ⚠️ Because clang-tidy effectively compiles the code in order to analyze it, it's highly recommended diff --git a/src/joints/jolt_cone_twist_joint_impl_3d.cpp b/src/joints/jolt_cone_twist_joint_impl_3d.cpp index 447de6411..97e942594 100644 --- a/src/joints/jolt_cone_twist_joint_impl_3d.cpp +++ b/src/joints/jolt_cone_twist_joint_impl_3d.cpp @@ -232,7 +232,8 @@ void JoltConeTwistJointImpl3D::rebuild() { const JPH::BodyID body_ids[2] = { body_a != nullptr ? body_a->get_jolt_id() : JPH::BodyID(), - body_b != nullptr ? body_b->get_jolt_id() : JPH::BodyID()}; + body_b != nullptr ? body_b->get_jolt_id() : JPH::BodyID() + }; const JoltWritableBodies3D jolt_bodies = space->write_bodies(body_ids, count_of(body_ids)); diff --git a/src/joints/jolt_generic_6dof_joint_impl_3d.cpp b/src/joints/jolt_generic_6dof_joint_impl_3d.cpp index 3bec3c6f1..847b4f565 100644 --- a/src/joints/jolt_generic_6dof_joint_impl_3d.cpp +++ b/src/joints/jolt_generic_6dof_joint_impl_3d.cpp @@ -446,7 +446,8 @@ void JoltGeneric6DOFJointImpl3D::rebuild() { const JPH::BodyID body_ids[2] = { body_a != nullptr ? body_a->get_jolt_id() : JPH::BodyID(), - body_b != nullptr ? body_b->get_jolt_id() : JPH::BodyID()}; + body_b != nullptr ? body_b->get_jolt_id() : JPH::BodyID() + }; const JoltWritableBodies3D jolt_bodies = space->write_bodies(body_ids, count_of(body_ids)); diff --git a/src/joints/jolt_hinge_joint_impl_3d.cpp b/src/joints/jolt_hinge_joint_impl_3d.cpp index 4b801b6a2..9301024f0 100644 --- a/src/joints/jolt_hinge_joint_impl_3d.cpp +++ b/src/joints/jolt_hinge_joint_impl_3d.cpp @@ -262,7 +262,8 @@ void JoltHingeJointImpl3D::rebuild() { const JPH::BodyID body_ids[2] = { body_a != nullptr ? body_a->get_jolt_id() : JPH::BodyID(), - body_b != nullptr ? body_b->get_jolt_id() : JPH::BodyID()}; + body_b != nullptr ? body_b->get_jolt_id() : JPH::BodyID() + }; const JoltWritableBodies3D jolt_bodies = space->write_bodies(body_ids, count_of(body_ids)); diff --git a/src/joints/jolt_pin_joint_impl_3d.cpp b/src/joints/jolt_pin_joint_impl_3d.cpp index 25c9945aa..26bf4eec4 100644 --- a/src/joints/jolt_pin_joint_impl_3d.cpp +++ b/src/joints/jolt_pin_joint_impl_3d.cpp @@ -117,7 +117,8 @@ void JoltPinJointImpl3D::rebuild() { const JPH::BodyID body_ids[2] = { body_a != nullptr ? body_a->get_jolt_id() : JPH::BodyID(), - body_b != nullptr ? body_b->get_jolt_id() : JPH::BodyID()}; + body_b != nullptr ? body_b->get_jolt_id() : JPH::BodyID() + }; const JoltWritableBodies3D jolt_bodies = space->write_bodies(body_ids, count_of(body_ids)); diff --git a/src/joints/jolt_slider_joint_impl_3d.cpp b/src/joints/jolt_slider_joint_impl_3d.cpp index 542946676..b38c2e09b 100644 --- a/src/joints/jolt_slider_joint_impl_3d.cpp +++ b/src/joints/jolt_slider_joint_impl_3d.cpp @@ -464,7 +464,8 @@ void JoltSliderJointImpl3D::rebuild() { const JPH::BodyID body_ids[2] = { body_a != nullptr ? body_a->get_jolt_id() : JPH::BodyID(), - body_b != nullptr ? body_b->get_jolt_id() : JPH::BodyID()}; + body_b != nullptr ? body_b->get_jolt_id() : JPH::BodyID() + }; const JoltWritableBodies3D jolt_bodies = space->write_bodies(body_ids, count_of(body_ids)); diff --git a/src/misc/type_conversions.hpp b/src/misc/type_conversions.hpp index 74dd3e1d5..b9138bbc8 100644 --- a/src/misc/type_conversions.hpp +++ b/src/misc/type_conversions.hpp @@ -17,7 +17,8 @@ _FORCE_INLINE_ Transform3D to_godot(const JPH::Mat44& p_mat) { Vector3(p_mat(0, 0), p_mat(1, 0), p_mat(2, 0)), Vector3(p_mat(0, 1), p_mat(1, 1), p_mat(2, 1)), Vector3(p_mat(0, 2), p_mat(1, 2), p_mat(2, 2)), - Vector3(p_mat(0, 3), p_mat(1, 3), p_mat(2, 3))}; + Vector3(p_mat(0, 3), p_mat(1, 3), p_mat(2, 3)) + }; } _FORCE_INLINE_ Color to_godot(const JPH::Color& p_color) { @@ -30,7 +31,8 @@ _FORCE_INLINE_ Color to_godot(const JPH::Color& p_color) { r == 0.0f ? 0.0f : 255.0f / r, g == 0.0f ? 0.0f : 255.0f / g, b == 0.0f ? 0.0f : 255.0f / b, - a == 0.0f ? 0.0f : 255.0f / a}; + a == 0.0f ? 0.0f : 255.0f / a + }; } _FORCE_INLINE_ String to_godot(const JPH::String& p_str) { @@ -58,7 +60,8 @@ _FORCE_INLINE_ JPH::Mat44 to_jolt(const Transform3D& p_transform) { JPH::Vec4(b[0][0], b[1][0], b[2][0], 0.0f), JPH::Vec4(b[0][1], b[1][1], b[2][1], 0.0f), JPH::Vec4(b[0][2], b[1][2], b[2][2], 0.0f), - JPH::Vec3(o.x, o.y, o.z)}; + JPH::Vec3(o.x, o.y, o.z) + }; } _FORCE_INLINE_ JPH::Color to_jolt(const Color& p_color) { @@ -86,5 +89,6 @@ _FORCE_INLINE_ JPH::RMat44 to_jolt_r(const Transform3D& p_transform) { JPH::Vec4(b[0][0], b[1][0], b[2][0], 0.0f), JPH::Vec4(b[0][1], b[1][1], b[2][1], 0.0f), JPH::Vec4(b[0][2], b[1][2], b[2][2], 0.0f), - JPH::RVec3(o.x, o.y, o.z)}; + JPH::RVec3(o.x, o.y, o.z) + }; } diff --git a/src/shapes/jolt_custom_ray_shape.cpp b/src/shapes/jolt_custom_ray_shape.cpp index 975d8f21d..578e086ff 100644 --- a/src/shapes/jolt_custom_ray_shape.cpp +++ b/src/shapes/jolt_custom_ray_shape.cpp @@ -174,7 +174,8 @@ void JoltCustomRayShape::register_type() { JPH::EShapeSubType::Cylinder, JPH::EShapeSubType::ConvexHull, JPH::EShapeSubType::Mesh, - JPH::EShapeSubType::HeightField}; + JPH::EShapeSubType::HeightField + }; for (const JPH::EShapeSubType concrete_sub_type : concrete_sub_types) { JPH::CollisionDispatch::sRegisterCollideShape( diff --git a/src/spaces/jolt_body_accessor_3d.cpp b/src/spaces/jolt_body_accessor_3d.cpp index a22a60818..387516682 100644 --- a/src/spaces/jolt_body_accessor_3d.cpp +++ b/src/spaces/jolt_body_accessor_3d.cpp @@ -79,7 +79,8 @@ const JPH::BodyID* JoltBodyAccessor3D::get_ids() const { }, [](const BodyIDSpan& p_span) { return p_span.ptr; - }}, + } + }, ids ); } @@ -97,7 +98,8 @@ int32_t JoltBodyAccessor3D::get_count() const { }, [](const BodyIDSpan& p_span) { return p_span.count; - }}, + } + }, ids ); }