Add wxOSX_VERIFY_NOERR macro and use it in wxOSX code
This macro replaces the deprecated __Verify_noErr defined in the SDK. It is different from assert, as the expression given to the macro is always evaluated and then, if the result is not zero, and asserts are on, an assert containing a human readable message with the description of the error code is triggered. Closes https://github.com/wxWidgets/wxWidgets/pull/1973 Co-authored-by: Vadim Zeitlin <vadim@wxwidgets.org>
This commit is contained in:
committed by
Vadim Zeitlin
parent
51cc083f31
commit
f8af2601c2
@@ -1098,5 +1098,17 @@ protected:
|
||||
T m_ptr;
|
||||
};
|
||||
|
||||
// This macro checks if the evaluation of cond, having a return value of
|
||||
// OS Error type, is zero, ie no error occurred, and calls the assert handler
|
||||
// with the provided message if it isn't.
|
||||
#define wxOSX_VERIFY_NOERR(cond) \
|
||||
wxSTATEMENT_MACRO_BEGIN \
|
||||
const unsigned long evalOnce = (cond); \
|
||||
if ( evalOnce != 0 ) \
|
||||
{ \
|
||||
wxFAIL_COND_MSG(#cond, GetMacOSStatusErrorString(evalOnce)); \
|
||||
} \
|
||||
wxSTATEMENT_MACRO_END
|
||||
|
||||
#endif
|
||||
// _WX_PRIVATE_CORE_H_
|
||||
|
Reference in New Issue
Block a user