Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable -Woverloaded-virtual and fix resulting warnings #162

Merged
merged 1 commit into from
Apr 22, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ OD ?= od

OPT ?= -O3

CXXFLAGS ?= -g $(OPT) -Wall -Wextra -pedantic -std=c++0x -fPIC -Iinclude
CXXFLAGS ?= -g $(OPT) -Wall -Wextra -Woverloaded-virtual -pedantic -std=c++0x -fPIC -Iinclude
CFLAGS ?= -g $(OPT) -Wall -Wextra -pedantic -std=c99 -fPIC -Iinclude
EMCXXFLAGS = $(CXXFLAGS) --memory-init-file 0 -s DISABLE_EXCEPTION_CATCHING=0
EMCFLAGS = $(CFLAGS) --memory-init-file 0 -s DISABLE_EXCEPTION_CATCHING=0
Expand Down
8 changes: 7 additions & 1 deletion core/formatter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -951,7 +951,7 @@ class Pass {
}
}

virtual void file(AST *body, Fodder &final_fodder)
virtual void file(AST *&body, Fodder &final_fodder)
{
expr(body);
fodder(final_fodder);
Expand All @@ -960,6 +960,7 @@ class Pass {


class EnforceStringStyle : public Pass {
using Pass::visit;
public:
EnforceStringStyle(Allocator &alloc, const FmtOpts &opts) : Pass(alloc, opts) { }
void visit(LiteralString *lit)
Expand Down Expand Up @@ -1108,6 +1109,7 @@ bool contains_newline(const Fodder &fodder)

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

/* Remove nested parens. */
class FixParens : public Pass {
using Pass::visit;
public:
FixParens(Allocator &alloc, const FmtOpts &opts) : Pass(alloc, opts) { }
void visit(Parens *expr)
Expand All @@ -1200,6 +1203,7 @@ class FixParens : public Pass {

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

/* Remove final colon in slices. */
class NoRedundantSliceColon : public Pass {
using Pass::visit;
public:
NoRedundantSliceColon(Allocator &alloc, const FmtOpts &opts) : Pass(alloc, opts) { }

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

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

Expand Down