Clean up analysis warnings

feature/pre-code-move
kaetemi 5 years ago committed by Jan Boon
parent 9c46a9d8f7
commit 2ebe1c2a3d

@ -100,8 +100,8 @@ public:
public: public:
EBadBind() {} EBadBind() {}
~EBadBind() throw () {} virtual ~EBadBind() NL_OVERRIDE {}
virtual const char *what() const throw(); virtual const char *what() const throw() NL_OVERRIDE;
}; };

@ -368,8 +368,8 @@ public:
Exception(); Exception();
Exception(const std::string &reason); Exception(const std::string &reason);
Exception(const char *format, ...); Exception(const char *format, ...);
virtual ~Exception() throw() {} virtual ~Exception() NL_OVERRIDE {}
virtual const char *what() const throw(); virtual const char *what() const throw() NL_OVERRIDE;
}; };

@ -368,13 +368,19 @@ extern bool _assertex_stop_1(bool &ignoreNextTime);
// removed because we always check assert (even in release mode) #if defined(NL_DEBUG) // removed because we always check assert (even in release mode) #if defined(NL_DEBUG)
#if defined(_MSC_VER) && _MSC_VER >= 1900
#define nlassume(exp) do { __analysis_assume(exp); } while (0) // __analysis_assume doesn't evaluate the expression at runtime
#else
#define nlassume(exp) do { ) while (0)
#endif
#ifdef NL_NO_DEBUG #ifdef NL_NO_DEBUG
# define nlassert(exp) if(false) # define nlassert(exp) nlassume(exp)
# define nlassertonce(exp) if(false) # define nlassertonce(exp) nlassume(exp)
# define nlassertex(exp, str) if(false) # define nlassertex(exp, str) nlassume(exp)
# define nlverify(exp) { exp; } # define nlverify(exp) do { exp; nlassume(exp); } while (0)
# define nlverifyonce(exp) { exp; } # define nlverifyonce(exp) do { exp; nlassume(exp); } while (0)
# define nlverifyex(exp, str) { exp; } # define nlverifyex(exp, str) do { exp; nlassume(exp); } while (0)
#else // NL_NO_DEBUG #else // NL_NO_DEBUG
# ifdef NL_OS_UNIX # ifdef NL_OS_UNIX
@ -383,25 +389,29 @@ extern bool _assertex_stop_1(bool &ignoreNextTime);
#define nlassert(exp) \ #define nlassert(exp) \
do { \ do { \
if (!(exp)) { \ bool _expResult_ = (exp) ? true : false; \
if (!(_expResult_)) { \
NLMISC::createDebug (); \ NLMISC::createDebug (); \
NLMISC::INelContext::getInstance().getAssertLog()->setPosition (__LINE__, __FILE__, __FUNCTION__); \ NLMISC::INelContext::getInstance().getAssertLog()->setPosition (__LINE__, __FILE__, __FUNCTION__); \
NLMISC::INelContext::getInstance().getAssertLog()->displayNL ("\"%s\" ", #exp); \ NLMISC::INelContext::getInstance().getAssertLog()->displayNL ("\"%s\" ", #exp); \
NLMISC_BREAKPOINT; \ NLMISC_BREAKPOINT; \
} \ } \
nlassume(_expResult_); \
} while(0) } while(0)
#define nlassertonce(exp) nlassert(exp) #define nlassertonce(exp) nlassert(exp)
#define nlassertex(exp, str) \ #define nlassertex(exp, str) \
do { \ do { \
if (!(exp)) { \ bool _expResult_ = (exp) ? true : false; \
if (!(_expResult_)) { \
NLMISC::createDebug (); \ NLMISC::createDebug (); \
NLMISC::INelContext::getInstance().getAssertLog()->setPosition (__LINE__, __FILE__, __FUNCTION__); \ NLMISC::INelContext::getInstance().getAssertLog()->setPosition (__LINE__, __FILE__, __FUNCTION__); \
NLMISC::INelContext::getInstance().getAssertLog()->displayNL ("\"%s\" ", #exp); \ NLMISC::INelContext::getInstance().getAssertLog()->displayNL ("\"%s\" ", #exp); \
NLMISC::INelContext::getInstance().getAssertLog()->displayRawNL str; \ NLMISC::INelContext::getInstance().getAssertLog()->displayRawNL str; \
NLMISC_BREAKPOINT; \ NLMISC_BREAKPOINT; \
} \ } \
nlassume(_expResult_); \
} while(0) } while(0)
#define nlverify(exp) nlassert(exp) #define nlverify(exp) nlassert(exp)
@ -419,16 +429,19 @@ do { \
NLMISC_BREAKPOINT; \ NLMISC_BREAKPOINT; \
} \ } \
ASSERT_THROW_EXCEPTION_CODE_EX(_expResult_, #exp) \ ASSERT_THROW_EXCEPTION_CODE_EX(_expResult_, #exp) \
nlassume(_expResult_); \
} while(0) } while(0)
#define nlassertonce(exp) \ #define nlassertonce(exp) \
do { \ do { \
static bool ignoreNextTime = false; \ static bool ignoreNextTime = false; \
if (!ignoreNextTime && !(exp)) { \ bool _expResult_ = (exp) ? true : false; \
if (!ignoreNextTime && !(_expResult_)) { \
ignoreNextTime = true; \ ignoreNextTime = true; \
if(NLMISC::_assert_stop(ignoreNextTime, __LINE__, __FILE__, __FUNCTION__, #exp)) \ if(NLMISC::_assert_stop(ignoreNextTime, __LINE__, __FILE__, __FUNCTION__, #exp)) \
NLMISC_BREAKPOINT; \ NLMISC_BREAKPOINT; \
} \ } \
nlassume(_expResult_); \
} while(0) } while(0)
#define nlassertex(exp, str) \ #define nlassertex(exp, str) \
@ -442,6 +455,7 @@ do { \
NLMISC_BREAKPOINT; \ NLMISC_BREAKPOINT; \
} \ } \
ASSERT_THROW_EXCEPTION_CODE_EX(_expResult_, #exp) \ ASSERT_THROW_EXCEPTION_CODE_EX(_expResult_, #exp) \
nlassume(_expResult_); \
} while(0) } while(0)
#define nlverify(exp) \ #define nlverify(exp) \
@ -453,6 +467,7 @@ do { \
NLMISC_BREAKPOINT; \ NLMISC_BREAKPOINT; \
} \ } \
ASSERT_THROW_EXCEPTION_CODE_EX(_expResult_, #exp) \ ASSERT_THROW_EXCEPTION_CODE_EX(_expResult_, #exp) \
nlassume(_expResult_); \
} while(0) } while(0)
#define nlverifyonce(exp) \ #define nlverifyonce(exp) \
@ -464,6 +479,7 @@ do { \
if(NLMISC::_assert_stop(ignoreNextTime, __LINE__, __FILE__, __FUNCTION__, #exp)) \ if(NLMISC::_assert_stop(ignoreNextTime, __LINE__, __FILE__, __FUNCTION__, #exp)) \
NLMISC_BREAKPOINT; \ NLMISC_BREAKPOINT; \
} \ } \
nlassume(_expResult_); \
} while(0) } while(0)
#define nlverifyex(exp, str) \ #define nlverifyex(exp, str) \
@ -477,6 +493,7 @@ do { \
NLMISC_BREAKPOINT; \ NLMISC_BREAKPOINT; \
} \ } \
ASSERT_THROW_EXCEPTION_CODE_EX(_expResult_, #exp) \ ASSERT_THROW_EXCEPTION_CODE_EX(_expResult_, #exp) \
nlassume(_expResult_); \
} while(0) } while(0)
# endif // NL_OS_UNIX # endif // NL_OS_UNIX

@ -38,7 +38,7 @@ struct EFile : public EStream
EFile (const std::string& filename) : EStream( "Unknown file error in '"+filename+"'" ), Filename(filename) {} EFile (const std::string& filename) : EStream( "Unknown file error in '"+filename+"'" ), Filename(filename) {}
EFile (const std::string& filename, const std::string& text, bool ) : EStream( text ), Filename(filename) {} EFile (const std::string& filename, const std::string& text, bool ) : EStream( text ), Filename(filename) {}
virtual ~EFile() throw() {} virtual ~EFile() NL_OVERRIDE {}
std::string Filename; std::string Filename;
}; };

@ -78,7 +78,7 @@ struct EStream : public Exception
EStream( const IStream &f, const std::string& str ); EStream( const IStream &f, const std::string& str );
virtual ~EStream() throw() {} virtual ~EStream() NL_OVERRIDE {}
// May Not be Filled... // May Not be Filled...
std::string StreamName; std::string StreamName;

Loading…
Cancel
Save