Skip to content

Commit ef3fef8

Browse files
committed
Merge pull request #162 from sparkprime/overloads
Enable -Woverloaded-virtual and fix resulting warnings
2 parents 8025a01 + a1bda24 commit ef3fef8

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ OD ?= od
2929

3030
OPT ?= -O3
3131

32-
CXXFLAGS ?= -g $(OPT) -Wall -Wextra -pedantic -std=c++0x -fPIC -Iinclude
32+
CXXFLAGS ?= -g $(OPT) -Wall -Wextra -Woverloaded-virtual -pedantic -std=c++0x -fPIC -Iinclude
3333
CFLAGS ?= -g $(OPT) -Wall -Wextra -pedantic -std=c99 -fPIC -Iinclude
3434
EMCXXFLAGS = $(CXXFLAGS) --memory-init-file 0 -s DISABLE_EXCEPTION_CATCHING=0
3535
EMCFLAGS = $(CFLAGS) --memory-init-file 0 -s DISABLE_EXCEPTION_CATCHING=0

core/formatter.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -951,7 +951,7 @@ class Pass {
951951
}
952952
}
953953

954-
virtual void file(AST *body, Fodder &final_fodder)
954+
virtual void file(AST *&body, Fodder &final_fodder)
955955
{
956956
expr(body);
957957
fodder(final_fodder);
@@ -960,6 +960,7 @@ class Pass {
960960

961961

962962
class EnforceStringStyle : public Pass {
963+
using Pass::visit;
963964
public:
964965
EnforceStringStyle(Allocator &alloc, const FmtOpts &opts) : Pass(alloc, opts) { }
965966
void visit(LiteralString *lit)
@@ -1108,6 +1109,7 @@ bool contains_newline(const Fodder &fodder)
11081109

11091110
/* Commas should appear at the end of an object/array only if the closing token is on a new line. */
11101111
class FixTrailingCommas : public Pass {
1112+
using Pass::visit;
11111113
public:
11121114
FixTrailingCommas(Allocator &alloc, const FmtOpts &opts) : Pass(alloc, opts) { }
11131115
Fodder comments;
@@ -1182,6 +1184,7 @@ class FixTrailingCommas : public Pass {
11821184

11831185
/* Remove nested parens. */
11841186
class FixParens : public Pass {
1187+
using Pass::visit;
11851188
public:
11861189
FixParens(Allocator &alloc, const FmtOpts &opts) : Pass(alloc, opts) { }
11871190
void visit(Parens *expr)
@@ -1200,6 +1203,7 @@ class FixParens : public Pass {
12001203

12011204
/* Ensure ApplyBrace syntax sugar is used in the case of A + { }. */
12021205
class FixPlusObject : public Pass {
1206+
using Pass::visit;
12031207
public:
12041208
FixPlusObject(Allocator &alloc, const FmtOpts &opts) : Pass(alloc, opts) { }
12051209
void visitExpr(AST *&expr)
@@ -1225,6 +1229,7 @@ class FixPlusObject : public Pass {
12251229

12261230
/* Remove final colon in slices. */
12271231
class NoRedundantSliceColon : public Pass {
1232+
using Pass::visit;
12281233
public:
12291234
NoRedundantSliceColon(Allocator &alloc, const FmtOpts &opts) : Pass(alloc, opts) { }
12301235

@@ -1243,6 +1248,7 @@ class NoRedundantSliceColon : public Pass {
12431248

12441249
/* Ensure syntax sugar is used where possible. */
12451250
class PrettyFieldNames : public Pass {
1251+
using Pass::visit;
12461252
public:
12471253
PrettyFieldNames(Allocator &alloc, const FmtOpts &opts) : Pass(alloc, opts) { }
12481254

0 commit comments

Comments
 (0)