File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ class NODISCARD PaletteManager final
2424private:
2525 QPalette m_focused;
2626 QPalette m_unfocused;
27- MAYBE_UNUSED bool m_initialized = false ;
27+ bool m_initialized = false ;
2828
2929public:
3030 void init (QWidget &widget, const std::optional<QColor> &activeBg, const QColor &inactiveBg);
Original file line number Diff line number Diff line change @@ -589,14 +589,14 @@ struct NODISCARD AnsiItuColorCodes final
589589 NODISCARD int operator [](const size_t pos) const { return at (pos); }
590590
591591public:
592- class NODISCARD ConstIterator final
592+ class ALLOW_DISCARD ConstIterator final
593593 {
594594 private:
595595 const AnsiItuColorCodes *m_self = nullptr ;
596596 uint8_t m_pos = 0 ;
597597
598598 public:
599- explicit ConstIterator (const AnsiItuColorCodes *const self, const uint8_t pos)
599+ NODISCARD explicit ConstIterator (const AnsiItuColorCodes *const self, const uint8_t pos)
600600 : m_self{self}
601601 , m_pos{pos}
602602 {
@@ -607,7 +607,8 @@ struct NODISCARD AnsiItuColorCodes final
607607 NODISCARD const AnsiItuColorCodes &getSelf () const { return deref (m_self); }
608608
609609 public:
610- NODISCARD ConstIterator operator ++()
610+ void operator ++(int ) = delete ;
611+ ALLOW_DISCARD ConstIterator operator ++()
611612 {
612613 if (m_pos >= getSelf ().size ()) {
613614 throw std::runtime_error (" invalid increment" );
Original file line number Diff line number Diff line change 77
88#include < type_traits>
99
10+ #ifdef __clang__
11+ #pragma clang diagnostic push
12+ #pragma clang diagnostic ignored "-Wpadded"
13+ #endif
1014template <typename T>
1115class NODISCARD ConversionResult final
1216{
1317private:
1418 T m_value{};
1519 CastErrorEnum m_result = CastErrorEnum::Success;
1620
17- // This is just to avoid a padding warning
18- static inline constexpr auto PAD_BYTES = (alignof (T) > sizeof (CastErrorEnum))
19- ? (alignof (T) - sizeof (CastErrorEnum))
20- : alignof (T);
21- MAYBE_UNUSED char m_unused_pad[PAD_BYTES]{};
22-
2321public:
2422 constexpr explicit ConversionResult (const T n) noexcept
2523 : m_value{n}
@@ -60,3 +58,6 @@ class NODISCARD ConversionResult final
6058 return is_valid () && m_value == intValue;
6159 }
6260};
61+ #ifdef __clang__
62+ #pragma clang diagnostic pop
63+ #endif
Original file line number Diff line number Diff line change @@ -273,14 +273,14 @@ class NODISCARD Flags
273273 }
274274
275275public:
276- struct NODISCARD Iterator final
276+ struct ALLOW_DISCARD Iterator final
277277 {
278278 private:
279279 Flags::underlying_type m_bits = 0 ;
280280 size_t m_pos = 0 ;
281281
282282 public:
283- Iterator (const Flags flags, const size_t pos)
283+ NODISCARD Iterator (const Flags flags, const size_t pos)
284284 : m_bits{flags.m_flags }
285285 , m_pos{pos}
286286 {}
Original file line number Diff line number Diff line change @@ -16,14 +16,14 @@ enum class NODISCARD CastErrorEnum : uint8_t {
1616 RoundTripFailure,
1717};
1818
19+ #ifdef __clang__
20+ #pragma clang diagnostic push
21+ #pragma clang diagnostic ignored "-Wpadded"
22+ #endif
1923struct NODISCARD CastErrorException : public std::runtime_error
2024{
2125 CastErrorEnum err = CastErrorEnum::Success;
2226
23- // This is just to avoid a padding warning.
24- static_assert (alignof (std::runtime_error) > sizeof (CastErrorEnum));
25- MAYBE_UNUSED char unused_pad[alignof (std::runtime_error) - sizeof (CastErrorEnum)]{};
26-
2727 explicit CastErrorException (const CastErrorEnum e)
2828 : std::runtime_error{" CastErrorException" }
2929 , err{e}
@@ -32,3 +32,6 @@ struct NODISCARD CastErrorException : public std::runtime_error
3232 }
3333 ~CastErrorException () override ;
3434};
35+ #ifdef __clang__
36+ #pragma clang diagnostic pop
37+ #endif
Original file line number Diff line number Diff line change @@ -61,7 +61,7 @@ struct NODISCARD ChangePrinter::StructHelper final
6161 m_cp.print (std::forward<V>(value));
6262 }
6363
64- explicit operator bool () const { return true ; }
64+ NODISCARD explicit operator bool () const { return true ; }
6565};
6666
6767#define BEGIN_FLAGS_HELPER (name ) if (FlagsHelper helper{*this , name})
@@ -96,7 +96,7 @@ struct NODISCARD ChangePrinter::FlagsHelper final
9696 m_cp.print (std::forward<T>(thing));
9797 }
9898
99- explicit operator bool () const { return true ; }
99+ NODISCARD explicit operator bool () const { return true ; }
100100};
101101
102102ChangePrinter::ChangePrinter (Remap remap, AnsiOstream &os)
Original file line number Diff line number Diff line change 1919#include < ostream>
2020#include < vector>
2121
22+ namespace mm {
23+ struct AbstractDebugOStream ;
24+ }
2225class AnsiOstream ;
2326class Change ;
2427class ChangeList ;
@@ -141,8 +144,9 @@ class NODISCARD Map final
141144
142145struct NODISCARD MapApplyResult final
143146{
147+ static inline constexpr auto ALL_ROOM_UPDATE_FLAGS = ~RoomUpdateFlags{};
144148 Map map;
145- RoomUpdateFlags roomUpdateFlags = ~RoomUpdateFlags{} ;
149+ RoomUpdateFlags roomUpdateFlags = ALL_ROOM_UPDATE_FLAGS ;
146150};
147151
148152struct NODISCARD MapPair final
Original file line number Diff line number Diff line change @@ -96,11 +96,8 @@ struct NODISCARD TinySet
9696 public:
9797 NODISCARD Type get_single_value () const noexcept
9898 {
99- // copy is unnecessary but should be optimized away;
100- // it's only here as a defense mechanism.
10199 assert (holds_single_value ());
102- const Variant copy = *this ;
103- const auto ui = *std::launder (reinterpret_cast <const uintptr_t *>(copy.m_buf )) >> 1u ;
100+ const auto ui = get_uintptrt () >> 1u ;
104101 const auto size = static_cast <size_t >(ui);
105102 return IdHelper_::fromBits (size);
106103 }
@@ -349,9 +346,7 @@ struct NODISCARD TinySet
349346 }
350347 NODISCARD ConstIterator end () const
351348 {
352- if (isEmpty ()) {
353- return ConstIterator{};
354- } else if (hasOne ()) {
349+ if (isEmpty () || hasOne ()) {
355350 return ConstIterator{};
356351 } else {
357352 return ConstIterator{getBig ().end ()};
Original file line number Diff line number Diff line change @@ -1394,9 +1394,9 @@ RoomId World::convertToInternal(const ExternalRoomId ext) const
13941394 return m_remapping.convertToInternal (ext);
13951395}
13961396
1397- ExternalRoomId World::convertToExternal (const RoomId ext ) const
1397+ ExternalRoomId World::convertToExternal (const RoomId id ) const
13981398{
1399- return m_remapping.convertToExternal (ext );
1399+ return m_remapping.convertToExternal (id );
14001400}
14011401
14021402void World::apply (ProgressCounter &pc, const world_change_types::CompactRoomIds &change)
Original file line number Diff line number Diff line change @@ -147,7 +147,7 @@ class NODISCARD World final
147147 NODISCARD ExternalRawRoom convertToExternal (const RawRoom &room) const ;
148148
149149 NODISCARD RoomId convertToInternal (ExternalRoomId ext) const ;
150- NODISCARD ExternalRoomId convertToExternal (RoomId ext ) const ;
150+ NODISCARD ExternalRoomId convertToExternal (RoomId id ) const ;
151151
152152public:
153153 void applyOne (ProgressCounter &pc, const Change &change);
You can’t perform that action at this time.
0 commit comments