From be88fdc0858cbec64a62c7e7c1386a86ca6b1d65 Mon Sep 17 00:00:00 2001 From: Marcel Greter Date: Thu, 29 Nov 2018 06:18:42 +0100 Subject: [PATCH] Fix clang warnings --- src/ast.hpp | 8 ++++---- src/ast_selectors.hpp | 38 +++++++++++++++++++------------------- src/ast_supports.hpp | 12 ++++++------ src/ast_values.cpp | 4 ++-- src/ast_values.hpp | 12 ++++++------ 5 files changed, 37 insertions(+), 37 deletions(-) diff --git a/src/ast.hpp b/src/ast.hpp index ca31ebb53..abdb34a95 100644 --- a/src/ast.hpp +++ b/src/ast.hpp @@ -495,7 +495,7 @@ namespace Sass { ADD_PROPERTY(bool, group_end) public: Bubble(ParserState pstate, Statement_Obj n, Statement_Obj g = {}, size_t t = 0); - bool bubbles(); + bool bubbles() override; ATTACH_AST_OPERATIONS(Bubble) ATTACH_CRTP_PERFORM_METHODS() }; @@ -806,7 +806,7 @@ namespace Sass { public: Unary_Expression(ParserState pstate, Type t, Expression_Obj o); const std::string type_name(); - virtual bool operator==(const Expression& rhs) const; + virtual bool operator==(const Expression& rhs) const override; size_t hash() const override; ATTACH_AST_OPERATIONS(Unary_Expression) ATTACH_CRTP_PERFORM_METHODS() @@ -898,7 +898,7 @@ namespace Sass { ADD_PROPERTY(At_Root_Query_Obj, expression) public: At_Root_Block(ParserState pstate, Block_Obj b = {}, At_Root_Query_Obj e = {}); - bool bubbles(); + bool bubbles() override; bool exclude_node(Statement_Obj s); ATTACH_AST_OPERATIONS(At_Root_Block) ATTACH_CRTP_PERFORM_METHODS() @@ -926,7 +926,7 @@ namespace Sass { ADD_PROPERTY(bool, has_optional_parameters) ADD_PROPERTY(bool, has_rest_parameter) protected: - void adjust_after_pushing(Parameter_Obj p); + void adjust_after_pushing(Parameter_Obj p) override; public: Parameters(ParserState pstate); ATTACH_AST_OPERATIONS(Parameters) diff --git a/src/ast_selectors.hpp b/src/ast_selectors.hpp index 37eef5d3e..9f5270799 100644 --- a/src/ast_selectors.hpp +++ b/src/ast_selectors.hpp @@ -134,8 +134,8 @@ namespace Sass { virtual ~Simple_Selector() = 0; virtual Compound_Selector_Ptr unify_with(Compound_Selector_Ptr); - virtual bool has_parent_ref() const; - virtual bool has_real_parent_ref() const ; + virtual bool has_parent_ref() const override; + virtual bool has_real_parent_ref() const override; virtual bool is_pseudo_element() const; virtual bool is_superselector_of(Compound_Selector_Ptr_Const sub) const; @@ -169,10 +169,10 @@ namespace Sass { public: Parent_Selector(ParserState pstate, bool r = true); - virtual bool has_parent_ref() const; - virtual bool has_real_parent_ref() const; + virtual bool has_parent_ref() const override; + virtual bool has_real_parent_ref() const override; - virtual unsigned long specificity() const; + virtual unsigned long specificity() const override; int unification_order() const override { throw std::runtime_error("unification_order for Parent_Selector is undefined"); @@ -200,10 +200,10 @@ namespace Sass { return Constants::UnificationOrder_Placeholder; } virtual ~Placeholder_Selector() {}; - virtual unsigned long specificity() const; - virtual bool has_placeholder(); - bool operator<(const Simple_Selector& rhs) const; - bool operator==(const Simple_Selector& rhs) const; + virtual unsigned long specificity() const override; + virtual bool has_placeholder() override; + bool operator<(const Simple_Selector& rhs) const override; + bool operator==(const Simple_Selector& rhs) const override; bool operator<(const Placeholder_Selector& rhs) const; bool operator==(const Placeholder_Selector& rhs) const; ATTACH_AST_OPERATIONS(Placeholder_Selector) @@ -216,7 +216,7 @@ namespace Sass { class Type_Selector final : public Simple_Selector { public: Type_Selector(ParserState pstate, std::string n); - virtual unsigned long specificity() const; + virtual unsigned long specificity() const override; int unification_order() const override { return Constants::UnificationOrder_Element; @@ -237,7 +237,7 @@ namespace Sass { class Class_Selector final : public Simple_Selector { public: Class_Selector(ParserState pstate, std::string n); - virtual unsigned long specificity() const; + virtual unsigned long specificity() const override; int unification_order() const override { return Constants::UnificationOrder_Class; @@ -257,7 +257,7 @@ namespace Sass { class Id_Selector final : public Simple_Selector { public: Id_Selector(ParserState pstate, std::string n); - virtual unsigned long specificity() const; + virtual unsigned long specificity() const override; int unification_order() const override { return Constants::UnificationOrder_Id; @@ -282,7 +282,7 @@ namespace Sass { public: Attribute_Selector(ParserState pstate, std::string n, std::string m, String_Obj v, char o = 0); size_t hash() const override; - virtual unsigned long specificity() const; + virtual unsigned long specificity() const override; int unification_order() const override { return Constants::UnificationOrder_Attribute; @@ -315,9 +315,9 @@ namespace Sass { ADD_PROPERTY(String_Obj, expression) public: Pseudo_Selector(ParserState pstate, std::string n, String_Obj expr = {}); - virtual bool is_pseudo_element() const; + virtual bool is_pseudo_element() const override; size_t hash() const override; - virtual unsigned long specificity() const; + virtual unsigned long specificity() const override; int unification_order() const override { if (is_pseudo_element()) @@ -478,8 +478,8 @@ namespace Sass { void set_innermost(Complex_Selector_Obj, Combinator); size_t hash() const override; - virtual unsigned long specificity() const; - virtual void set_media_block(Media_Block_Ptr mb); + virtual unsigned long specificity() const override; + virtual void set_media_block(Media_Block_Ptr mb) override; virtual bool has_placeholder(); int unification_order() const override { @@ -532,8 +532,8 @@ namespace Sass { Selector_List_Obj eval(Eval& eval); size_t hash() const override; - virtual unsigned long specificity() const; - virtual void set_media_block(Media_Block_Ptr mb); + virtual unsigned long specificity() const override; + virtual void set_media_block(Media_Block_Ptr mb) override; virtual bool has_placeholder(); int unification_order() const override { diff --git a/src/ast_supports.hpp b/src/ast_supports.hpp index 6a27c14a0..2caf82b5c 100644 --- a/src/ast_supports.hpp +++ b/src/ast_supports.hpp @@ -40,7 +40,7 @@ namespace Sass { ADD_PROPERTY(Supports_Condition_Obj, condition) public: Supports_Block(ParserState pstate, Supports_Condition_Obj condition, Block_Obj block = {}); - bool bubbles(); + bool bubbles() override; ATTACH_AST_OPERATIONS(Supports_Block) ATTACH_CRTP_PERFORM_METHODS() }; @@ -68,7 +68,7 @@ namespace Sass { ADD_PROPERTY(Operand, operand); public: Supports_Operator(ParserState pstate, Supports_Condition_Obj l, Supports_Condition_Obj r, Operand o); - virtual bool needs_parens(Supports_Condition_Obj cond) const; + virtual bool needs_parens(Supports_Condition_Obj cond) const override; ATTACH_AST_OPERATIONS(Supports_Operator) ATTACH_CRTP_PERFORM_METHODS() }; @@ -81,7 +81,7 @@ namespace Sass { ADD_PROPERTY(Supports_Condition_Obj, condition); public: Supports_Negation(ParserState pstate, Supports_Condition_Obj c); - virtual bool needs_parens(Supports_Condition_Obj cond) const; + virtual bool needs_parens(Supports_Condition_Obj cond) const override; ATTACH_AST_OPERATIONS(Supports_Negation) ATTACH_CRTP_PERFORM_METHODS() }; @@ -95,7 +95,7 @@ namespace Sass { ADD_PROPERTY(Expression_Obj, value); public: Supports_Declaration(ParserState pstate, Expression_Obj f, Expression_Obj v); - virtual bool needs_parens(Supports_Condition_Obj cond) const; + virtual bool needs_parens(Supports_Condition_Obj cond) const override; ATTACH_AST_OPERATIONS(Supports_Declaration) ATTACH_CRTP_PERFORM_METHODS() }; @@ -108,11 +108,11 @@ namespace Sass { ADD_PROPERTY(Expression_Obj, value); public: Supports_Interpolation(ParserState pstate, Expression_Obj v); - virtual bool needs_parens(Supports_Condition_Obj cond) const; + virtual bool needs_parens(Supports_Condition_Obj cond) const override; ATTACH_AST_OPERATIONS(Supports_Interpolation) ATTACH_CRTP_PERFORM_METHODS() }; } -#endif \ No newline at end of file +#endif diff --git a/src/ast_values.cpp b/src/ast_values.cpp index c0987cd65..633ec5ae4 100644 --- a/src/ast_values.cpp +++ b/src/ast_values.cpp @@ -361,7 +361,7 @@ namespace Sass { return false; } - size_t Variable::hash() + size_t Variable::hash() const { return std::hash()(name()); } @@ -809,4 +809,4 @@ namespace Sass { ///////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////// -} \ No newline at end of file +} diff --git a/src/ast_values.hpp b/src/ast_values.hpp index b3661faee..ee49962e5 100644 --- a/src/ast_values.hpp +++ b/src/ast_values.hpp @@ -79,7 +79,7 @@ namespace Sass { virtual size_t hash() const override; virtual size_t size() const; - virtual void set_delayed(bool delayed); + virtual void set_delayed(bool delayed) override; virtual bool operator== (const Expression& rhs) const override; ATTACH_AST_OPERATIONS(List) @@ -131,7 +131,7 @@ namespace Sass { virtual bool operator==(const Expression& rhs) const override; - virtual size_t hash() const; + virtual size_t hash() const override; enum Sass_OP optype() const { return op_.operand; } ATTACH_AST_OPERATIONS(Binary_Expression) ATTACH_CRTP_PERFORM_METHODS() @@ -196,8 +196,8 @@ namespace Sass { ADD_CONSTREF(std::string, name) public: Variable(ParserState pstate, std::string n); - virtual bool operator==(const Expression& rhs) const; - virtual size_t hash(); + virtual bool operator==(const Expression& rhs) const override; + virtual size_t hash() const override; ATTACH_AST_OPERATIONS(Variable) ATTACH_CRTP_PERFORM_METHODS() }; @@ -292,7 +292,7 @@ namespace Sass { Boolean(ParserState pstate, bool val); operator bool() override { return value_; } - std::string type() const { return "bool"; } + std::string type() const override { return "bool"; } static std::string type_name() { return "bool"; } size_t hash() const override; @@ -343,7 +343,7 @@ namespace Sass { bool has_interpolants(); void rtrim() override; size_t hash() const override; - virtual void set_delayed(bool delayed); + virtual void set_delayed(bool delayed) override; bool operator==(const Expression& rhs) const override; ATTACH_AST_OPERATIONS(String_Schema)