diff --git a/code/nel/include/nel/3d/landscape.h b/code/nel/include/nel/3d/landscape.h index a7383963d..f6e1a5861 100644 --- a/code/nel/include/nel/3d/landscape.h +++ b/code/nel/include/nel/3d/landscape.h @@ -100,8 +100,8 @@ public: public: EBadBind() {} - ~EBadBind() throw () {} - virtual const char *what() const throw(); + virtual ~EBadBind() NL_OVERRIDE {} + virtual const char *what() const throw() NL_OVERRIDE; }; diff --git a/code/nel/include/nel/misc/common.h b/code/nel/include/nel/misc/common.h index f5f99ea6a..a5d1b2f27 100644 --- a/code/nel/include/nel/misc/common.h +++ b/code/nel/include/nel/misc/common.h @@ -368,8 +368,8 @@ public: Exception(); Exception(const std::string &reason); Exception(const char *format, ...); - virtual ~Exception() throw() {} - virtual const char *what() const throw(); + virtual ~Exception() NL_OVERRIDE {} + virtual const char *what() const throw() NL_OVERRIDE; }; diff --git a/code/nel/include/nel/misc/debug.h b/code/nel/include/nel/misc/debug.h index 668c2e5a3..7d4ddcd1b 100644 --- a/code/nel/include/nel/misc/debug.h +++ b/code/nel/include/nel/misc/debug.h @@ -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) +#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 -# define nlassert(exp) if(false) -# define nlassertonce(exp) if(false) -# define nlassertex(exp, str) if(false) -# define nlverify(exp) { exp; } -# define nlverifyonce(exp) { exp; } -# define nlverifyex(exp, str) { exp; } +# define nlassert(exp) nlassume(exp) +# define nlassertonce(exp) nlassume(exp) +# define nlassertex(exp, str) nlassume(exp) +# define nlverify(exp) do { exp; nlassume(exp); } while (0) +# define nlverifyonce(exp) do { exp; nlassume(exp); } while (0) +# define nlverifyex(exp, str) do { exp; nlassume(exp); } while (0) #else // NL_NO_DEBUG # ifdef NL_OS_UNIX @@ -383,25 +389,29 @@ extern bool _assertex_stop_1(bool &ignoreNextTime); #define nlassert(exp) \ do { \ - if (!(exp)) { \ + bool _expResult_ = (exp) ? true : false; \ + if (!(_expResult_)) { \ NLMISC::createDebug (); \ NLMISC::INelContext::getInstance().getAssertLog()->setPosition (__LINE__, __FILE__, __FUNCTION__); \ NLMISC::INelContext::getInstance().getAssertLog()->displayNL ("\"%s\" ", #exp); \ NLMISC_BREAKPOINT; \ } \ + nlassume(_expResult_); \ } while(0) #define nlassertonce(exp) nlassert(exp) #define nlassertex(exp, str) \ do { \ - if (!(exp)) { \ + bool _expResult_ = (exp) ? true : false; \ + if (!(_expResult_)) { \ NLMISC::createDebug (); \ NLMISC::INelContext::getInstance().getAssertLog()->setPosition (__LINE__, __FILE__, __FUNCTION__); \ NLMISC::INelContext::getInstance().getAssertLog()->displayNL ("\"%s\" ", #exp); \ NLMISC::INelContext::getInstance().getAssertLog()->displayRawNL str; \ NLMISC_BREAKPOINT; \ } \ + nlassume(_expResult_); \ } while(0) #define nlverify(exp) nlassert(exp) @@ -419,16 +429,19 @@ do { \ NLMISC_BREAKPOINT; \ } \ ASSERT_THROW_EXCEPTION_CODE_EX(_expResult_, #exp) \ + nlassume(_expResult_); \ } while(0) #define nlassertonce(exp) \ do { \ static bool ignoreNextTime = false; \ - if (!ignoreNextTime && !(exp)) { \ + bool _expResult_ = (exp) ? true : false; \ + if (!ignoreNextTime && !(_expResult_)) { \ ignoreNextTime = true; \ if(NLMISC::_assert_stop(ignoreNextTime, __LINE__, __FILE__, __FUNCTION__, #exp)) \ NLMISC_BREAKPOINT; \ } \ + nlassume(_expResult_); \ } while(0) #define nlassertex(exp, str) \ @@ -442,6 +455,7 @@ do { \ NLMISC_BREAKPOINT; \ } \ ASSERT_THROW_EXCEPTION_CODE_EX(_expResult_, #exp) \ + nlassume(_expResult_); \ } while(0) #define nlverify(exp) \ @@ -453,6 +467,7 @@ do { \ NLMISC_BREAKPOINT; \ } \ ASSERT_THROW_EXCEPTION_CODE_EX(_expResult_, #exp) \ + nlassume(_expResult_); \ } while(0) #define nlverifyonce(exp) \ @@ -464,6 +479,7 @@ do { \ if(NLMISC::_assert_stop(ignoreNextTime, __LINE__, __FILE__, __FUNCTION__, #exp)) \ NLMISC_BREAKPOINT; \ } \ + nlassume(_expResult_); \ } while(0) #define nlverifyex(exp, str) \ @@ -477,6 +493,7 @@ do { \ NLMISC_BREAKPOINT; \ } \ ASSERT_THROW_EXCEPTION_CODE_EX(_expResult_, #exp) \ + nlassume(_expResult_); \ } while(0) # endif // NL_OS_UNIX diff --git a/code/nel/include/nel/misc/file.h b/code/nel/include/nel/misc/file.h index 3e40d122a..f634f4378 100644 --- a/code/nel/include/nel/misc/file.h +++ b/code/nel/include/nel/misc/file.h @@ -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, const std::string& text, bool ) : EStream( text ), Filename(filename) {} - virtual ~EFile() throw() {} + virtual ~EFile() NL_OVERRIDE {} std::string Filename; }; diff --git a/code/nel/include/nel/misc/stream.h b/code/nel/include/nel/misc/stream.h index da9f2835e..89db78a1c 100644 --- a/code/nel/include/nel/misc/stream.h +++ b/code/nel/include/nel/misc/stream.h @@ -78,7 +78,7 @@ struct EStream : public Exception EStream( const IStream &f, const std::string& str ); - virtual ~EStream() throw() {} + virtual ~EStream() NL_OVERRIDE {} // May Not be Filled... std::string StreamName;