Skip to content

Commit

Permalink
Enable readability-redundant-member-init
Browse files Browse the repository at this point in the history
Signed-off-by: Stefan Marr <[email protected]>
  • Loading branch information
smarr committed Aug 19, 2024
1 parent 49f85a4 commit 7a346e5
Show file tree
Hide file tree
Showing 20 changed files with 30 additions and 24 deletions.
7 changes: 7 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Checks: '*include*,
misc-const-correctness,
misc-static-assert,
misc-unused-parameters,
readability-redundant-member-init,
readability-named-parameter,
readability-else-after-return,
readability-inconsistent-declaration-parameter-name,
Expand Down Expand Up @@ -63,6 +64,12 @@ Checks: '*include*,
-hicpp-special-member-functions,
-cppcoreguidelines-macro-to-enum,
-modernize-macro-to-enum,
-cppcoreguidelines-macro-usage,
-cppcoreguidelines-avoid-const-or-ref-data-members,
-bugprone-reserved-identifier,
-cert-dcl37-c,
-cert-dcl51-cpp,
-cppcoreguidelines-non-private-member-variables-in-classes,
'
WarningsAsErrors: '*'
HeaderFilterRegex: '^.*/src/.*$'
Expand Down
3 changes: 1 addition & 2 deletions src/compiler/ClassGenerationContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@
#include "../vmobjects/VMSymbol.h"

ClassGenerationContext::ClassGenerationContext()
: name(nullptr), superName(nullptr), classSide(false), instanceFields(),
instanceMethods(), classFields(), classMethods() {}
: name(nullptr), superName(nullptr), classSide(false) {}

void ClassGenerationContext::AddClassField(VMSymbol* field) {
classFields.push_back(field);
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/Variable.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class Variable {
assert(index != 0xff);
}

Variable() : name({}), index(0xff), isArgument(false), coord({}) {}
Variable() : name({}), index(0xff), isArgument(false) {}

Variable(const Variable* old, size_t newIndex, bool isArgument)
: name(old->name), index(newIndex), isArgument(isArgument),
Expand Down
2 changes: 1 addition & 1 deletion src/interpreter/bytecodes.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ class Bytecode {
};

inline uint16_t ComputeOffset(uint8_t byte1, uint8_t byte2) {
return ((uint16_t)byte1) | (((uint16_t)byte2) << 8);
return ((uint16_t)byte1) | (((uint16_t)byte2) << 8U);
}

bool IsJumpBytecode(uint8_t bc);
Expand Down
4 changes: 2 additions & 2 deletions src/memory/DebugCopyingHeap.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ class DebugCopyingHeap : public Heap<DebugCopyingHeap> {
void switchBuffers(bool increaseMemory);
void invalidateOldBuffer();

vector<AbstractVMObject*> currentHeap{};
vector<AbstractVMObject*> currentHeap;
size_t currentHeapSize;
size_t currentHeapUsage{0};
size_t collectionLimit;

vector<AbstractVMObject*> oldHeap{};
vector<AbstractVMObject*> oldHeap;
size_t oldHeapSize{0};

bool oldHeapIsValid{false};
Expand Down
2 changes: 1 addition & 1 deletion src/primitives/Array.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ static vm_oop_t arrCopy(vm_oop_t rcvr) {
return self->Copy();
}

_Array::_Array() : PrimitiveContainer() {
_Array::_Array() {
Add("new:", &arrNew, true);
Add("at:", &arrAt, false);
Add("at:put:", &arrAtPut, false);
Expand Down
2 changes: 1 addition & 1 deletion src/primitives/Block.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@

#include "../primitivesCore/PrimitiveContainer.h"

_Block::_Block() : PrimitiveContainer() {}
_Block::_Block() {}
2 changes: 1 addition & 1 deletion src/primitives/Class.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ static vm_oop_t clsFields(vm_oop_t rcvr) {
return self->GetInstanceFields();
}

_Class::_Class() : PrimitiveContainer() {
_Class::_Class() {
Add("new", &clsNew, false);
Add("name", &clsName, false);
Add("superclass", &clsSuperclass, false);
Expand Down
2 changes: 1 addition & 1 deletion src/primitives/Double.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ static vm_oop_t dblMax(vm_oop_t leftPtr, vm_oop_t rightObj) {
return rightObj;
}

_Double::_Double() : PrimitiveContainer() {
_Double::_Double() {
Add("+", &dblPlus, false);
Add("-", &dblMinus, false);
Add("*", &dblStar, false);
Expand Down
2 changes: 1 addition & 1 deletion src/primitives/Integer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ static vm_oop_t intRange(vm_oop_t leftObj, vm_oop_t rightObj) {
return arr;
}

_Integer::_Integer() : PrimitiveContainer() {
_Integer::_Integer() {
srand((unsigned)time(nullptr));

Add("+", &intPlus, false);
Expand Down
2 changes: 1 addition & 1 deletion src/primitives/Method.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ void mInvokeOnWith(VMFrame* frame) {
mthd->Invoke(frame);
}

_Method::_Method() : PrimitiveContainer() {
_Method::_Method() {
Add("signature", &mSignature, false);
Add("holder", &mHolder, false);
Add("invokeOn:with:", &mInvokeOnWith, false);
Expand Down
2 changes: 1 addition & 1 deletion src/primitives/Object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ vm_oop_t objClass(vm_oop_t self) {
return CLASS_OF(self);
}

_Object::_Object() : PrimitiveContainer() {
_Object::_Object() {
Add("==", &objEqualequal, false);
Add("objectSize", &objObjectSize, false);
Add("hashcode", &objHashcode, false);
Expand Down
2 changes: 1 addition & 1 deletion src/primitives/Primitive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ void pInvokeOnWith(VMFrame* frame) {
mthd->Invoke(frame);
}

_Primitive::_Primitive() : PrimitiveContainer() {
_Primitive::_Primitive() {
Add("signature", &pSignature, false);
Add("holder", &pHolder, false);
Add("invokeOn:with:", &pInvokeOnWith, false);
Expand Down
2 changes: 1 addition & 1 deletion src/primitives/String.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ static vm_oop_t strIsDigits(vm_oop_t rcvr) {
return load_ptr(falseObject);
}

_String::_String() : PrimitiveContainer() {
_String::_String() {
Add("concatenate:", &strConcatenate_, false);
Add("asSymbol", &strAsSymbol, false);
Add("hashcode", &strHashcode, false);
Expand Down
2 changes: 1 addition & 1 deletion src/primitives/Symbol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,6 @@ static vm_oop_t symAsString(vm_oop_t rcvr) {
return Universe::NewString(str);
}

_Symbol::_Symbol() : PrimitiveContainer() {
_Symbol::_Symbol() {
Add("asString", &symAsString, false);
}
2 changes: 1 addition & 1 deletion src/primitives/System.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ void printStackTrace(VMFrame* frame) {
frame->PrintStackTrace();
}

_System::_System() : PrimitiveContainer() {
_System::_System() {
gettimeofday(&start_time, nullptr);

Add("global:", &sysGlobal_, false);
Expand Down
8 changes: 4 additions & 4 deletions src/primitivesCore/PrimitiveContainer.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ class PrimitiveContainer {
bool classSide);

private:
std::map<std::string, FramePrim> framePrims{};
std::map<std::string, UnaryPrim> unaryPrims{};
std::map<std::string, BinaryPrim> binaryPrims{};
std::map<std::string, TernaryPrim> ternaryPrims{};
std::map<std::string, FramePrim> framePrims;
std::map<std::string, UnaryPrim> unaryPrims;
std::map<std::string, BinaryPrim> binaryPrims;
std::map<std::string, TernaryPrim> ternaryPrims;
};
2 changes: 1 addition & 1 deletion src/primitivesCore/PrimitiveLoader.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class PrimitiveLoader {

bool supportsClass(const std::string& name);

std::map<std::string, PrimitiveContainer*> primitiveObjects{};
std::map<std::string, PrimitiveContainer*> primitiveObjects;

static PrimitiveLoader loader;
};
2 changes: 1 addition & 1 deletion src/vmobjects/VMDouble.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class VMDouble : public AbstractVMObject {
public:
typedef GCDouble Stored;

VMDouble(double val) : AbstractVMObject(), embeddedDouble(val) {}
VMDouble(double val) : embeddedDouble(val) {}

[[nodiscard]] VMDouble* CloneForMovingGC() const override;
[[nodiscard]] inline double GetEmbeddedDouble() const;
Expand Down
2 changes: 1 addition & 1 deletion src/vmobjects/VMString.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class VMString : public AbstractVMObject {
typedef GCString Stored;

VMString(const size_t length, const char* str)
: AbstractVMObject(), length(length),
: length(length),
// set the chars-pointer to point at the position of the first
// character
chars((char*)&chars + sizeof(char*)) {
Expand Down

0 comments on commit 7a346e5

Please sign in to comment.