Skip to content

Commit bfb02ef

Browse files
committed
Fix clang warnings
1 parent c1990ed commit bfb02ef

File tree

2 files changed

+22
-21
lines changed

2 files changed

+22
-21
lines changed

src/ast.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1515,7 +1515,8 @@ namespace Sass {
15151515

15161516
#ifdef __clang__
15171517

1518-
#pragma clang diagnostic pop
1518+
// #pragma clang diagnostic pop
1519+
// #pragma clang diagnostic push
15191520

15201521
#endif
15211522

src/ast_values.hpp

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,15 @@ namespace Sass {
6262
: PreValue(ptr)
6363
{ }
6464
ATTACH_VIRTUAL_AST_OPERATIONS(Value);
65-
virtual bool operator== (const Expression& rhs) const = 0;
65+
virtual bool operator== (const Expression& rhs) const override = 0;
6666
};
6767

6868
///////////////////////////////////////////////////////////////////////
6969
// Lists of values, both comma- and space-separated (distinguished by a
7070
// type-tag.) Also used to represent variable-length argument lists.
7171
///////////////////////////////////////////////////////////////////////
7272
class List : public Value, public Vectorized<Expression_Obj> {
73-
void adjust_after_pushing(Expression_Obj e) { is_expanded(false); }
73+
void adjust_after_pushing(Expression_Obj e) override { is_expanded(false); }
7474
private:
7575
ADD_PROPERTY(enum Sass_Separator, separator)
7676
ADD_PROPERTY(bool, is_arglist)
@@ -94,18 +94,18 @@ namespace Sass {
9494
is_bracketed_(ptr->is_bracketed_),
9595
from_selector_(ptr->from_selector_)
9696
{ concrete_type(LIST); }
97-
std::string type() const { return is_arglist_ ? "arglist" : "list"; }
97+
std::string type() const override { return is_arglist_ ? "arglist" : "list"; }
9898
static std::string type_name() { return "list"; }
9999
const char* sep_string(bool compressed = false) const {
100100
return separator() == SASS_SPACE ?
101101
" " : (compressed ? "," : ", ");
102102
}
103-
bool is_invisible() const { return empty() && !is_bracketed(); }
103+
bool is_invisible() const override { return empty() && !is_bracketed(); }
104104
Expression_Obj value_at_index(size_t i);
105105

106106
virtual size_t size() const;
107107

108-
virtual size_t hash()
108+
virtual size_t hash() const override
109109
{
110110
if (hash_ == 0) {
111111
hash_ = std::hash<std::string>()(sep_string());
@@ -116,13 +116,13 @@ namespace Sass {
116116
return hash_;
117117
}
118118

119-
virtual void set_delayed(bool delayed)
119+
virtual void set_delayed(bool delayed) override
120120
{
121121
is_delayed(delayed);
122122
// don't set children
123123
}
124124

125-
virtual bool operator== (const Expression& rhs) const;
125+
virtual bool operator== (const Expression& rhs) const override;
126126

127127
ATTACH_AST_OPERATIONS(List)
128128
ATTACH_CRTP_PERFORM_METHODS()
@@ -132,7 +132,7 @@ namespace Sass {
132132
// Key value paris.
133133
///////////////////////////////////////////////////////////////////////
134134
class Map : public Value, public Hashed {
135-
void adjust_after_pushing(std::pair<Expression_Obj, Expression_Obj> p) { is_expanded(false); }
135+
void adjust_after_pushing(std::pair<Expression_Obj, Expression_Obj> p) override { is_expanded(false); }
136136
public:
137137
Map(ParserState pstate,
138138
size_t size = 0)
@@ -143,12 +143,12 @@ namespace Sass {
143143
: Value(ptr),
144144
Hashed(*ptr)
145145
{ concrete_type(MAP); }
146-
std::string type() const { return "map"; }
146+
std::string type() const override { return "map"; }
147147
static std::string type_name() { return "map"; }
148-
bool is_invisible() const { return empty(); }
148+
bool is_invisible() const override { return empty(); }
149149
List_Obj to_list(ParserState& pstate);
150150

151-
virtual size_t hash()
151+
virtual size_t hash() const override
152152
{
153153
if (hash_ == 0) {
154154
for (auto key : keys()) {
@@ -160,7 +160,7 @@ namespace Sass {
160160
return hash_;
161161
}
162162

163-
virtual bool operator== (const Expression& rhs) const;
163+
virtual bool operator== (const Expression& rhs) const override;
164164

165165
ATTACH_AST_OPERATIONS(Map)
166166
ATTACH_CRTP_PERFORM_METHODS()
@@ -177,7 +177,7 @@ namespace Sass {
177177
HASH_PROPERTY(Operand, op)
178178
HASH_PROPERTY(Expression_Obj, left)
179179
HASH_PROPERTY(Expression_Obj, right)
180-
size_t hash_;
180+
mutable size_t hash_;
181181
public:
182182
Binary_Expression(ParserState pstate,
183183
Operand op, Expression_Obj lhs, Expression_Obj rhs)
@@ -196,20 +196,20 @@ namespace Sass {
196196
const std::string separator() {
197197
return sass_op_separator(optype());
198198
}
199-
bool is_left_interpolant(void) const;
200-
bool is_right_interpolant(void) const;
201-
bool has_interpolant() const
199+
bool is_left_interpolant(void) const override;
200+
bool is_right_interpolant(void) const override;
201+
bool has_interpolant() const override
202202
{
203203
return is_left_interpolant() ||
204204
is_right_interpolant();
205205
}
206-
virtual void set_delayed(bool delayed)
206+
virtual void set_delayed(bool delayed) override
207207
{
208208
right()->set_delayed(delayed);
209209
left()->set_delayed(delayed);
210210
is_delayed(delayed);
211211
}
212-
virtual bool operator==(const Expression& rhs) const
212+
virtual bool operator==(const Expression& rhs) const override
213213
{
214214
try
215215
{
@@ -225,7 +225,7 @@ namespace Sass {
225225
}
226226
catch (...) { throw; }
227227
}
228-
virtual size_t hash()
228+
virtual size_t hash() const override
229229
{
230230
if (hash_ == 0) {
231231
hash_ = std::hash<size_t>()(optype());
@@ -709,4 +709,4 @@ namespace Sass {
709709

710710
}
711711

712-
#endif
712+
#endif

0 commit comments

Comments
 (0)