Meta: Force semi-colon after MAKE_AK_NONXXXABLE()

Before, we had about these occurrence counts:
COPY: 13 without, 33 with
MOVE: 12 without, 28 with

Clearly, 'with' was the preferred way. However, this introduced double-semicolons
all over the place, and caused some warnings to trigger.

This patch *forces* the usage of a semi-colon when calling the macro,
by removing the semi-colon within the macro. (And thus also gets rid
of the double-semicolon.)
This commit is contained in:
Ben Wiederhake 2020-08-26 21:52:24 +02:00 committed by Andreas Kling
parent 6454969d6b
commit 9f7ec33180
Notes: sideshowbarker 2024-07-19 03:06:44 +09:00
15 changed files with 44 additions and 30 deletions

View File

@ -37,7 +37,8 @@
namespace AK { namespace AK {
class Bitmap { class Bitmap {
AK_MAKE_NONCOPYABLE(Bitmap) AK_MAKE_NONCOPYABLE(Bitmap);
public: public:
// NOTE: A wrapping Bitmap won't try to free the wrapped data. // NOTE: A wrapping Bitmap won't try to free the wrapped data.
static Bitmap wrap(u8* data, size_t size) static Bitmap wrap(u8* data, size_t size)

View File

@ -33,8 +33,9 @@ namespace AK {
template<typename T> template<typename T>
class NeverDestroyed { class NeverDestroyed {
AK_MAKE_NONCOPYABLE(NeverDestroyed) AK_MAKE_NONCOPYABLE(NeverDestroyed);
AK_MAKE_NONMOVABLE(NeverDestroyed) AK_MAKE_NONMOVABLE(NeverDestroyed);
public: public:
template<typename... Args> template<typename... Args>
NeverDestroyed(Args... args) NeverDestroyed(Args... args)

View File

@ -29,9 +29,9 @@
#define AK_MAKE_NONCOPYABLE(c) \ #define AK_MAKE_NONCOPYABLE(c) \
private: \ private: \
c(const c&) = delete; \ c(const c&) = delete; \
c& operator=(const c&) = delete; c& operator=(const c&) = delete
#define AK_MAKE_NONMOVABLE(c) \ #define AK_MAKE_NONMOVABLE(c) \
private: \ private: \
c(c&&) = delete; \ c(c&&) = delete; \
c& operator=(c&&) = delete; c& operator=(c&&) = delete

View File

@ -60,8 +60,9 @@ constexpr auto call_one_ref_left_if_present(...) -> FalseType
} }
class RefCountedBase { class RefCountedBase {
AK_MAKE_NONCOPYABLE(RefCountedBase) AK_MAKE_NONCOPYABLE(RefCountedBase);
AK_MAKE_NONMOVABLE(RefCountedBase) AK_MAKE_NONMOVABLE(RefCountedBase);
public: public:
typedef unsigned int RefCountType; typedef unsigned int RefCountType;

View File

@ -36,8 +36,9 @@
typedef AK::SinglyLinkedListIterator<SinglyLinkedList<RollNote>, RollNote> RollIter; typedef AK::SinglyLinkedListIterator<SinglyLinkedList<RollNote>, RollNote> RollIter;
class Track { class Track {
AK_MAKE_NONCOPYABLE(Track) AK_MAKE_NONCOPYABLE(Track);
AK_MAKE_NONMOVABLE(Track) AK_MAKE_NONMOVABLE(Track);
public: public:
explicit Track(const u32& time); explicit Track(const u32& time);
~Track(); ~Track();

View File

@ -34,8 +34,9 @@
#include <AK/Vector.h> #include <AK/Vector.h>
class TrackManager { class TrackManager {
AK_MAKE_NONCOPYABLE(TrackManager) AK_MAKE_NONCOPYABLE(TrackManager);
AK_MAKE_NONMOVABLE(TrackManager) AK_MAKE_NONMOVABLE(TrackManager);
public: public:
TrackManager(); TrackManager();
~TrackManager(); ~TrackManager();

View File

@ -42,8 +42,9 @@ enum class ProjectType {
}; };
class Project { class Project {
AK_MAKE_NONCOPYABLE(Project) AK_MAKE_NONCOPYABLE(Project);
AK_MAKE_NONMOVABLE(Project) AK_MAKE_NONMOVABLE(Project);
public: public:
~Project(); ~Project();

View File

@ -34,8 +34,9 @@ namespace HackStudio {
class FormEditorWidget; class FormEditorWidget;
class Tool { class Tool {
AK_MAKE_NONCOPYABLE(Tool) AK_MAKE_NONCOPYABLE(Tool);
AK_MAKE_NONMOVABLE(Tool) AK_MAKE_NONMOVABLE(Tool);
public: public:
virtual ~Tool() { } virtual ~Tool() { }

View File

@ -35,7 +35,8 @@ class SquareButton;
class SquareLabel; class SquareLabel;
class Square { class Square {
AK_MAKE_NONCOPYABLE(Square) AK_MAKE_NONCOPYABLE(Square);
public: public:
Square(); Square();
~Square(); ~Square();
@ -59,6 +60,7 @@ class Field final : public GUI::Frame {
C_OBJECT(Field) C_OBJECT(Field)
friend class Square; friend class Square;
friend class SquareLabel; friend class SquareLabel;
public: public:
Field(GUI::Label& flag_label, GUI::Label& time_label, GUI::Button& face_button, Function<void(Gfx::IntSize)> on_size_changed); Field(GUI::Label& flag_label, GUI::Label& time_label, GUI::Button& face_button, Function<void(Gfx::IntSize)> on_size_changed);
virtual ~Field() override; virtual ~Field() override;

View File

@ -85,7 +85,7 @@ enum DigitConsumeDecision {
template<typename T, T min_value, T max_value> template<typename T, T min_value, T max_value>
class NumParser { class NumParser {
AK_MAKE_NONMOVABLE(NumParser) AK_MAKE_NONMOVABLE(NumParser);
public: public:
NumParser(Sign sign, int base) NumParser(Sign sign, int base)

View File

@ -62,8 +62,9 @@ class Object
, public Weakable<Object> { , public Weakable<Object> {
// NOTE: No C_OBJECT macro for Core::Object itself. // NOTE: No C_OBJECT macro for Core::Object itself.
AK_MAKE_NONCOPYABLE(Object) AK_MAKE_NONCOPYABLE(Object);
AK_MAKE_NONMOVABLE(Object) AK_MAKE_NONMOVABLE(Object);
public: public:
IntrusiveListNode m_all_objects_list_node; IntrusiveListNode m_all_objects_list_node;

View File

@ -68,8 +68,9 @@ enum class VerticalDirection {
}; };
class WidgetClassRegistration { class WidgetClassRegistration {
AK_MAKE_NONCOPYABLE(WidgetClassRegistration) AK_MAKE_NONCOPYABLE(WidgetClassRegistration);
AK_MAKE_NONMOVABLE(WidgetClassRegistration) AK_MAKE_NONMOVABLE(WidgetClassRegistration);
public: public:
WidgetClassRegistration(const String& class_name, Function<NonnullRefPtr<Widget>()> factory); WidgetClassRegistration(const String& class_name, Function<NonnullRefPtr<Widget>()> factory);
~WidgetClassRegistration(); ~WidgetClassRegistration();

View File

@ -209,13 +209,15 @@ public:
[[nodiscard]] bool set_nonvolatile(); [[nodiscard]] bool set_nonvolatile();
private: private:
enum class Purgeable { No, enum class Purgeable {
Yes }; No,
Yes
};
Bitmap(BitmapFormat, const IntSize&, Purgeable); Bitmap(BitmapFormat, const IntSize&, Purgeable);
Bitmap(BitmapFormat, const IntSize&, size_t pitch, RGBA32*); Bitmap(BitmapFormat, const IntSize&, size_t pitch, RGBA32*);
Bitmap(BitmapFormat, NonnullRefPtr<SharedBuffer>&&, const IntSize&, const Vector<RGBA32>& palette); Bitmap(BitmapFormat, NonnullRefPtr<SharedBuffer>&&, const IntSize&, const Vector<RGBA32>& palette);
void allocate_palette_from_format(BitmapFormat, const Vector<RGBA32>& source_palette ); void allocate_palette_from_format(BitmapFormat, const Vector<RGBA32>& source_palette);
IntSize m_size; IntSize m_size;
RGBA32* m_data { nullptr }; RGBA32* m_data { nullptr };

View File

@ -36,8 +36,9 @@
namespace Gfx { namespace Gfx {
class PaletteImpl : public RefCounted<PaletteImpl> { class PaletteImpl : public RefCounted<PaletteImpl> {
AK_MAKE_NONCOPYABLE(PaletteImpl) AK_MAKE_NONCOPYABLE(PaletteImpl);
AK_MAKE_NONMOVABLE(PaletteImpl) AK_MAKE_NONMOVABLE(PaletteImpl);
public: public:
~PaletteImpl(); ~PaletteImpl();
static NonnullRefPtr<PaletteImpl> create_with_shared_buffer(SharedBuffer&); static NonnullRefPtr<PaletteImpl> create_with_shared_buffer(SharedBuffer&);

View File

@ -32,8 +32,8 @@
namespace JS { namespace JS {
class Symbol final : public Cell { class Symbol final : public Cell {
AK_MAKE_NONCOPYABLE(Symbol) AK_MAKE_NONCOPYABLE(Symbol);
AK_MAKE_NONMOVABLE(Symbol) AK_MAKE_NONMOVABLE(Symbol);
public: public:
Symbol(String, bool); Symbol(String, bool);