summaryrefslogtreecommitdiffstats
path: root/core/math/rect2.h
diff options
context:
space:
mode:
authorlawnjelly <lawnjelly@gmail.com>2022-01-19 19:46:17 +0000
committerlawnjelly <lawnjelly@gmail.com>2022-01-20 13:07:49 +0000
commitb411a731fef9af1c0a73e4d5b718e5a6b12af1c2 (patch)
treeaae207a63b24f823efef9901e92b5222e2f3618b /core/math/rect2.h
parent249c60e9d1aacd07d87786db8059f30aed02bb68 (diff)
downloadredot-engine-b411a731fef9af1c0a73e4d5b718e5a6b12af1c2.tar.gz
Add nodiscard to core math classes to catch c++ errors.
A common source of errors is to call functions (such as round()) expecting them to work in place, but them actually being designed only to return the processed value. Not using the return value in this case in indicative of a bug, and can be flagged as a warning by using the [[nodiscard]] attribute.
Diffstat (limited to 'core/math/rect2.h')
-rw-r--r--core/math/rect2.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/core/math/rect2.h b/core/math/rect2.h
index f34550bef1..4ea24e8f88 100644
--- a/core/math/rect2.h
+++ b/core/math/rect2.h
@@ -35,7 +35,7 @@
struct Transform2D;
-struct Rect2 {
+struct _NO_DISCARD_ Rect2 {
Point2 position;
Size2 size;
@@ -363,7 +363,7 @@ struct Rect2 {
}
};
-struct Rect2i {
+struct _NO_DISCARD_ Rect2i {
Point2i position;
Size2i size;