Clean up virtual, override, default, and void params. NFC.

Found by clang-tidy.
pull/487/head
Ryan Pavlik 2019-09-10 12:47:34 -05:00 committed by whitequark
parent ae417fc14c
commit a0e992374d
7 changed files with 31 additions and 30 deletions

View File

@ -45,7 +45,7 @@ public:
Expr *b; Expr *b;
}; };
Expr() { } Expr() = default;
Expr(double val) : op(Op::CONSTANT) { v = val; } Expr(double val) : op(Op::CONSTANT) { v = val; }
static inline Expr *AllocExpr() static inline Expr *AllocExpr()

View File

@ -49,7 +49,7 @@ bool Group::IsVisible() {
return true; return true;
} }
size_t Group::GetNumConstraints(void) { size_t Group::GetNumConstraints() {
return SK.constraint.CountIf([&](Constraint const & c) { return c.group == h; }); return SK.constraint.CountIf([&](Constraint const & c) { return c.group == h; });
} }

View File

@ -107,7 +107,7 @@ void FatalError(std::string message);
// A native settings store. // A native settings store.
class Settings { class Settings {
public: public:
virtual ~Settings() {} virtual ~Settings() = default;
virtual void FreezeInt(const std::string &key, uint32_t value) = 0; virtual void FreezeInt(const std::string &key, uint32_t value) = 0;
virtual uint32_t ThawInt(const std::string &key, uint32_t defaultValue = 0) = 0; virtual uint32_t ThawInt(const std::string &key, uint32_t defaultValue = 0) = 0;
@ -135,7 +135,7 @@ class Timer {
public: public:
std::function<void()> onTimeout; std::function<void()> onTimeout;
virtual ~Timer() {} virtual ~Timer() = default;
virtual void RunAfter(unsigned milliseconds) = 0; virtual void RunAfter(unsigned milliseconds) = 0;
virtual void RunAfterNextFrame() { RunAfter(1); } virtual void RunAfterNextFrame() { RunAfter(1); }
@ -157,7 +157,7 @@ public:
std::function<void()> onTrigger; std::function<void()> onTrigger;
virtual ~MenuItem() {} virtual ~MenuItem() = default;
virtual void SetAccelerator(KeyboardEvent accel) = 0; virtual void SetAccelerator(KeyboardEvent accel) = 0;
virtual void SetIndicator(Indicator type) = 0; virtual void SetIndicator(Indicator type) = 0;
@ -170,7 +170,7 @@ typedef std::shared_ptr<MenuItem> MenuItemRef;
// A native menu. // A native menu.
class Menu { class Menu {
public: public:
virtual ~Menu() {} virtual ~Menu() = default;
virtual std::shared_ptr<MenuItem> AddItem( virtual std::shared_ptr<MenuItem> AddItem(
const std::string &label, std::function<void()> onTrigger = std::function<void()>(), const std::string &label, std::function<void()> onTrigger = std::function<void()>(),
@ -188,7 +188,7 @@ typedef std::shared_ptr<Menu> MenuRef;
// A native menu bar. // A native menu bar.
class MenuBar { class MenuBar {
public: public:
virtual ~MenuBar() {} virtual ~MenuBar() = default;
virtual std::shared_ptr<Menu> AddSubMenu(const std::string &label) = 0; virtual std::shared_ptr<Menu> AddSubMenu(const std::string &label) = 0;
@ -222,7 +222,7 @@ public:
std::function<void(double)> onScrollbarAdjusted; std::function<void(double)> onScrollbarAdjusted;
std::function<void()> onRender; std::function<void()> onRender;
virtual ~Window() {} virtual ~Window() = default;
// Returns physical display DPI. // Returns physical display DPI.
virtual double GetPixelDensity() = 0; virtual double GetPixelDensity() = 0;
@ -299,7 +299,7 @@ public:
std::function<void(Response)> onResponse; std::function<void(Response)> onResponse;
virtual ~MessageDialog() {} virtual ~MessageDialog() = default;
virtual void SetType(Type type) = 0; virtual void SetType(Type type) = 0;
virtual void SetTitle(std::string title) = 0; virtual void SetTitle(std::string title) = 0;
@ -347,7 +347,7 @@ extern std::vector<FileFilter> CsvFileFilters;
// A native dialog that asks to choose a file. // A native dialog that asks to choose a file.
class FileDialog { class FileDialog {
public: public:
virtual ~FileDialog() {} virtual ~FileDialog() = default;
virtual void SetTitle(std::string title) = 0; virtual void SetTitle(std::string title) = 0;
virtual void SetCurrentName(std::string name) = 0; virtual void SetCurrentName(std::string name) = 0;

View File

@ -124,7 +124,7 @@ public:
} }
} }
~SettingsImplGtk() { ~SettingsImplGtk() override {
if(!_path.IsEmpty()) { if(!_path.IsEmpty()) {
// json-c <0.12 has the first argument non-const // json-c <0.12 has the first argument non-const
if(json_object_to_file_ext((char *)_path.raw.c_str(), _json, if(json_object_to_file_ext((char *)_path.raw.c_str(), _json,

View File

@ -53,22 +53,24 @@ void FatalError(std::string message) {
class SettingsImplDummy final : public Settings { class SettingsImplDummy final : public Settings {
public: public:
void FreezeInt(const std::string &key, uint32_t value) {} void FreezeInt(const std::string &key, uint32_t value) override {
}
uint32_t ThawInt(const std::string &key, uint32_t defaultValue = 0) { uint32_t ThawInt(const std::string &key, uint32_t defaultValue = 0) override {
return defaultValue; return defaultValue;
} }
void FreezeFloat(const std::string &key, double value) {} void FreezeFloat(const std::string &key, double value) override {
}
double ThawFloat(const std::string &key, double defaultValue = 0.0) { double ThawFloat(const std::string &key, double defaultValue = 0.0) override {
return defaultValue; return defaultValue;
} }
void FreezeString(const std::string &key, const std::string &value) {} void FreezeString(const std::string &key, const std::string &value) override {
}
std::string ThawString(const std::string &key, std::string ThawString(const std::string &key, const std::string &defaultValue = "") override {
const std::string &defaultValue = "") {
return defaultValue; return defaultValue;
} }
}; };

View File

@ -54,8 +54,7 @@ void *AllocTemporary(size_t n)
return (void *)&h[1]; return (void *)&h[1];
} }
void FreeAllTemporary(void) void FreeAllTemporary() {
{
AllocTempHeader *h = Head; AllocTempHeader *h = Head;
while(h) { while(h) {
AllocTempHeader *f = h; AllocTempHeader *f = h;

View File

@ -727,8 +727,8 @@ public:
// Data // Data
EdgeRenderer::Handle handle; EdgeRenderer::Handle handle;
virtual Canvas::Layer GetLayer() const override { return stroke.layer; }; Canvas::Layer GetLayer() const override { return stroke.layer; }
virtual int GetZIndex() const override { return stroke.zIndex; }; int GetZIndex() const override { return stroke.zIndex; }
static std::shared_ptr<DrawCall> Create(OpenGl3Renderer *renderer, const SEdgeList &el, static std::shared_ptr<DrawCall> Create(OpenGl3Renderer *renderer, const SEdgeList &el,
Canvas::Stroke *stroke) { Canvas::Stroke *stroke) {
@ -757,8 +757,8 @@ public:
OutlineRenderer::Handle handle; OutlineRenderer::Handle handle;
Canvas::DrawOutlinesAs drawAs; Canvas::DrawOutlinesAs drawAs;
virtual Canvas::Layer GetLayer() const override { return stroke.layer; }; Canvas::Layer GetLayer() const override { return stroke.layer; }
virtual int GetZIndex() const override { return stroke.zIndex; }; int GetZIndex() const override { return stroke.zIndex; }
static std::shared_ptr<DrawCall> Create(OpenGl3Renderer *renderer, const SOutlineList &ol, static std::shared_ptr<DrawCall> Create(OpenGl3Renderer *renderer, const SOutlineList &ol,
Canvas::Stroke *stroke, Canvas::Stroke *stroke,
@ -788,8 +788,8 @@ public:
// Data // Data
IndexedMeshRenderer::Handle handle; IndexedMeshRenderer::Handle handle;
virtual Canvas::Layer GetLayer() const override { return stroke.layer; }; Canvas::Layer GetLayer() const override { return stroke.layer; }
virtual int GetZIndex() const override { return stroke.zIndex; }; int GetZIndex() const override { return stroke.zIndex; }
static std::shared_ptr<DrawCall> Create(OpenGl3Renderer *renderer, const SIndexedMesh &mesh, static std::shared_ptr<DrawCall> Create(OpenGl3Renderer *renderer, const SIndexedMesh &mesh,
Canvas::Stroke *stroke) { Canvas::Stroke *stroke) {
@ -817,8 +817,8 @@ public:
// Data // Data
IndexedMeshRenderer::Handle handle; IndexedMeshRenderer::Handle handle;
virtual Canvas::Layer GetLayer() const override { return fill.layer; }; Canvas::Layer GetLayer() const override { return fill.layer; }
virtual int GetZIndex() const override { return fill.zIndex; }; int GetZIndex() const override { return fill.zIndex; }
static std::shared_ptr<DrawCall> Create(OpenGl3Renderer *renderer, const SIndexedMesh &mesh, static std::shared_ptr<DrawCall> Create(OpenGl3Renderer *renderer, const SIndexedMesh &mesh,
Canvas::Fill *fill) { Canvas::Fill *fill) {
@ -856,8 +856,8 @@ public:
bool hasFillBack; bool hasFillBack;
bool isShaded; bool isShaded;
virtual Canvas::Layer GetLayer() const override { return fillFront.layer; }; Canvas::Layer GetLayer() const override { return fillFront.layer; }
virtual int GetZIndex() const override { return fillFront.zIndex; }; int GetZIndex() const override { return fillFront.zIndex; }
static std::shared_ptr<DrawCall> Create(OpenGl3Renderer *renderer, const SMesh &m, static std::shared_ptr<DrawCall> Create(OpenGl3Renderer *renderer, const SMesh &m,
Canvas::Fill *fillFront, Canvas::Fill *fillBack = NULL, Canvas::Fill *fillFront, Canvas::Fill *fillBack = NULL,