summaryrefslogtreecommitdiff
path: root/src/widget.cpp
diff options
context:
space:
mode:
authorPatric Stout <truebrain@openttd.org>2021-06-03 16:55:08 +0200
committerPatric Stout <github@truebrain.nl>2021-06-03 17:30:00 +0200
commit28e90769f74e55ea7c8f75146d5b33e0aa777da8 (patch)
treeeeff0974346ef9da7cbc2b33b040d016c341ff0b /src/widget.cpp
parentf8dd5dd00a7aa3cc5769b4bce0a1b7a63073c8ce (diff)
downloadopenttd-28e90769f74e55ea7c8f75146d5b33e0aa777da8.tar.xz
Codechange: use "[[maybe_unused]]" instead of a wide variety of other ways we had
While at it, replace OTTD_ASSERT with WITH_ASSERT, as this is always set if assert() is valid. No matter if NDEBUG is set or not.
Diffstat (limited to 'src/widget.cpp')
-rw-r--r--src/widget.cpp8
1 files changed, 2 insertions, 6 deletions
diff --git a/src/widget.cpp b/src/widget.cpp
index 638aa05fe..abd413ca2 100644
--- a/src/widget.cpp
+++ b/src/widget.cpp
@@ -1272,9 +1272,7 @@ void NWidgetHorizontal::SetupSmallestSize(Window *w, bool init_array)
this->smallest_y = std::max(this->smallest_y, child_wid->smallest_y + child_wid->padding_top + child_wid->padding_bottom);
}
/* 1b. Make the container higher if needed to accommodate all children nicely. */
-#ifdef WITH_ASSERT
- uint max_smallest = this->smallest_y + 3 * max_vert_fill; // Upper limit to computing smallest height.
-#endif
+ [[maybe_unused]] uint max_smallest = this->smallest_y + 3 * max_vert_fill; // Upper limit to computing smallest height.
uint cur_height = this->smallest_y;
for (;;) {
for (NWidgetBase *child_wid = this->head; child_wid != nullptr; child_wid = child_wid->next) {
@@ -1439,9 +1437,7 @@ void NWidgetVertical::SetupSmallestSize(Window *w, bool init_array)
this->smallest_x = std::max(this->smallest_x, child_wid->smallest_x + child_wid->padding_left + child_wid->padding_right);
}
/* 1b. Make the container wider if needed to accommodate all children nicely. */
-#ifdef WITH_ASSERT
- uint max_smallest = this->smallest_x + 3 * max_hor_fill; // Upper limit to computing smallest height.
-#endif
+ [[maybe_unused]] uint max_smallest = this->smallest_x + 3 * max_hor_fill; // Upper limit to computing smallest height.
uint cur_width = this->smallest_x;
for (;;) {
for (NWidgetBase *child_wid = this->head; child_wid != nullptr; child_wid = child_wid->next) {