Skip to content

Commit

Permalink
Merge branch 'master' into msvc-clang-missing-noreturn
Browse files Browse the repository at this point in the history
  • Loading branch information
kimkulling authored Apr 25, 2023
2 parents 87c3095 + 87a288e commit 1ecb8e9
Show file tree
Hide file tree
Showing 84 changed files with 19,764 additions and 261 deletions.
7 changes: 7 additions & 0 deletions code/AssetLib/3DS/3DSLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,15 @@ void Discreet3DSImporter::ParseMainChunk() {
};

ASSIMP_3DS_END_CHUNK();
#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunreachable-code-return"
#endif
// recursively continue processing this hierarchy level
return ParseMainChunk();
#if defined(__clang__)
#pragma clang diagnostic pop
#endif
}

// ------------------------------------------------------------------------------------------------
Expand Down
16 changes: 0 additions & 16 deletions code/AssetLib/ASE/ASEParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,6 @@ void Parser::Parse() {
}
AI_ASE_HANDLE_TOP_LEVEL_SECTION();
}
return;
}

// ------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -734,7 +733,6 @@ void Parser::ParseLV3MapBlock(Texture &map) {
}
AI_ASE_HANDLE_SECTION("3", "*MAP_XXXXXX");
}
return;
}

// ------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -859,7 +857,6 @@ void Parser::ParseLV1ObjectBlock(ASE::BaseNode &node) {
}
AI_ASE_HANDLE_TOP_LEVEL_SECTION();
}
return;
}

// ------------------------------------------------------------------------------------------------
Expand All @@ -883,7 +880,6 @@ void Parser::ParseLV2CameraSettingsBlock(ASE::Camera &camera) {
}
AI_ASE_HANDLE_SECTION("2", "CAMERA_SETTINGS");
}
return;
}

// ------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -1189,7 +1185,6 @@ void Parser::ParseLV2NodeTransformBlock(ASE::BaseNode &mesh) {
}
AI_ASE_HANDLE_SECTION("2", "*NODE_TM");
}
return;
}
// ------------------------------------------------------------------------------------------------
void Parser::ParseLV2MeshBlock(ASE::Mesh &mesh) {
Expand Down Expand Up @@ -1310,7 +1305,6 @@ void Parser::ParseLV2MeshBlock(ASE::Mesh &mesh) {
}
AI_ASE_HANDLE_SECTION("2", "*MESH");
}
return;
}
// ------------------------------------------------------------------------------------------------
void Parser::ParseLV3MeshWeightsBlock(ASE::Mesh &mesh) {
Expand Down Expand Up @@ -1344,7 +1338,6 @@ void Parser::ParseLV3MeshWeightsBlock(ASE::Mesh &mesh) {
}
AI_ASE_HANDLE_SECTION("3", "*MESH_WEIGHTS");
}
return;
}
// ------------------------------------------------------------------------------------------------
void Parser::ParseLV4MeshBones(unsigned int iNumBones, ASE::Mesh &mesh) {
Expand Down Expand Up @@ -1414,7 +1407,6 @@ void Parser::ParseLV4MeshBonesVertices(unsigned int iNumVertices, ASE::Mesh &mes
}
AI_ASE_HANDLE_SECTION("4", "*MESH_BONE_VERTEX");
}
return;
}
// ------------------------------------------------------------------------------------------------
void Parser::ParseLV3MeshVertexListBlock(
Expand Down Expand Up @@ -1443,7 +1435,6 @@ void Parser::ParseLV3MeshVertexListBlock(
}
AI_ASE_HANDLE_SECTION("3", "*MESH_VERTEX_LIST");
}
return;
}
// ------------------------------------------------------------------------------------------------
void Parser::ParseLV3MeshFaceListBlock(unsigned int iNumFaces, ASE::Mesh &mesh) {
Expand All @@ -1470,7 +1461,6 @@ void Parser::ParseLV3MeshFaceListBlock(unsigned int iNumFaces, ASE::Mesh &mesh)
}
AI_ASE_HANDLE_SECTION("3", "*MESH_FACE_LIST");
}
return;
}
// ------------------------------------------------------------------------------------------------
void Parser::ParseLV3MeshTListBlock(unsigned int iNumVertices,
Expand Down Expand Up @@ -1503,7 +1493,6 @@ void Parser::ParseLV3MeshTListBlock(unsigned int iNumVertices,
}
AI_ASE_HANDLE_SECTION("3", "*MESH_TVERT_LIST");
}
return;
}
// ------------------------------------------------------------------------------------------------
void Parser::ParseLV3MeshTFaceListBlock(unsigned int iNumFaces,
Expand Down Expand Up @@ -1532,7 +1521,6 @@ void Parser::ParseLV3MeshTFaceListBlock(unsigned int iNumFaces,
}
AI_ASE_HANDLE_SECTION("3", "*MESH_TFACE_LIST");
}
return;
}
// ------------------------------------------------------------------------------------------------
void Parser::ParseLV3MappingChannel(unsigned int iChannel, ASE::Mesh &mesh) {
Expand Down Expand Up @@ -1567,7 +1555,6 @@ void Parser::ParseLV3MappingChannel(unsigned int iChannel, ASE::Mesh &mesh) {
}
AI_ASE_HANDLE_SECTION("3", "*MESH_MAPPING_CHANNEL");
}
return;
}
// ------------------------------------------------------------------------------------------------
void Parser::ParseLV3MeshCListBlock(unsigned int iNumVertices, ASE::Mesh &mesh) {
Expand Down Expand Up @@ -1595,7 +1582,6 @@ void Parser::ParseLV3MeshCListBlock(unsigned int iNumVertices, ASE::Mesh &mesh)
}
AI_ASE_HANDLE_SECTION("3", "*MESH_CVERTEX_LIST");
}
return;
}
// ------------------------------------------------------------------------------------------------
void Parser::ParseLV3MeshCFaceListBlock(unsigned int iNumFaces, ASE::Mesh &mesh) {
Expand Down Expand Up @@ -1623,7 +1609,6 @@ void Parser::ParseLV3MeshCFaceListBlock(unsigned int iNumFaces, ASE::Mesh &mesh)
}
AI_ASE_HANDLE_SECTION("3", "*MESH_CFACE_LIST");
}
return;
}
// ------------------------------------------------------------------------------------------------
void Parser::ParseLV3MeshNormalListBlock(ASE::Mesh &sMesh) {
Expand Down Expand Up @@ -1681,7 +1666,6 @@ void Parser::ParseLV3MeshNormalListBlock(ASE::Mesh &sMesh) {
}
AI_ASE_HANDLE_SECTION("3", "*MESH_NORMALS");
}
return;
}
// ------------------------------------------------------------------------------------------------
void Parser::ParseLV4MeshFace(ASE::Face &out) {
Expand Down
1 change: 0 additions & 1 deletion code/AssetLib/B3D/B3DImporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,6 @@ void B3DImporter::ReadTRIS(int v0) {
ASSIMP_LOG_ERROR("Bad triangle index: i0=", i0, ", i1=", i1, ", i2=", i2);
#endif
Fail("Bad triangle index");
continue;
}
face->mNumIndices = 3;
face->mIndices = new unsigned[3];
Expand Down
1 change: 0 additions & 1 deletion code/AssetLib/Collada/ColladaParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1855,7 +1855,6 @@ size_t ColladaParser::ReadPrimitives(XmlNode &node, Mesh &pMesh, std::vector<Inp
default:
// LineStrip is not supported due to expected index unmangling
throw DeadlyImportError("Unsupported primitive type.");
break;
}

// store the face size to later reconstruct the face from
Expand Down
4 changes: 3 additions & 1 deletion code/AssetLib/FBX/FBXConverter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,8 @@ void FBXConverter::ConvertCamera(const Camera &cam, const std::string &orig_name

out_camera->mAspect = cam.AspectWidth() / cam.AspectHeight();

// NOTE: Camera mPosition, mLookAt and mUp must be set to default here.
// All transformations to the camera will be handled by its node in the scenegraph.
out_camera->mPosition = aiVector3D(0.0f);
out_camera->mLookAt = aiVector3D(1.0f, 0.0f, 0.0f);
out_camera->mUp = aiVector3D(0.0f, 1.0f, 0.0f);
Expand Down Expand Up @@ -640,7 +642,7 @@ void FBXConverter::GetRotationMatrix(Model::RotOrder mode, const aiVector3D &rot
bool FBXConverter::NeedsComplexTransformationChain(const Model &model) {
const PropertyTable &props = model.Props();

const auto zero_epsilon = ai_epsilon;
const auto zero_epsilon = Math::getEpsilon<ai_real>();
const aiVector3D all_ones(1.0f, 1.0f, 1.0f);
for (size_t i = 0; i < TransformationComp_MAXIMUM; ++i) {
const TransformationComp comp = static_cast<TransformationComp>(i);
Expand Down
8 changes: 6 additions & 2 deletions code/AssetLib/FBX/FBXParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,15 +189,19 @@ Scope::Scope(Parser& parser,bool topLevel)
ParseError("unexpected content: empty string.");
}

elements.insert(ElementMap::value_type(str,new_Element(*n,parser)));

auto *element = new_Element(*n, parser);
// Element() should stop at the next Key token (or right after a Close token)
n = parser.CurrentToken();
if (n == nullptr) {
if (topLevel) {
elements.insert(ElementMap::value_type(str, element));
return;
}
ParseError("unexpected end of file",parser.LastToken());
delete element;
} else {
elements.insert(ElementMap::value_type(str, element));
}
}
}
Expand Down
1 change: 0 additions & 1 deletion code/AssetLib/LWO/LWOBLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ void LWOImporter::LoadLWOBFile()
if (mFileBuffer + head.length > end)
{
throw DeadlyImportError("LWOB: Invalid chunk length");
break;
}
uint8_t* const next = mFileBuffer+head.length;
switch (head.type)
Expand Down
1 change: 0 additions & 1 deletion code/AssetLib/LWO/LWOLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1486,7 +1486,6 @@ void LWOImporter::LoadLWO2File() {

if (mFileBuffer + head.length > end) {
throw DeadlyImportError("LWO2: Chunk length points behind the file");
break;
}
uint8_t *const next = mFileBuffer + head.length;
mFileBuffer += bufOffset;
Expand Down
2 changes: 1 addition & 1 deletion code/AssetLib/LWO/LWOMaterial.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ void LWOImporter::ConvertMaterial(const LWO::Surface &surf, aiMaterial *pcMat) {

// (the diffuse value is just a scaling factor)
// If a diffuse texture is set, we set this value to 1.0
clr = (b && false ? aiColor3D(1.0, 1.0, 1.0) : surf.mColor);
clr = (b ? aiColor3D(1.0, 1.0, 1.0) : surf.mColor);
clr.r *= surf.mDiffuseValue;
clr.g *= surf.mDiffuseValue;
clr.b *= surf.mDiffuseValue;
Expand Down
12 changes: 5 additions & 7 deletions code/AssetLib/Obj/ObjFileImporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------

Copyright (c) 2006-2020, assimp team
Copyright (c) 2006-2023, assimp team

All rights reserved.

Expand Down Expand Up @@ -84,7 +84,6 @@ ObjFileImporter::ObjFileImporter() :
// Destructor.
ObjFileImporter::~ObjFileImporter() {
delete m_pRootObject;
m_pRootObject = nullptr;
}

// ------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -270,7 +269,7 @@ aiNode *ObjFileImporter::createNodes(const ObjFile::Model *pModel, const ObjFile
for (size_t i = 0; i < pObject->m_Meshes.size(); ++i) {
unsigned int meshId = pObject->m_Meshes[i];
aiMesh *pMesh = createTopology(pModel, pObject, meshId);
if (pMesh) {
if (pMesh != nullptr) {
if (pMesh->mNumFaces > 0) {
MeshArray.push_back(pMesh);
} else {
Expand Down Expand Up @@ -324,14 +323,13 @@ aiMesh *ObjFileImporter::createTopology(const ObjFile::Model *pModel, const ObjF
return nullptr;
}

std::unique_ptr<aiMesh> pMesh(new aiMesh);
aiMesh *pMesh = new aiMesh;
if (!pObjMesh->m_name.empty()) {
pMesh->mName.Set(pObjMesh->m_name);
}

for (size_t index = 0; index < pObjMesh->m_Faces.size(); index++) {
const ObjFile::Face *inp = pObjMesh->m_Faces[index];
//ai_assert(nullptr != inp);

if (inp->mPrimitiveType == aiPrimitiveType_LINE) {
pMesh->mNumFaces += static_cast<unsigned int>(inp->m_vertices.size() - 1);
Expand Down Expand Up @@ -387,9 +385,9 @@ aiMesh *ObjFileImporter::createTopology(const ObjFile::Model *pModel, const ObjF
}

// Create mesh vertices
createVertexArray(pModel, pData, meshIndex, pMesh.get(), uiIdxCount);
createVertexArray(pModel, pData, meshIndex, pMesh, uiIdxCount);

return pMesh.release();
return pMesh;
}

// ------------------------------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion code/AssetLib/Obj/ObjFileParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ void ObjFileParser::parseFile(IOStreamBuffer<char> &streamBuffer) {
getNameNoSpace(m_DataIt, m_DataItEnd, name);
insideCstype = name == "cstype";
goto pf_skip_line;
} break;
}

default: {
pf_skip_line:
Expand Down
3 changes: 1 addition & 2 deletions code/AssetLib/Ogre/OgreXmlSerializer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ namespace Assimp {
namespace Ogre {

//AI_WONT_RETURN void ThrowAttibuteError(const XmlParser *reader, const std::string &name, const std::string &error = "") AI_WONT_RETURN_SUFFIX;

AI_WONT_RETURN void ThrowAttibuteError(const std::string &nodeName, const std::string &name, const std::string &error) AI_WONT_RETURN_SUFFIX;
AI_WONT_RETURN void ThrowAttibuteError(const std::string &nodeName, const std::string &name, const std::string &error) {
if (!error.empty()) {
throw DeadlyImportError(error, " in node '", nodeName, "' and attribute '", name, "'");
Expand Down Expand Up @@ -128,7 +128,6 @@ bool OgreXmlSerializer::ReadAttribute<bool>(XmlNode &xmlNode, const char *name)
}

ThrowAttibuteError(xmlNode.name(), name, "Boolean value is expected to be 'true' or 'false', encountered '" + value + "'");
return false;
}

// Mesh XML constants
Expand Down
9 changes: 0 additions & 9 deletions code/AssetLib/OpenGEX/OpenGEXImporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -460,14 +460,12 @@ void OpenGEXImporter::handleMetricNode(DDLNode *node, aiScene * /*pScene*/) {
void OpenGEXImporter::handleNameNode(DDLNode *node, aiScene * /*pScene*/) {
if (nullptr == m_currentNode) {
throw DeadlyImportError("No current node for name.");
return;
}

Value *val(node->getValue());
if (nullptr != val) {
if (Value::ValueType::ddl_string != val->m_type) {
throw DeadlyImportError("OpenGEX: invalid data type for value in node name.");
return;
}

const std::string name(val->getString());
Expand Down Expand Up @@ -508,7 +506,6 @@ static void getRefNames(DDLNode *node, std::vector<std::string> &names) {
void OpenGEXImporter::handleObjectRefNode(DDLNode *node, aiScene * /*pScene*/) {
if (nullptr == m_currentNode) {
throw DeadlyImportError("No parent node for name.");
return;
}

std::vector<std::string> objRefNames;
Expand All @@ -532,7 +529,6 @@ void OpenGEXImporter::handleObjectRefNode(DDLNode *node, aiScene * /*pScene*/) {
void OpenGEXImporter::handleMaterialRefNode(ODDLParser::DDLNode *node, aiScene * /*pScene*/) {
if (nullptr == m_currentNode) {
throw DeadlyImportError("No parent node for name.");
return;
}

std::vector<std::string> matRefNames;
Expand Down Expand Up @@ -672,14 +668,12 @@ static void setMatrix(aiNode *node, DataArrayList *transformData) {
void OpenGEXImporter::handleTransformNode(ODDLParser::DDLNode *node, aiScene * /*pScene*/) {
if (nullptr == m_currentNode) {
throw DeadlyImportError("No parent node for name.");
return;
}

DataArrayList *transformData(node->getDataArrayList());
if (nullptr != transformData) {
if (transformData->m_numItems != 16) {
throw DeadlyImportError("Invalid number of data for transform matrix.");
return;
}
setMatrix(m_currentNode, transformData);
}
Expand Down Expand Up @@ -835,7 +829,6 @@ static void copyColor4DArray(size_t numItems, DataArrayList *vaList, aiColor4D *
void OpenGEXImporter::handleVertexArrayNode(ODDLParser::DDLNode *node, aiScene * /*pScene*/) {
if (nullptr == node) {
throw DeadlyImportError("No parent node for name.");
return;
}

Property *prop = node->getProperties();
Expand Down Expand Up @@ -876,12 +869,10 @@ void OpenGEXImporter::handleVertexArrayNode(ODDLParser::DDLNode *node, aiScene *
void OpenGEXImporter::handleIndexArrayNode(ODDLParser::DDLNode *node, aiScene * /*pScene*/) {
if (nullptr == node) {
throw DeadlyImportError("No parent node for name.");
return;
}

if (nullptr == m_currentMesh) {
throw DeadlyImportError("No current mesh for index data found.");
return;
}

DataArrayList *vaList = node->getDataArrayList();
Expand Down
3 changes: 1 addition & 2 deletions code/AssetLib/Q3D/Q3DLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -382,11 +382,10 @@ void Q3DImporter::InternReadFile(const std::string &pFile,

// TODO
goto outer;
} break;
}

default:
throw DeadlyImportError("Quick3D: Unknown chunk");
break;
};
}
outer:
Expand Down
1 change: 0 additions & 1 deletion code/AssetLib/X/XFileParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -839,7 +839,6 @@ void XFileParser::ParseDataObjectAnimationKey(AnimBone *pAnimBone) {

default:
ThrowException("Unknown key type ", keyType, " in animation.");
break;
} // end switch

// key separator
Expand Down
Loading

0 comments on commit 1ecb8e9

Please sign in to comment.