From 6fa21dcc6ecca14ee9c09ef40cc3b3f02640d2bf Mon Sep 17 00:00:00 2001 From: Aaron Gokaslan Date: Thu, 25 Aug 2022 11:19:26 -0400 Subject: [PATCH] Explicitly default all empty dtors --- code/AssetLib/BVH/BVHLoader.cpp | 2 +- code/AssetLib/Blender/BlenderTessellator.cpp | 4 +-- code/AssetLib/CSM/CSMLoader.cpp | 3 +- code/AssetLib/Collada/ColladaExporter.cpp | 3 +- code/AssetLib/FBX/FBXDeformer.cpp | 27 +++------------- code/AssetLib/FBX/FBXProperties.cpp | 32 ++++++++----------- code/AssetLib/FBX/FBXTokenizer.cpp | 4 +-- code/AssetLib/IFC/IFCLoader.cpp | 5 ++- code/AssetLib/Irr/IRRMeshLoader.cpp | 2 +- code/AssetLib/MD2/MD2Loader.cpp | 3 +- code/AssetLib/MD3/MD3Loader.cpp | 2 +- .../MDL/HalfLife/UniqueNameGenerator.cpp | 3 +- code/AssetLib/MS3D/MS3DLoader.cpp | 3 +- code/AssetLib/NDO/NDOLoader.cpp | 6 ++-- code/AssetLib/NFF/NFFLoader.cpp | 4 +-- code/AssetLib/OFF/OFFLoader.cpp | 6 ++-- code/AssetLib/Obj/ObjFileParser.cpp | 3 +- code/AssetLib/Ogre/OgreStructs.cpp | 6 ++-- code/AssetLib/OpenGEX/OpenGEXExporter.cpp | 6 ++-- code/Common/ZipArchiveIOSystem.cpp | 3 +- code/PostProcessing/ConvertToLHProcess.cpp | 17 ++++------ code/PostProcessing/FindInstancesProcess.cpp | 3 +- code/PostProcessing/RemoveVCProcess.cpp | 2 +- code/PostProcessing/ValidateDataStructure.cpp | 2 +- 24 files changed, 51 insertions(+), 100 deletions(-) diff --git a/code/AssetLib/BVH/BVHLoader.cpp b/code/AssetLib/BVH/BVHLoader.cpp index 0b9e286b7..0ce60ea1c 100644 --- a/code/AssetLib/BVH/BVHLoader.cpp +++ b/code/AssetLib/BVH/BVHLoader.cpp @@ -88,7 +88,7 @@ BVHLoader::BVHLoader() : // ------------------------------------------------------------------------------------------------ // Destructor, private as well -BVHLoader::~BVHLoader() {} +BVHLoader::~BVHLoader() = default; // ------------------------------------------------------------------------------------------------ // Returns whether the class can handle the format of the given file. diff --git a/code/AssetLib/Blender/BlenderTessellator.cpp b/code/AssetLib/Blender/BlenderTessellator.cpp index d3d463ece..595d735d6 100644 --- a/code/AssetLib/Blender/BlenderTessellator.cpp +++ b/code/AssetLib/Blender/BlenderTessellator.cpp @@ -274,9 +274,7 @@ BlenderTessellatorP2T::BlenderTessellatorP2T( BlenderBMeshConverter& converter ) } // ------------------------------------------------------------------------------------------------ -BlenderTessellatorP2T::~BlenderTessellatorP2T( ) -{ -} +BlenderTessellatorP2T::~BlenderTessellatorP2T() = default; // ------------------------------------------------------------------------------------------------ void BlenderTessellatorP2T::Tessellate( const MLoop* polyLoop, int vertexCount, const std::vector< MVert >& vertices ) diff --git a/code/AssetLib/CSM/CSMLoader.cpp b/code/AssetLib/CSM/CSMLoader.cpp index 681f8602d..7bf736298 100644 --- a/code/AssetLib/CSM/CSMLoader.cpp +++ b/code/AssetLib/CSM/CSMLoader.cpp @@ -85,8 +85,7 @@ CSMImporter::CSMImporter() // ------------------------------------------------------------------------------------------------ // Destructor, private as well -CSMImporter::~CSMImporter() -{} +CSMImporter::~CSMImporter() = default; // ------------------------------------------------------------------------------------------------ // Returns whether the class can handle the format of the given file. diff --git a/code/AssetLib/Collada/ColladaExporter.cpp b/code/AssetLib/Collada/ColladaExporter.cpp index 7a620fd53..40f49e65f 100644 --- a/code/AssetLib/Collada/ColladaExporter.cpp +++ b/code/AssetLib/Collada/ColladaExporter.cpp @@ -154,8 +154,7 @@ ColladaExporter::ColladaExporter(const aiScene *pScene, IOSystem *pIOSystem, con // ------------------------------------------------------------------------------------------------ // Destructor -ColladaExporter::~ColladaExporter() { -} +ColladaExporter::~ColladaExporter() = default; // ------------------------------------------------------------------------------------------------ // Starts writing the contents diff --git a/code/AssetLib/FBX/FBXDeformer.cpp b/code/AssetLib/FBX/FBXDeformer.cpp index ed6330666..df134a401 100644 --- a/code/AssetLib/FBX/FBXDeformer.cpp +++ b/code/AssetLib/FBX/FBXDeformer.cpp @@ -66,11 +66,7 @@ Deformer::Deformer(uint64_t id, const Element& element, const Document& doc, con } // ------------------------------------------------------------------------------------------------ -Deformer::~Deformer() -{ - -} - +Deformer::~Deformer() = default; // ------------------------------------------------------------------------------------------------ Cluster::Cluster(uint64_t id, const Element& element, const Document& doc, const std::string& name) @@ -119,11 +115,7 @@ Cluster::Cluster(uint64_t id, const Element& element, const Document& doc, const // ------------------------------------------------------------------------------------------------ -Cluster::~Cluster() -{ - -} - +Cluster::~Cluster() = default; // ------------------------------------------------------------------------------------------------ Skin::Skin(uint64_t id, const Element& element, const Document& doc, const std::string& name) @@ -152,10 +144,7 @@ Skin::Skin(uint64_t id, const Element& element, const Document& doc, const std:: // ------------------------------------------------------------------------------------------------ -Skin::~Skin() -{ - -} +Skin::~Skin() = default; // ------------------------------------------------------------------------------------------------ BlendShape::BlendShape(uint64_t id, const Element& element, const Document& doc, const std::string& name) : Deformer(id, element, doc, name) @@ -171,10 +160,7 @@ BlendShape::BlendShape(uint64_t id, const Element& element, const Document& doc, } } // ------------------------------------------------------------------------------------------------ -BlendShape::~BlendShape() -{ - -} +BlendShape::~BlendShape() = default; // ------------------------------------------------------------------------------------------------ BlendShapeChannel::BlendShapeChannel(uint64_t id, const Element& element, const Document& doc, const std::string& name) : Deformer(id, element, doc, name) @@ -199,10 +185,7 @@ BlendShapeChannel::BlendShapeChannel(uint64_t id, const Element& element, const } } // ------------------------------------------------------------------------------------------------ -BlendShapeChannel::~BlendShapeChannel() -{ - -} +BlendShapeChannel::~BlendShapeChannel() = default; // ------------------------------------------------------------------------------------------------ } } diff --git a/code/AssetLib/FBX/FBXProperties.cpp b/code/AssetLib/FBX/FBXProperties.cpp index 7803c27ff..1c050617d 100644 --- a/code/AssetLib/FBX/FBXProperties.cpp +++ b/code/AssetLib/FBX/FBXProperties.cpp @@ -60,29 +60,23 @@ namespace FBX { using namespace Util; // ------------------------------------------------------------------------------------------------ -Property::Property() -{ -} + Property::Property() = default; -// ------------------------------------------------------------------------------------------------ -Property::~Property() -{ -} + // ------------------------------------------------------------------------------------------------ + Property::~Property() = default; -namespace { + namespace { -void checkTokenCount(const TokenList& tok, unsigned int expectedCount) -{ - ai_assert(expectedCount >= 2); - if (tok.size() < expectedCount) { - const std::string& s = ParseTokenAsString(*tok[1]); - if (tok[1]->IsBinary()) { - throw DeadlyImportError("Not enough tokens for property of type ", s, " at offset ", tok[1]->Offset()); + void checkTokenCount(const TokenList &tok, unsigned int expectedCount) { + ai_assert(expectedCount >= 2); + if (tok.size() < expectedCount) { + const std::string &s = ParseTokenAsString(*tok[1]); + if (tok[1]->IsBinary()) { + throw DeadlyImportError("Not enough tokens for property of type ", s, " at offset ", tok[1]->Offset()); + } else { + throw DeadlyImportError("Not enough tokens for property of type ", s, " at line ", tok[1]->Line()); + } } - else { - throw DeadlyImportError("Not enough tokens for property of type ", s, " at line ", tok[1]->Line()); - } - } } // ------------------------------------------------------------------------------------------------ diff --git a/code/AssetLib/FBX/FBXTokenizer.cpp b/code/AssetLib/FBX/FBXTokenizer.cpp index 8698abac6..4ef4aff95 100644 --- a/code/AssetLib/FBX/FBXTokenizer.cpp +++ b/code/AssetLib/FBX/FBXTokenizer.cpp @@ -79,9 +79,7 @@ Token::Token(const char* sbegin, const char* send, TokenType type, unsigned int } // ------------------------------------------------------------------------------------------------ -Token::~Token() -{ -} +Token::~Token() = default; namespace { diff --git a/code/AssetLib/IFC/IFCLoader.cpp b/code/AssetLib/IFC/IFCLoader.cpp index 0c20686f4..90b627df8 100644 --- a/code/AssetLib/IFC/IFCLoader.cpp +++ b/code/AssetLib/IFC/IFCLoader.cpp @@ -120,12 +120,11 @@ static const aiImporterDesc desc = { // ------------------------------------------------------------------------------------------------ // Constructor to be privately used by Importer -IFCImporter::IFCImporter() {} +IFCImporter::IFCImporter() = default; // ------------------------------------------------------------------------------------------------ // Destructor, private as well -IFCImporter::~IFCImporter() { -} +IFCImporter::~IFCImporter() = default; // ------------------------------------------------------------------------------------------------ // Returns whether the class can handle the format of the given file. diff --git a/code/AssetLib/Irr/IRRMeshLoader.cpp b/code/AssetLib/Irr/IRRMeshLoader.cpp index 90b4d85af..c219e26f2 100644 --- a/code/AssetLib/Irr/IRRMeshLoader.cpp +++ b/code/AssetLib/Irr/IRRMeshLoader.cpp @@ -79,7 +79,7 @@ IRRMeshImporter::IRRMeshImporter() : // ------------------------------------------------------------------------------------------------ // Destructor, private as well -IRRMeshImporter::~IRRMeshImporter() {} +IRRMeshImporter::~IRRMeshImporter() = default; // ------------------------------------------------------------------------------------------------ // Returns whether the class can handle the format of the given file. diff --git a/code/AssetLib/MD2/MD2Loader.cpp b/code/AssetLib/MD2/MD2Loader.cpp index 99ab3f521..d3c9c67c9 100644 --- a/code/AssetLib/MD2/MD2Loader.cpp +++ b/code/AssetLib/MD2/MD2Loader.cpp @@ -102,8 +102,7 @@ MD2Importer::MD2Importer() // ------------------------------------------------------------------------------------------------ // Destructor, private as well -MD2Importer::~MD2Importer() -{} +MD2Importer::~MD2Importer() = default; // ------------------------------------------------------------------------------------------------ // Returns whether the class can handle the format of the given file. diff --git a/code/AssetLib/MD3/MD3Loader.cpp b/code/AssetLib/MD3/MD3Loader.cpp index 4bd0a8a65..eae580ed8 100644 --- a/code/AssetLib/MD3/MD3Loader.cpp +++ b/code/AssetLib/MD3/MD3Loader.cpp @@ -345,7 +345,7 @@ MD3Importer::MD3Importer() : // ------------------------------------------------------------------------------------------------ // Destructor, private as well -MD3Importer::~MD3Importer() {} +MD3Importer::~MD3Importer() = default; // ------------------------------------------------------------------------------------------------ // Returns whether the class can handle the format of the given file. diff --git a/code/AssetLib/MDL/HalfLife/UniqueNameGenerator.cpp b/code/AssetLib/MDL/HalfLife/UniqueNameGenerator.cpp index 6fc8b118e..3cca8c558 100644 --- a/code/AssetLib/MDL/HalfLife/UniqueNameGenerator.cpp +++ b/code/AssetLib/MDL/HalfLife/UniqueNameGenerator.cpp @@ -68,8 +68,7 @@ UniqueNameGenerator::UniqueNameGenerator(const char *template_name, const char * separator_(separator) { } -UniqueNameGenerator::~UniqueNameGenerator() { -} +UniqueNameGenerator::~UniqueNameGenerator() = default; void UniqueNameGenerator::make_unique(std::vector &names) { struct DuplicateInfo { diff --git a/code/AssetLib/MS3D/MS3DLoader.cpp b/code/AssetLib/MS3D/MS3DLoader.cpp index 6ffc07aea..577078158 100644 --- a/code/AssetLib/MS3D/MS3DLoader.cpp +++ b/code/AssetLib/MS3D/MS3DLoader.cpp @@ -86,8 +86,7 @@ MS3DImporter::MS3DImporter() // ------------------------------------------------------------------------------------------------ // Destructor, private as well -MS3DImporter::~MS3DImporter() -{} +MS3DImporter::~MS3DImporter() = default; // ------------------------------------------------------------------------------------------------ // Returns whether the class can handle the format of the given file. bool MS3DImporter::CanRead( const std::string& pFile, IOSystem* pIOHandler, bool /*checkSig*/) const diff --git a/code/AssetLib/NDO/NDOLoader.cpp b/code/AssetLib/NDO/NDOLoader.cpp index 6594fe32c..1fac224b8 100644 --- a/code/AssetLib/NDO/NDOLoader.cpp +++ b/code/AssetLib/NDO/NDOLoader.cpp @@ -70,13 +70,11 @@ static const aiImporterDesc desc = { // ------------------------------------------------------------------------------------------------ // Constructor to be privately used by Importer -NDOImporter::NDOImporter() -{} +NDOImporter::NDOImporter() = default; // ------------------------------------------------------------------------------------------------ // Destructor, private as well -NDOImporter::~NDOImporter() -{} +NDOImporter::~NDOImporter() = default; // ------------------------------------------------------------------------------------------------ // Returns whether the class can handle the format of the given file. diff --git a/code/AssetLib/NFF/NFFLoader.cpp b/code/AssetLib/NFF/NFFLoader.cpp index 3fd12fa2e..953b0d48e 100644 --- a/code/AssetLib/NFF/NFFLoader.cpp +++ b/code/AssetLib/NFF/NFFLoader.cpp @@ -73,11 +73,11 @@ static const aiImporterDesc desc = { // ------------------------------------------------------------------------------------------------ // Constructor to be privately used by Importer -NFFImporter::NFFImporter() {} +NFFImporter::NFFImporter() = default; // ------------------------------------------------------------------------------------------------ // Destructor, private as well -NFFImporter::~NFFImporter() {} +NFFImporter::~NFFImporter() = default; // ------------------------------------------------------------------------------------------------ // Returns whether the class can handle the format of the given file. diff --git a/code/AssetLib/OFF/OFFLoader.cpp b/code/AssetLib/OFF/OFFLoader.cpp index 640e79249..f137f992d 100644 --- a/code/AssetLib/OFF/OFFLoader.cpp +++ b/code/AssetLib/OFF/OFFLoader.cpp @@ -73,13 +73,11 @@ static const aiImporterDesc desc = { // ------------------------------------------------------------------------------------------------ // Constructor to be privately used by Importer -OFFImporter::OFFImporter() -{} +OFFImporter::OFFImporter() = default; // ------------------------------------------------------------------------------------------------ // Destructor, private as well -OFFImporter::~OFFImporter() -{} +OFFImporter::~OFFImporter() = default; // ------------------------------------------------------------------------------------------------ // Returns whether the class can handle the format of the given file. diff --git a/code/AssetLib/Obj/ObjFileParser.cpp b/code/AssetLib/Obj/ObjFileParser.cpp index 7b0282c43..42bd23689 100644 --- a/code/AssetLib/Obj/ObjFileParser.cpp +++ b/code/AssetLib/Obj/ObjFileParser.cpp @@ -97,8 +97,7 @@ ObjFileParser::ObjFileParser(IOStreamBuffer &streamBuffer, const std::stri parseFile(streamBuffer); } -ObjFileParser::~ObjFileParser() { -} +ObjFileParser::~ObjFileParser() = default; void ObjFileParser::setBuffer(std::vector &buffer) { m_DataIt = buffer.begin(); diff --git a/code/AssetLib/Ogre/OgreStructs.cpp b/code/AssetLib/Ogre/OgreStructs.cpp index 444f7d14a..e2edc4f32 100644 --- a/code/AssetLib/Ogre/OgreStructs.cpp +++ b/code/AssetLib/Ogre/OgreStructs.cpp @@ -272,8 +272,7 @@ std::set IVertexData::ReferencedBonesByWeights() const { // VertexData -VertexData::VertexData() { -} +VertexData::VertexData() = default; VertexData::~VertexData() { Reset(); @@ -310,8 +309,7 @@ VertexElement *VertexData::GetVertexElement(VertexElement::Semantic semantic, ui // VertexDataXml -VertexDataXml::VertexDataXml() { -} +VertexDataXml::VertexDataXml() = default; bool VertexDataXml::HasPositions() const { return !positions.empty(); diff --git a/code/AssetLib/OpenGEX/OpenGEXExporter.cpp b/code/AssetLib/OpenGEX/OpenGEXExporter.cpp index 328c3c460..dae0dc056 100644 --- a/code/AssetLib/OpenGEX/OpenGEXExporter.cpp +++ b/code/AssetLib/OpenGEX/OpenGEXExporter.cpp @@ -46,11 +46,9 @@ namespace OpenGEX { #ifndef ASSIMP_BUILD_NO_OPENGEX_EXPORTER -OpenGEXExporter::OpenGEXExporter() { -} +OpenGEXExporter::OpenGEXExporter() = default; -OpenGEXExporter::~OpenGEXExporter() { -} +OpenGEXExporter::~OpenGEXExporter() = default; bool OpenGEXExporter::exportScene( const char * /*filename*/, const aiScene* /*pScene*/ ) { return true; diff --git a/code/Common/ZipArchiveIOSystem.cpp b/code/Common/ZipArchiveIOSystem.cpp index a29380838..3d5c72e27 100644 --- a/code/Common/ZipArchiveIOSystem.cpp +++ b/code/Common/ZipArchiveIOSystem.cpp @@ -279,8 +279,7 @@ ZipFile::ZipFile(std::string &filename, size_t size) : m_Buffer = std::unique_ptr(new uint8_t[m_Size]); } -ZipFile::~ZipFile() { -} +ZipFile::~ZipFile() = default; size_t ZipFile::Read(void *pvBuffer, size_t pSize, size_t pCount) { // Should be impossible diff --git a/code/PostProcessing/ConvertToLHProcess.cpp b/code/PostProcessing/ConvertToLHProcess.cpp index 4ded0fc15..359c5a284 100644 --- a/code/PostProcessing/ConvertToLHProcess.cpp +++ b/code/PostProcessing/ConvertToLHProcess.cpp @@ -81,16 +81,11 @@ void flipUVs(aiMeshType *pMesh) { // ------------------------------------------------------------------------------------------------ // Constructor to be privately used by Importer -MakeLeftHandedProcess::MakeLeftHandedProcess() : - BaseProcess() { - // empty -} +MakeLeftHandedProcess::MakeLeftHandedProcess() = default; // ------------------------------------------------------------------------------------------------ // Destructor, private as well -MakeLeftHandedProcess::~MakeLeftHandedProcess() { - // empty -} +MakeLeftHandedProcess::~MakeLeftHandedProcess() = default; // ------------------------------------------------------------------------------------------------ // Returns whether the processing step is present in the given flag field. @@ -250,11 +245,11 @@ void MakeLeftHandedProcess::ProcessAnimation(aiNodeAnim *pAnim) { // ------------------------------------------------------------------------------------------------ // Constructor to be privately used by Importer -FlipUVsProcess::FlipUVsProcess() {} +FlipUVsProcess::FlipUVsProcess() = default; // ------------------------------------------------------------------------------------------------ // Destructor, private as well -FlipUVsProcess::~FlipUVsProcess() {} +FlipUVsProcess::~FlipUVsProcess() = default; // ------------------------------------------------------------------------------------------------ // Returns whether the processing step is present in the given flag field. @@ -312,11 +307,11 @@ void FlipUVsProcess::ProcessMesh(aiMesh *pMesh) { // ------------------------------------------------------------------------------------------------ // Constructor to be privately used by Importer -FlipWindingOrderProcess::FlipWindingOrderProcess() {} +FlipWindingOrderProcess::FlipWindingOrderProcess() = default; // ------------------------------------------------------------------------------------------------ // Destructor, private as well -FlipWindingOrderProcess::~FlipWindingOrderProcess() {} +FlipWindingOrderProcess::~FlipWindingOrderProcess() = default; // ------------------------------------------------------------------------------------------------ // Returns whether the processing step is present in the given flag field. diff --git a/code/PostProcessing/FindInstancesProcess.cpp b/code/PostProcessing/FindInstancesProcess.cpp index 7f8c93f77..07a0f66db 100644 --- a/code/PostProcessing/FindInstancesProcess.cpp +++ b/code/PostProcessing/FindInstancesProcess.cpp @@ -60,8 +60,7 @@ FindInstancesProcess::FindInstancesProcess() // ------------------------------------------------------------------------------------------------ // Destructor, private as well -FindInstancesProcess::~FindInstancesProcess() -{} +FindInstancesProcess::~FindInstancesProcess() = default; // ------------------------------------------------------------------------------------------------ // Returns whether the processing step is present in the given flag field. diff --git a/code/PostProcessing/RemoveVCProcess.cpp b/code/PostProcessing/RemoveVCProcess.cpp index 1107736e9..8bbe791f6 100644 --- a/code/PostProcessing/RemoveVCProcess.cpp +++ b/code/PostProcessing/RemoveVCProcess.cpp @@ -58,7 +58,7 @@ RemoveVCProcess::RemoveVCProcess() : // ------------------------------------------------------------------------------------------------ // Destructor, private as well -RemoveVCProcess::~RemoveVCProcess() {} +RemoveVCProcess::~RemoveVCProcess() = default; // ------------------------------------------------------------------------------------------------ // Returns whether the processing step is present in the given flag field. diff --git a/code/PostProcessing/ValidateDataStructure.cpp b/code/PostProcessing/ValidateDataStructure.cpp index ebcfbbf5a..54889f34b 100644 --- a/code/PostProcessing/ValidateDataStructure.cpp +++ b/code/PostProcessing/ValidateDataStructure.cpp @@ -65,7 +65,7 @@ ValidateDSProcess::ValidateDSProcess() : // ------------------------------------------------------------------------------------------------ // Destructor, private as well -ValidateDSProcess::~ValidateDSProcess() {} +ValidateDSProcess::~ValidateDSProcess() = default; // ------------------------------------------------------------------------------------------------ // Returns whether the processing step is present in the given flag field.