MSVC: Add noreturn attribute to aiAssert and ValidateDSProcess::ReportError. This reduces warnings in VS2010's static code analysis tool. Thanks to Chris Maiwald for the patch.
Correct include order in assimp_view. git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@539 67173fc5-114c-0410-ac8e-9d2fd5bffc1fpull/1/head
parent
ea3cdcd843
commit
1fd3cfd311
|
@ -74,7 +74,7 @@ bool ValidateDSProcess::IsActive( unsigned int pFlags) const
|
|||
return (pFlags & aiProcess_ValidateDataStructure) != 0;
|
||||
}
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void ValidateDSProcess::ReportError(const char* msg,...)
|
||||
AI_WONT_RETURN void ValidateDSProcess::ReportError(const char* msg,...)
|
||||
{
|
||||
ai_assert(NULL != msg);
|
||||
|
||||
|
|
|
@ -58,9 +58,10 @@ struct aiString;
|
|||
|
||||
namespace Assimp {
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
/** Validates the ASSIMP data structure
|
||||
*/
|
||||
// --------------------------------------------------------------------------------------
|
||||
/** Validates the whole ASSIMP scene data structure for correctness.
|
||||
* ImportErrorException is thrown of the scene is corrupt.*/
|
||||
// --------------------------------------------------------------------------------------
|
||||
class ASSIMP_API ValidateDSProcess : public BaseProcess
|
||||
{
|
||||
friend class Importer;
|
||||
|
@ -84,55 +85,49 @@ protected:
|
|||
// -------------------------------------------------------------------
|
||||
/** Report a validation error. This will throw an exception,
|
||||
* control won't return.
|
||||
* @param msg Format string for sprintf().
|
||||
*/
|
||||
void ReportError(const char* msg,...);
|
||||
* @param msg Format string for sprintf().*/
|
||||
AI_WONT_RETURN void ReportError(const char* msg,...);
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
/** Report a validation warning. This won't throw an exception,
|
||||
* control will return to the callera.
|
||||
* @param msg Format string for sprintf().
|
||||
*/
|
||||
* @param msg Format string for sprintf().*/
|
||||
void ReportWarning(const char* msg,...);
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
/** Validates a mesh
|
||||
* @param pMesh Input mesh
|
||||
*/
|
||||
* @param pMesh Input mesh*/
|
||||
void Validate( const aiMesh* pMesh);
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
/** Validates a bone
|
||||
* @param pMesh Input mesh
|
||||
* @param pBone Input bone
|
||||
*/
|
||||
* @param pBone Input bone*/
|
||||
void Validate( const aiMesh* pMesh,const aiBone* pBone,float* afSum);
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
/** Validates an animation
|
||||
* @param pAnimation Input animation
|
||||
*/
|
||||
* @param pAnimation Input animation*/
|
||||
void Validate( const aiAnimation* pAnimation);
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
/** Validates a material
|
||||
* @param pMaterial Input material
|
||||
*/
|
||||
* @param pMaterial Input material*/
|
||||
void Validate( const aiMaterial* pMaterial);
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
/** Search the material data structure for invalid or corrupt
|
||||
* texture keys.
|
||||
* @param pMaterial Input material
|
||||
* @param type Type of the texture
|
||||
*/
|
||||
* @param type Type of the texture*/
|
||||
void SearchForInvalidTextures(const aiMaterial* pMaterial,
|
||||
aiTextureType type);
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
/** Validates a texture
|
||||
* @param pTexture Input texture
|
||||
*/
|
||||
* @param pTexture Input texture*/
|
||||
void Validate( const aiTexture* pTexture);
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
|
@ -143,28 +138,24 @@ protected:
|
|||
|
||||
// -------------------------------------------------------------------
|
||||
/** Validates a camera
|
||||
* @param pCamera Input camera
|
||||
*/
|
||||
* @param pCamera Input camera*/
|
||||
void Validate( const aiCamera* pCamera);
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
/** Validates a bone animation channel
|
||||
* @param pAnimation Animation channel.
|
||||
* @param pBoneAnim Input bone animation
|
||||
*/
|
||||
* @param pBoneAnim Input bone animation */
|
||||
void Validate( const aiAnimation* pAnimation,
|
||||
const aiNodeAnim* pBoneAnim);
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
/** Validates a node and all of its subnodes
|
||||
* @param Node Input node
|
||||
*/
|
||||
* @param Node Input node*/
|
||||
void Validate( const aiNode* pNode);
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
/** Validates a string
|
||||
* @param pString Input string
|
||||
*/
|
||||
* @param pString Input string*/
|
||||
void Validate( const aiString* pString);
|
||||
|
||||
private:
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
// Set a breakpoint using win32, else line, file and message will be returned and progam ends with
|
||||
// errrocode = 1
|
||||
void Assimp::aiAssert (const std::string &message, unsigned int uiLine, const std::string &file)
|
||||
AI_WONT_RETURN void Assimp::aiAssert (const std::string &message, unsigned int uiLine, const std::string &file)
|
||||
{
|
||||
// moved expression testing out of the function and into the macro to avoid constructing
|
||||
// two std::string on every single ai_assert test
|
||||
|
|
|
@ -14,11 +14,11 @@ namespace Assimp {
|
|||
//! \brief ASSIMP specific assertion test, only works in debug mode
|
||||
//! \param uiLine Line in file
|
||||
//! \param file Source file
|
||||
void aiAssert(const std::string &message, unsigned int uiLine, const std::string &file);
|
||||
AI_WONT_RETURN void aiAssert(const std::string &message, unsigned int uiLine, const std::string &file);
|
||||
|
||||
|
||||
//! \def ai_assert
|
||||
//! \brief ASSIM specific assertion test
|
||||
//! \brief ASSIMP specific assertion test
|
||||
#ifdef DEBUG
|
||||
# define ai_assert(expression) if( !(expression)) Assimp::aiAssert( #expression, __LINE__, __FILE__);
|
||||
#else
|
||||
|
|
|
@ -119,11 +119,18 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
# define ASSIMP_API
|
||||
# endif
|
||||
|
||||
/* Force the compiler to inline a function, if supported
|
||||
/* Force the compiler to inline a function, if possible
|
||||
*/
|
||||
# define AI_FORCE_INLINE __forceinline
|
||||
|
||||
/* Tells the compiler that a function never returns. Used in code analysis
|
||||
* to skip dead paths (e.g. after an assertion evaluated false).
|
||||
*/
|
||||
# define AI_WONT_RETURN __declspec(noreturn)
|
||||
#else
|
||||
|
||||
# define AI_WONT_RETURN
|
||||
|
||||
# define ASSIMP_API
|
||||
# define AI_FORCE_INLINE inline
|
||||
#endif // (defined _MSC_VER)
|
||||
|
@ -213,7 +220,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#define AI_MATH_TWO_PI (AI_MATH_PI * 2.0)
|
||||
#define AI_MATH_HALF_PI (AI_MATH_PI * 0.5)
|
||||
|
||||
/* And this is to avoid endless (float) casts */
|
||||
/* And this is to avoid endless casts to float */
|
||||
#define AI_MATH_PI_F (3.1415926538f)
|
||||
#define AI_MATH_TWO_PI_F (AI_MATH_PI_F * 2.0f)
|
||||
#define AI_MATH_HALF_PI_F (AI_MATH_PI_F * 0.5f)
|
||||
|
|
|
@ -247,7 +247,9 @@ struct aiString
|
|||
aiString(const aiString& rOther) :
|
||||
length(rOther.length)
|
||||
{
|
||||
memcpy( data, rOther.data, rOther.length);
|
||||
// Crop the string to the maximum length
|
||||
length = length>=MAXLEN?MAXLEN-1:length;
|
||||
memcpy( data, rOther.data, length);
|
||||
data[length] = '\0';
|
||||
}
|
||||
|
||||
|
@ -255,6 +257,7 @@ struct aiString
|
|||
aiString(const std::string& pString) :
|
||||
length(pString.length())
|
||||
{
|
||||
length = length>=MAXLEN?MAXLEN-1:length;
|
||||
memcpy( data, pString.c_str(), length);
|
||||
data[length] = '\0';
|
||||
}
|
||||
|
|
|
@ -47,15 +47,15 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
// include resource definitions
|
||||
#include "resource.h"
|
||||
|
||||
// Include ASSIMP headers
|
||||
// Include ASSIMP headers (XXX: do we really need all of them?)
|
||||
#include "assimp.h"
|
||||
#include "assimp.hpp"
|
||||
#include "aiAssert.h"
|
||||
#include "aiFileIO.h"
|
||||
#include "aiPostProcess.h"
|
||||
#include "aiScene.h"
|
||||
#include "IOSystem.h"
|
||||
#include "IOStream.h"
|
||||
#include "assimp.h"
|
||||
#include "assimp.hpp"
|
||||
#include "LogStream.h"
|
||||
#include "DefaultLogger.h"
|
||||
|
||||
|
|
Loading…
Reference in New Issue