Skip to content

Commit 8d3752b

Browse files
committed
Start requring C++11 with explicit virtual overrides.
1 parent f02a339 commit 8d3752b

7 files changed

+42
-40
lines changed

ASTNode.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ class ASTCompare : public ASTBinary {
144144
ASTCompare(PycRef<ASTNode> left, PycRef<ASTNode> right, int op)
145145
: ASTBinary(left, right, op, NODE_COMPARE) { }
146146

147-
const char* op_str() const;
147+
const char* op_str() const override;
148148
};
149149

150150

@@ -556,7 +556,6 @@ class ASTComprehension : public ASTNode {
556556

557557
};
558558

559-
560559
class ASTLoadBuildClass : public ASTNode {
561560
public:
562561
ASTLoadBuildClass(PycRef<PycObject> obj)

CMakeLists.txt

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
project(pycdc)
2-
cmake_minimum_required(VERSION 2.8)
2+
cmake_minimum_required(VERSION 3.1)
3+
4+
set(CMAKE_CXX_STANDARD 11)
5+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
36

47
# For generating the bytes tables
58
find_package(PythonInterp REQUIRED)

data.h

+8-8
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ class PycFile : public PycData {
2929
PycFile(const char* filename);
3030
~PycFile() { if (m_stream) fclose(m_stream); }
3131

32-
bool isOpen() const { return (m_stream != 0); }
33-
bool atEof() const;
32+
bool isOpen() const override { return (m_stream != 0); }
33+
bool atEof() const override;
3434

35-
int getByte();
36-
int getBuffer(int bytes, void* buffer);
35+
int getByte() override;
36+
int getBuffer(int bytes, void* buffer) override;
3737

3838
private:
3939
FILE* m_stream;
@@ -45,11 +45,11 @@ class PycBuffer : public PycData {
4545
: m_buffer((const unsigned char*)buffer), m_size(size), m_pos(0) { }
4646
~PycBuffer() { }
4747

48-
bool isOpen() const { return (m_buffer != 0); }
49-
bool atEof() const { return (m_pos == m_size); }
48+
bool isOpen() const override { return (m_buffer != 0); }
49+
bool atEof() const override { return (m_pos == m_size); }
5050

51-
int getByte();
52-
int getBuffer(int bytes, void* buffer);
51+
int getByte() override;
52+
int getBuffer(int bytes, void* buffer) override;
5353

5454
private:
5555
const unsigned char* m_buffer;

pyc_code.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class PycCode : public PycObject {
3131
: PycObject(type), m_argCount(0), m_kwOnlyArgCount(0), m_numLocals(0),
3232
m_stackSize(0), m_flags(0), m_firstLine(0) { }
3333

34-
void load(class PycData* stream, class PycModule* mod);
34+
void load(class PycData* stream, class PycModule* mod) override;
3535

3636
int argCount() const { return m_argCount; }
3737
int kwOnlyArgCount() const { return m_kwOnlyArgCount; }

pyc_numeric.h

+14-14
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ class PycInt : public PycObject {
1111
PycInt(int value = 0, int type = TYPE_INT)
1212
: PycObject(type), m_value(value) { }
1313

14-
bool isEqual(PycRef<PycObject> obj) const
14+
bool isEqual(PycRef<PycObject> obj) const override
1515
{
1616
return (type() == obj.type()) &&
1717
(m_value == obj.cast<PycInt>()->m_value);
1818
}
1919

20-
void load(class PycData* stream, class PycModule* mod);
20+
void load(class PycData* stream, class PycModule* mod) override;
2121

2222
int value() const { return m_value; }
2323

@@ -30,9 +30,9 @@ class PycLong : public PycObject {
3030
PycLong(int type = TYPE_LONG)
3131
: PycObject(type), m_size(0) { }
3232

33-
bool isEqual(PycRef<PycObject> obj) const;
33+
bool isEqual(PycRef<PycObject> obj) const override;
3434

35-
void load(class PycData* stream, class PycModule* mod);
35+
void load(class PycData* stream, class PycModule* mod) override;
3636

3737
int size() const { return m_size; }
3838
const std::list<int>& value() const { return m_value; }
@@ -49,11 +49,11 @@ class PycFloat : public PycObject {
4949
PycFloat(int type = TYPE_FLOAT)
5050
: PycObject(type), m_value(0) { }
5151

52-
~PycFloat() { if (m_value) delete[] m_value; }
52+
~PycFloat() { delete[] m_value; }
5353

54-
bool isEqual(PycRef<PycObject> obj) const;
54+
bool isEqual(PycRef<PycObject> obj) const override;
5555

56-
void load(class PycData* stream, class PycModule* mod);
56+
void load(class PycData* stream, class PycModule* mod) override;
5757

5858
const char* value() const { return m_value; }
5959

@@ -66,11 +66,11 @@ class PycComplex : public PycFloat {
6666
PycComplex(int type = TYPE_COMPLEX)
6767
: PycFloat(type), m_imag(0) { }
6868

69-
~PycComplex() { if (m_imag) delete[] m_imag; }
69+
~PycComplex() { delete[] m_imag; }
7070

71-
bool isEqual(PycRef<PycObject> obj) const;
71+
bool isEqual(PycRef<PycObject> obj) const override;
7272

73-
void load(class PycData* stream, class PycModule* mod);
73+
void load(class PycData* stream, class PycModule* mod) override;
7474

7575
const char* imag() const { return m_imag; }
7676

@@ -83,13 +83,13 @@ class PycCFloat : public PycObject {
8383
PycCFloat(int type = TYPE_BINARY_FLOAT)
8484
: PycObject(type), m_value(0.0) { }
8585

86-
bool isEqual(PycRef<PycObject> obj) const
86+
bool isEqual(PycRef<PycObject> obj) const override
8787
{
8888
return (type() == obj.type()) &&
8989
(m_value == obj.cast<PycCFloat>()->m_value);
9090
}
9191

92-
void load(class PycData* stream, class PycModule* mod);
92+
void load(class PycData* stream, class PycModule* mod) override;
9393

9494
double value() const { return m_value; }
9595

@@ -102,13 +102,13 @@ class PycCComplex : public PycCFloat {
102102
PycCComplex(int type = TYPE_BINARY_COMPLEX)
103103
: PycCFloat(type), m_imag(0.0) { }
104104

105-
bool isEqual(PycRef<PycObject> obj) const
105+
bool isEqual(PycRef<PycObject> obj) const override
106106
{
107107
return (PycCFloat::isEqual(obj)) &&
108108
(m_imag == obj.cast<PycCComplex>()->m_imag);
109109
}
110110

111-
void load(class PycData* stream, class PycModule* mod);
111+
void load(class PycData* stream, class PycModule* mod) override;
112112

113113
double imag() const { return m_imag; }
114114

pyc_sequence.h

+12-12
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ class PycTuple : public PycSequence {
2323

2424
PycTuple(int type = TYPE_TUPLE) : PycSequence(type) { }
2525

26-
bool isEqual(PycRef<PycObject> obj) const;
26+
bool isEqual(PycRef<PycObject> obj) const override;
2727

28-
void load(class PycData* stream, class PycModule* mod);
28+
void load(class PycData* stream, class PycModule* mod) override;
2929

3030
const value_t& values() const { return m_values; }
31-
PycRef<PycObject> get(int idx) const { return m_values.at(idx); }
31+
PycRef<PycObject> get(int idx) const override { return m_values.at(idx); }
3232

3333
private:
3434
value_t m_values;
@@ -40,12 +40,12 @@ class PycList : public PycSequence {
4040

4141
PycList(int type = TYPE_LIST) : PycSequence(type) { }
4242

43-
bool isEqual(PycRef<PycObject> obj) const;
43+
bool isEqual(PycRef<PycObject> obj) const override;
4444

45-
void load(class PycData* stream, class PycModule* mod);
45+
void load(class PycData* stream, class PycModule* mod) override;
4646

4747
const value_t& values() const { return m_values; }
48-
PycRef<PycObject> get(int idx) const;
48+
PycRef<PycObject> get(int idx) const override;
4949

5050
private:
5151
value_t m_values;
@@ -58,15 +58,15 @@ class PycDict : public PycSequence {
5858

5959
PycDict(int type = TYPE_DICT) : PycSequence(type) { }
6060

61-
bool isEqual(PycRef<PycObject> obj) const;
61+
bool isEqual(PycRef<PycObject> obj) const override;
6262

63-
void load(class PycData* stream, class PycModule* mod);
63+
void load(class PycData* stream, class PycModule* mod) override;
6464

6565
PycRef<PycObject> get(PycRef<PycObject> key) const;
6666
const key_t& keys() const { return m_keys; }
6767
const value_t& values() const { return m_values; }
6868

69-
PycRef<PycObject> get(int idx) const;
69+
PycRef<PycObject> get(int idx) const override;
7070

7171
private:
7272
key_t m_keys;
@@ -79,12 +79,12 @@ class PycSet : public PycSequence {
7979

8080
PycSet(int type = TYPE_SET) : PycSequence(type) { }
8181

82-
bool isEqual(PycRef<PycObject> obj) const;
82+
bool isEqual(PycRef<PycObject> obj) const override;
8383

84-
void load(class PycData* stream, class PycModule* mod);
84+
void load(class PycData* stream, class PycModule* mod) override;
8585

8686
const value_t& values() const { return m_values; }
87-
PycRef<PycObject> get(int idx) const;
87+
PycRef<PycObject> get(int idx) const override;
8888

8989
private:
9090
value_t m_values;

pyc_string.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ class PycString : public PycObject {
1212

1313
~PycString() { delete[] m_value; }
1414

15-
bool isEqual(PycRef<PycObject> obj) const;
15+
bool isEqual(PycRef<PycObject> obj) const override;
1616
bool isEqual(const char* str) const;
1717

18-
void load(class PycData* stream, class PycModule* mod);
18+
void load(class PycData* stream, class PycModule* mod) override;
1919

2020
int length() const { return m_length; }
2121
const char* value() const { return m_value; }

0 commit comments

Comments
 (0)