Core: Integrate warning suppression macro helpers

This commit is contained in:
Thaddeus Crews 2025-03-31 10:56:33 -05:00
parent 1f56d96cf2
commit 207a2b6472
No known key found for this signature in database
GPG key ID: 8C6E5FEB5FC03CCC
25 changed files with 119 additions and 180 deletions

View file

@ -167,11 +167,7 @@ public:
return p_segment_a + n * d; // Inside.
}
// Disable False Positives in MSVC compiler; we correctly check for 0 here to prevent a division by 0.
// See: https://github.com/godotengine/godot/pull/44274
#ifdef _MSC_VER
#pragma warning(disable : 4723)
#endif
GODOT_MSVC_WARNING_PUSH_AND_IGNORE(4723) // Potential divide by 0. False positive (see: GH-44274).
static bool line_intersects_line(const Vector2 &p_from_a, const Vector2 &p_dir_a, const Vector2 &p_from_b, const Vector2 &p_dir_b, Vector2 &r_result) {
// See http://paulbourke.net/geometry/pointlineplane/
@ -187,10 +183,7 @@ public:
return true;
}
// Re-enable division by 0 warning
#ifdef _MSC_VER
#pragma warning(default : 4723)
#endif
GODOT_MSVC_WARNING_POP
static bool segment_intersects_segment(const Vector2 &p_from_a, const Vector2 &p_to_a, const Vector2 &p_from_b, const Vector2 &p_to_b, Vector2 *r_result) {
Vector2 B = p_to_a - p_from_a;