From 89fd27608fa9d10194cac76d19c7df4b92cbff30 Mon Sep 17 00:00:00 2001 From: Thaddeus Crews Date: Thu, 20 Feb 2025 09:23:08 -0600 Subject: [PATCH] Style: Replace `_NO_DISCARD_` macro with `[[nodiscard]]` --- include/godot_cpp/core/defs.hpp | 4 ---- include/godot_cpp/variant/aabb.hpp | 2 +- include/godot_cpp/variant/basis.hpp | 2 +- include/godot_cpp/variant/color.hpp | 2 +- include/godot_cpp/variant/plane.hpp | 2 +- include/godot_cpp/variant/projection.hpp | 2 +- include/godot_cpp/variant/quaternion.hpp | 2 +- include/godot_cpp/variant/rect2.hpp | 2 +- include/godot_cpp/variant/rect2i.hpp | 2 +- include/godot_cpp/variant/transform2d.hpp | 2 +- include/godot_cpp/variant/transform3d.hpp | 2 +- include/godot_cpp/variant/vector2.hpp | 2 +- include/godot_cpp/variant/vector2i.hpp | 2 +- include/godot_cpp/variant/vector3.hpp | 2 +- include/godot_cpp/variant/vector3i.hpp | 2 +- include/godot_cpp/variant/vector4.hpp | 2 +- include/godot_cpp/variant/vector4i.hpp | 2 +- 17 files changed, 16 insertions(+), 20 deletions(-) diff --git a/include/godot_cpp/core/defs.hpp b/include/godot_cpp/core/defs.hpp index 5b985ffc..07ce14d3 100644 --- a/include/godot_cpp/core/defs.hpp +++ b/include/godot_cpp/core/defs.hpp @@ -74,10 +74,6 @@ namespace godot { #endif #endif -#ifndef _NO_DISCARD_ -#define _NO_DISCARD_ [[nodiscard]] -#endif - // Windows badly defines a lot of stuff we'll never use. Undefine it. #ifdef _WIN32 #undef min // override standard definition diff --git a/include/godot_cpp/variant/aabb.hpp b/include/godot_cpp/variant/aabb.hpp index b827112a..46eaca96 100644 --- a/include/godot_cpp/variant/aabb.hpp +++ b/include/godot_cpp/variant/aabb.hpp @@ -43,7 +43,7 @@ namespace godot { class Variant; -struct _NO_DISCARD_ AABB { +struct [[nodiscard]] AABB { Vector3 position; Vector3 size; diff --git a/include/godot_cpp/variant/basis.hpp b/include/godot_cpp/variant/basis.hpp index f3ebe15f..4b7a6b44 100644 --- a/include/godot_cpp/variant/basis.hpp +++ b/include/godot_cpp/variant/basis.hpp @@ -37,7 +37,7 @@ namespace godot { -struct _NO_DISCARD_ Basis { +struct [[nodiscard]] Basis { Vector3 rows[3] = { Vector3(1, 0, 0), Vector3(0, 1, 0), diff --git a/include/godot_cpp/variant/color.hpp b/include/godot_cpp/variant/color.hpp index 0e837bc9..86f1a396 100644 --- a/include/godot_cpp/variant/color.hpp +++ b/include/godot_cpp/variant/color.hpp @@ -37,7 +37,7 @@ namespace godot { class String; -struct _NO_DISCARD_ Color { +struct [[nodiscard]] Color { union { struct { float r; diff --git a/include/godot_cpp/variant/plane.hpp b/include/godot_cpp/variant/plane.hpp index 829f801f..d2184ca4 100644 --- a/include/godot_cpp/variant/plane.hpp +++ b/include/godot_cpp/variant/plane.hpp @@ -38,7 +38,7 @@ namespace godot { class Variant; -struct _NO_DISCARD_ Plane { +struct [[nodiscard]] Plane { Vector3 normal; real_t d = 0; diff --git a/include/godot_cpp/variant/projection.hpp b/include/godot_cpp/variant/projection.hpp index 1de6c024..cc715778 100644 --- a/include/godot_cpp/variant/projection.hpp +++ b/include/godot_cpp/variant/projection.hpp @@ -44,7 +44,7 @@ struct Rect2; struct Transform3D; struct Vector2; -struct _NO_DISCARD_ Projection { +struct [[nodiscard]] Projection { enum Planes { PLANE_NEAR, PLANE_FAR, diff --git a/include/godot_cpp/variant/quaternion.hpp b/include/godot_cpp/variant/quaternion.hpp index 8d0afd78..5cf23a35 100644 --- a/include/godot_cpp/variant/quaternion.hpp +++ b/include/godot_cpp/variant/quaternion.hpp @@ -37,7 +37,7 @@ namespace godot { -struct _NO_DISCARD_ Quaternion { +struct [[nodiscard]] Quaternion { union { struct { real_t x; diff --git a/include/godot_cpp/variant/rect2.hpp b/include/godot_cpp/variant/rect2.hpp index 31c81aa2..14cbeb51 100644 --- a/include/godot_cpp/variant/rect2.hpp +++ b/include/godot_cpp/variant/rect2.hpp @@ -40,7 +40,7 @@ class String; struct Rect2i; struct Transform2D; -struct _NO_DISCARD_ Rect2 { +struct [[nodiscard]] Rect2 { Point2 position; Size2 size; diff --git a/include/godot_cpp/variant/rect2i.hpp b/include/godot_cpp/variant/rect2i.hpp index 57b09059..2c42aa7f 100644 --- a/include/godot_cpp/variant/rect2i.hpp +++ b/include/godot_cpp/variant/rect2i.hpp @@ -39,7 +39,7 @@ namespace godot { class String; struct Rect2; -struct _NO_DISCARD_ Rect2i { +struct [[nodiscard]] Rect2i { Point2i position; Size2i size; diff --git a/include/godot_cpp/variant/transform2d.hpp b/include/godot_cpp/variant/transform2d.hpp index d73323f3..f83f0399 100644 --- a/include/godot_cpp/variant/transform2d.hpp +++ b/include/godot_cpp/variant/transform2d.hpp @@ -39,7 +39,7 @@ namespace godot { class String; -struct _NO_DISCARD_ Transform2D { +struct [[nodiscard]] Transform2D { // Warning #1: basis of Transform2D is stored differently from Basis. In terms of columns array, the basis matrix looks like "on paper": // M = (columns[0][0] columns[1][0]) // (columns[0][1] columns[1][1]) diff --git a/include/godot_cpp/variant/transform3d.hpp b/include/godot_cpp/variant/transform3d.hpp index 6fa5999e..2ad84ff3 100644 --- a/include/godot_cpp/variant/transform3d.hpp +++ b/include/godot_cpp/variant/transform3d.hpp @@ -39,7 +39,7 @@ namespace godot { -struct _NO_DISCARD_ Transform3D { +struct [[nodiscard]] Transform3D { Basis basis; Vector3 origin; diff --git a/include/godot_cpp/variant/vector2.hpp b/include/godot_cpp/variant/vector2.hpp index 8f08985f..8252f348 100644 --- a/include/godot_cpp/variant/vector2.hpp +++ b/include/godot_cpp/variant/vector2.hpp @@ -39,7 +39,7 @@ namespace godot { class String; struct Vector2i; -struct _NO_DISCARD_ Vector2 { +struct [[nodiscard]] Vector2 { static const int AXIS_COUNT = 2; enum Axis { diff --git a/include/godot_cpp/variant/vector2i.hpp b/include/godot_cpp/variant/vector2i.hpp index 0d787c3f..bee40d5c 100644 --- a/include/godot_cpp/variant/vector2i.hpp +++ b/include/godot_cpp/variant/vector2i.hpp @@ -39,7 +39,7 @@ namespace godot { class String; struct Vector2; -struct _NO_DISCARD_ Vector2i { +struct [[nodiscard]] Vector2i { static const int AXIS_COUNT = 2; enum Axis { diff --git a/include/godot_cpp/variant/vector3.hpp b/include/godot_cpp/variant/vector3.hpp index f256c389..69d77265 100644 --- a/include/godot_cpp/variant/vector3.hpp +++ b/include/godot_cpp/variant/vector3.hpp @@ -41,7 +41,7 @@ struct Basis; struct Vector2; struct Vector3i; -struct _NO_DISCARD_ Vector3 { +struct [[nodiscard]] Vector3 { static const int AXIS_COUNT = 3; enum Axis { diff --git a/include/godot_cpp/variant/vector3i.hpp b/include/godot_cpp/variant/vector3i.hpp index b2cdbbdf..d489b415 100644 --- a/include/godot_cpp/variant/vector3i.hpp +++ b/include/godot_cpp/variant/vector3i.hpp @@ -39,7 +39,7 @@ namespace godot { class String; struct Vector3; -struct _NO_DISCARD_ Vector3i { +struct [[nodiscard]] Vector3i { static const int AXIS_COUNT = 3; enum Axis { diff --git a/include/godot_cpp/variant/vector4.hpp b/include/godot_cpp/variant/vector4.hpp index e0e197f8..ff95fa7a 100644 --- a/include/godot_cpp/variant/vector4.hpp +++ b/include/godot_cpp/variant/vector4.hpp @@ -38,7 +38,7 @@ namespace godot { class String; -struct _NO_DISCARD_ Vector4 { +struct [[nodiscard]] Vector4 { static const int AXIS_COUNT = 4; enum Axis { diff --git a/include/godot_cpp/variant/vector4i.hpp b/include/godot_cpp/variant/vector4i.hpp index 8e9510fd..4325fe99 100644 --- a/include/godot_cpp/variant/vector4i.hpp +++ b/include/godot_cpp/variant/vector4i.hpp @@ -39,7 +39,7 @@ namespace godot { class String; struct Vector4; -struct _NO_DISCARD_ Vector4i { +struct [[nodiscard]] Vector4i { static const int AXIS_COUNT = 4; enum Axis {