Merge pull request #5045 from Jackie9527/msvc-clang-unreachable-code-return

Fix warning related to unreachable-code-return.
pull/5070/head
Kim Kulling 2023-04-18 19:57:16 +02:00 committed by GitHub
commit b1afa41047
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 8 additions and 28 deletions

View File

@ -266,8 +266,15 @@ void Discreet3DSImporter::ParseMainChunk() {
}; };
ASSIMP_3DS_END_CHUNK(); 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 // recursively continue processing this hierarchy level
return ParseMainChunk(); return ParseMainChunk();
#if defined(__clang__)
#pragma clang diagnostic pop
#endif
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------

View File

@ -304,7 +304,6 @@ void Parser::Parse() {
} }
AI_ASE_HANDLE_TOP_LEVEL_SECTION(); AI_ASE_HANDLE_TOP_LEVEL_SECTION();
} }
return;
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
@ -734,7 +733,6 @@ void Parser::ParseLV3MapBlock(Texture &map) {
} }
AI_ASE_HANDLE_SECTION("3", "*MAP_XXXXXX"); AI_ASE_HANDLE_SECTION("3", "*MAP_XXXXXX");
} }
return;
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
@ -859,7 +857,6 @@ void Parser::ParseLV1ObjectBlock(ASE::BaseNode &node) {
} }
AI_ASE_HANDLE_TOP_LEVEL_SECTION(); AI_ASE_HANDLE_TOP_LEVEL_SECTION();
} }
return;
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
@ -883,7 +880,6 @@ void Parser::ParseLV2CameraSettingsBlock(ASE::Camera &camera) {
} }
AI_ASE_HANDLE_SECTION("2", "CAMERA_SETTINGS"); AI_ASE_HANDLE_SECTION("2", "CAMERA_SETTINGS");
} }
return;
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
@ -1189,7 +1185,6 @@ void Parser::ParseLV2NodeTransformBlock(ASE::BaseNode &mesh) {
} }
AI_ASE_HANDLE_SECTION("2", "*NODE_TM"); AI_ASE_HANDLE_SECTION("2", "*NODE_TM");
} }
return;
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void Parser::ParseLV2MeshBlock(ASE::Mesh &mesh) { void Parser::ParseLV2MeshBlock(ASE::Mesh &mesh) {
@ -1310,7 +1305,6 @@ void Parser::ParseLV2MeshBlock(ASE::Mesh &mesh) {
} }
AI_ASE_HANDLE_SECTION("2", "*MESH"); AI_ASE_HANDLE_SECTION("2", "*MESH");
} }
return;
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void Parser::ParseLV3MeshWeightsBlock(ASE::Mesh &mesh) { void Parser::ParseLV3MeshWeightsBlock(ASE::Mesh &mesh) {
@ -1344,7 +1338,6 @@ void Parser::ParseLV3MeshWeightsBlock(ASE::Mesh &mesh) {
} }
AI_ASE_HANDLE_SECTION("3", "*MESH_WEIGHTS"); AI_ASE_HANDLE_SECTION("3", "*MESH_WEIGHTS");
} }
return;
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void Parser::ParseLV4MeshBones(unsigned int iNumBones, ASE::Mesh &mesh) { void Parser::ParseLV4MeshBones(unsigned int iNumBones, ASE::Mesh &mesh) {
@ -1414,7 +1407,6 @@ void Parser::ParseLV4MeshBonesVertices(unsigned int iNumVertices, ASE::Mesh &mes
} }
AI_ASE_HANDLE_SECTION("4", "*MESH_BONE_VERTEX"); AI_ASE_HANDLE_SECTION("4", "*MESH_BONE_VERTEX");
} }
return;
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void Parser::ParseLV3MeshVertexListBlock( void Parser::ParseLV3MeshVertexListBlock(
@ -1443,7 +1435,6 @@ void Parser::ParseLV3MeshVertexListBlock(
} }
AI_ASE_HANDLE_SECTION("3", "*MESH_VERTEX_LIST"); AI_ASE_HANDLE_SECTION("3", "*MESH_VERTEX_LIST");
} }
return;
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void Parser::ParseLV3MeshFaceListBlock(unsigned int iNumFaces, ASE::Mesh &mesh) { void Parser::ParseLV3MeshFaceListBlock(unsigned int iNumFaces, ASE::Mesh &mesh) {
@ -1470,7 +1461,6 @@ void Parser::ParseLV3MeshFaceListBlock(unsigned int iNumFaces, ASE::Mesh &mesh)
} }
AI_ASE_HANDLE_SECTION("3", "*MESH_FACE_LIST"); AI_ASE_HANDLE_SECTION("3", "*MESH_FACE_LIST");
} }
return;
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void Parser::ParseLV3MeshTListBlock(unsigned int iNumVertices, void Parser::ParseLV3MeshTListBlock(unsigned int iNumVertices,
@ -1503,7 +1493,6 @@ void Parser::ParseLV3MeshTListBlock(unsigned int iNumVertices,
} }
AI_ASE_HANDLE_SECTION("3", "*MESH_TVERT_LIST"); AI_ASE_HANDLE_SECTION("3", "*MESH_TVERT_LIST");
} }
return;
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void Parser::ParseLV3MeshTFaceListBlock(unsigned int iNumFaces, void Parser::ParseLV3MeshTFaceListBlock(unsigned int iNumFaces,
@ -1532,7 +1521,6 @@ void Parser::ParseLV3MeshTFaceListBlock(unsigned int iNumFaces,
} }
AI_ASE_HANDLE_SECTION("3", "*MESH_TFACE_LIST"); AI_ASE_HANDLE_SECTION("3", "*MESH_TFACE_LIST");
} }
return;
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void Parser::ParseLV3MappingChannel(unsigned int iChannel, ASE::Mesh &mesh) { void Parser::ParseLV3MappingChannel(unsigned int iChannel, ASE::Mesh &mesh) {
@ -1567,7 +1555,6 @@ void Parser::ParseLV3MappingChannel(unsigned int iChannel, ASE::Mesh &mesh) {
} }
AI_ASE_HANDLE_SECTION("3", "*MESH_MAPPING_CHANNEL"); AI_ASE_HANDLE_SECTION("3", "*MESH_MAPPING_CHANNEL");
} }
return;
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void Parser::ParseLV3MeshCListBlock(unsigned int iNumVertices, ASE::Mesh &mesh) { void Parser::ParseLV3MeshCListBlock(unsigned int iNumVertices, ASE::Mesh &mesh) {
@ -1595,7 +1582,6 @@ void Parser::ParseLV3MeshCListBlock(unsigned int iNumVertices, ASE::Mesh &mesh)
} }
AI_ASE_HANDLE_SECTION("3", "*MESH_CVERTEX_LIST"); AI_ASE_HANDLE_SECTION("3", "*MESH_CVERTEX_LIST");
} }
return;
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void Parser::ParseLV3MeshCFaceListBlock(unsigned int iNumFaces, ASE::Mesh &mesh) { void Parser::ParseLV3MeshCFaceListBlock(unsigned int iNumFaces, ASE::Mesh &mesh) {
@ -1623,7 +1609,6 @@ void Parser::ParseLV3MeshCFaceListBlock(unsigned int iNumFaces, ASE::Mesh &mesh)
} }
AI_ASE_HANDLE_SECTION("3", "*MESH_CFACE_LIST"); AI_ASE_HANDLE_SECTION("3", "*MESH_CFACE_LIST");
} }
return;
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void Parser::ParseLV3MeshNormalListBlock(ASE::Mesh &sMesh) { void Parser::ParseLV3MeshNormalListBlock(ASE::Mesh &sMesh) {
@ -1681,7 +1666,6 @@ void Parser::ParseLV3MeshNormalListBlock(ASE::Mesh &sMesh) {
} }
AI_ASE_HANDLE_SECTION("3", "*MESH_NORMALS"); AI_ASE_HANDLE_SECTION("3", "*MESH_NORMALS");
} }
return;
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void Parser::ParseLV4MeshFace(ASE::Face &out) { void Parser::ParseLV4MeshFace(ASE::Face &out) {

View File

@ -57,7 +57,7 @@ namespace Assimp {
namespace Ogre { 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 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) { AI_WONT_RETURN void ThrowAttibuteError(const std::string &nodeName, const std::string &name, const std::string &error) {
if (!error.empty()) { if (!error.empty()) {
throw DeadlyImportError(error, " in node '", nodeName, "' and attribute '", name, "'"); throw DeadlyImportError(error, " in node '", nodeName, "' and attribute '", name, "'");
@ -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 + "'"); ThrowAttibuteError(xmlNode.name(), name, "Boolean value is expected to be 'true' or 'false', encountered '" + value + "'");
return false;
} }
// Mesh XML constants // Mesh XML constants

View File

@ -460,14 +460,12 @@ void OpenGEXImporter::handleMetricNode(DDLNode *node, aiScene * /*pScene*/) {
void OpenGEXImporter::handleNameNode(DDLNode *node, aiScene * /*pScene*/) { void OpenGEXImporter::handleNameNode(DDLNode *node, aiScene * /*pScene*/) {
if (nullptr == m_currentNode) { if (nullptr == m_currentNode) {
throw DeadlyImportError("No current node for name."); throw DeadlyImportError("No current node for name.");
return;
} }
Value *val(node->getValue()); Value *val(node->getValue());
if (nullptr != val) { if (nullptr != val) {
if (Value::ValueType::ddl_string != val->m_type) { if (Value::ValueType::ddl_string != val->m_type) {
throw DeadlyImportError("OpenGEX: invalid data type for value in node name."); throw DeadlyImportError("OpenGEX: invalid data type for value in node name.");
return;
} }
const std::string name(val->getString()); const std::string name(val->getString());
@ -508,7 +506,6 @@ static void getRefNames(DDLNode *node, std::vector<std::string> &names) {
void OpenGEXImporter::handleObjectRefNode(DDLNode *node, aiScene * /*pScene*/) { void OpenGEXImporter::handleObjectRefNode(DDLNode *node, aiScene * /*pScene*/) {
if (nullptr == m_currentNode) { if (nullptr == m_currentNode) {
throw DeadlyImportError("No parent node for name."); throw DeadlyImportError("No parent node for name.");
return;
} }
std::vector<std::string> objRefNames; std::vector<std::string> objRefNames;
@ -532,7 +529,6 @@ void OpenGEXImporter::handleObjectRefNode(DDLNode *node, aiScene * /*pScene*/) {
void OpenGEXImporter::handleMaterialRefNode(ODDLParser::DDLNode *node, aiScene * /*pScene*/) { void OpenGEXImporter::handleMaterialRefNode(ODDLParser::DDLNode *node, aiScene * /*pScene*/) {
if (nullptr == m_currentNode) { if (nullptr == m_currentNode) {
throw DeadlyImportError("No parent node for name."); throw DeadlyImportError("No parent node for name.");
return;
} }
std::vector<std::string> matRefNames; std::vector<std::string> matRefNames;
@ -672,14 +668,12 @@ static void setMatrix(aiNode *node, DataArrayList *transformData) {
void OpenGEXImporter::handleTransformNode(ODDLParser::DDLNode *node, aiScene * /*pScene*/) { void OpenGEXImporter::handleTransformNode(ODDLParser::DDLNode *node, aiScene * /*pScene*/) {
if (nullptr == m_currentNode) { if (nullptr == m_currentNode) {
throw DeadlyImportError("No parent node for name."); throw DeadlyImportError("No parent node for name.");
return;
} }
DataArrayList *transformData(node->getDataArrayList()); DataArrayList *transformData(node->getDataArrayList());
if (nullptr != transformData) { if (nullptr != transformData) {
if (transformData->m_numItems != 16) { if (transformData->m_numItems != 16) {
throw DeadlyImportError("Invalid number of data for transform matrix."); throw DeadlyImportError("Invalid number of data for transform matrix.");
return;
} }
setMatrix(m_currentNode, transformData); setMatrix(m_currentNode, transformData);
} }
@ -835,7 +829,6 @@ static void copyColor4DArray(size_t numItems, DataArrayList *vaList, aiColor4D *
void OpenGEXImporter::handleVertexArrayNode(ODDLParser::DDLNode *node, aiScene * /*pScene*/) { void OpenGEXImporter::handleVertexArrayNode(ODDLParser::DDLNode *node, aiScene * /*pScene*/) {
if (nullptr == node) { if (nullptr == node) {
throw DeadlyImportError("No parent node for name."); throw DeadlyImportError("No parent node for name.");
return;
} }
Property *prop = node->getProperties(); Property *prop = node->getProperties();
@ -876,12 +869,10 @@ void OpenGEXImporter::handleVertexArrayNode(ODDLParser::DDLNode *node, aiScene *
void OpenGEXImporter::handleIndexArrayNode(ODDLParser::DDLNode *node, aiScene * /*pScene*/) { void OpenGEXImporter::handleIndexArrayNode(ODDLParser::DDLNode *node, aiScene * /*pScene*/) {
if (nullptr == node) { if (nullptr == node) {
throw DeadlyImportError("No parent node for name."); throw DeadlyImportError("No parent node for name.");
return;
} }
if (nullptr == m_currentMesh) { if (nullptr == m_currentMesh) {
throw DeadlyImportError("No current mesh for index data found."); throw DeadlyImportError("No current mesh for index data found.");
return;
} }
DataArrayList *vaList = node->getDataArrayList(); DataArrayList *vaList = node->getDataArrayList();

View File

@ -1247,7 +1247,6 @@ IF (ASSIMP_WARNINGS_AS_ERRORS)
-Wno-format-nonliteral -Wno-format-nonliteral
-Wno-comma -Wno-comma
-Wno-unreachable-code-break -Wno-unreachable-code-break
-Wno-unreachable-code-return
-Wno-implicit-fallthrough -Wno-implicit-fallthrough
-Wno-unused-template -Wno-unused-template
-Wno-undefined-func-template -Wno-undefined-func-template