fixed __FUNCTION__ use in Unicode build (it's a variable, not a macro)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@38257 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -48,10 +48,9 @@
|
|||||||
#endif /* __WXDEBUG__ */
|
#endif /* __WXDEBUG__ */
|
||||||
|
|
||||||
/* TODO: add more compilers supporting __FUNCTION__ */
|
/* TODO: add more compilers supporting __FUNCTION__ */
|
||||||
#if defined(__GNUC__) || (defined(_MSC_VER) && _MSC_VER >= 1300)
|
#if !defined(__GNUC__) && !(defined(_MSC_VER) && _MSC_VER >= 1300)
|
||||||
#define __TFUNC__ wxAPPLY_T(__FUNCTION__)
|
/* no __FUNCTION__ support, still define it to avoid #ifdefs elsewhere */
|
||||||
#else /* old compilers without __FUNCTION__ support */
|
#define __FUNCTION__ (NULL)
|
||||||
#define __TFUNC__ _T("")
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------------- */
|
||||||
@@ -85,13 +84,13 @@
|
|||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
szFile and nLine - file name and line number of the ASSERT
|
szFile and nLine - file name and line number of the ASSERT
|
||||||
szFunc - function name of the ASSERT, may be empty
|
szFunc - function name of the ASSERT, may be NULL (NB: ASCII)
|
||||||
szCond - text form of the condition which failed
|
szCond - text form of the condition which failed
|
||||||
szMsg - optional message explaining the reason
|
szMsg - optional message explaining the reason
|
||||||
*/
|
*/
|
||||||
extern void WXDLLIMPEXP_BASE wxOnAssert(const wxChar *szFile,
|
extern void WXDLLIMPEXP_BASE wxOnAssert(const wxChar *szFile,
|
||||||
int nLine,
|
int nLine,
|
||||||
const wxChar *szFunc,
|
const char *szFunc,
|
||||||
const wxChar *szCond,
|
const wxChar *szCond,
|
||||||
const wxChar *szMsg = NULL);
|
const wxChar *szMsg = NULL);
|
||||||
|
|
||||||
@@ -107,14 +106,14 @@
|
|||||||
if ( cond ) \
|
if ( cond ) \
|
||||||
; \
|
; \
|
||||||
else \
|
else \
|
||||||
wxOnAssert(__TFILE__, __LINE__, __TFUNC__, _T(#cond), msg)
|
wxOnAssert(__TFILE__, __LINE__, __FUNCTION__, _T(#cond), msg)
|
||||||
|
|
||||||
/* special form of assert: always triggers it (in debug mode) */
|
/* special form of assert: always triggers it (in debug mode) */
|
||||||
#define wxFAIL wxFAIL_MSG(NULL)
|
#define wxFAIL wxFAIL_MSG(NULL)
|
||||||
|
|
||||||
/* FAIL with some message */
|
/* FAIL with some message */
|
||||||
#define wxFAIL_MSG(msg) \
|
#define wxFAIL_MSG(msg) \
|
||||||
wxOnAssert(__TFILE__, __LINE__, __TFUNC__, _T("wxAssertFailure"), msg)
|
wxOnAssert(__TFILE__, __LINE__, __FUNCTION__, _T("wxAssertFailure"), msg)
|
||||||
|
|
||||||
/* an assert helper used to avoid warning when testing constant expressions, */
|
/* an assert helper used to avoid warning when testing constant expressions, */
|
||||||
/* i.e. wxASSERT( sizeof(int) == 4 ) can generate a compiler warning about */
|
/* i.e. wxASSERT( sizeof(int) == 4 ) can generate a compiler warning about */
|
||||||
@@ -168,7 +167,7 @@
|
|||||||
else \
|
else \
|
||||||
do \
|
do \
|
||||||
{ \
|
{ \
|
||||||
wxOnAssert(__TFILE__, __LINE__, __TFUNC__, _T(#cond), msg); \
|
wxOnAssert(__TFILE__, __LINE__, __FUNCTION__, _T(#cond), msg); \
|
||||||
op; \
|
op; \
|
||||||
} while ( 0 )
|
} while ( 0 )
|
||||||
|
|
||||||
|
@@ -449,7 +449,7 @@ void wxAppConsole::OnAssert(const wxChar *file,
|
|||||||
const wxChar *cond,
|
const wxChar *cond,
|
||||||
const wxChar *msg)
|
const wxChar *msg)
|
||||||
{
|
{
|
||||||
OnAssertFailure(file, line, _T(""), cond, msg);
|
OnAssertFailure(file, line, NULL, cond, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // __WXDEBUG__
|
#endif // __WXDEBUG__
|
||||||
@@ -600,7 +600,7 @@ void wxTrap()
|
|||||||
// this function is called when an assert fails
|
// this function is called when an assert fails
|
||||||
void wxOnAssert(const wxChar *szFile,
|
void wxOnAssert(const wxChar *szFile,
|
||||||
int nLine,
|
int nLine,
|
||||||
const wxChar *szFunc,
|
const char *szFunc,
|
||||||
const wxChar *szCond,
|
const wxChar *szCond,
|
||||||
const wxChar *szMsg)
|
const wxChar *szMsg)
|
||||||
{
|
{
|
||||||
@@ -619,16 +619,19 @@ void wxOnAssert(const wxChar *szFile,
|
|||||||
|
|
||||||
s_bInAssert = true;
|
s_bInAssert = true;
|
||||||
|
|
||||||
|
// __FUNCTION__ is always in ASCII, convert it to wide char if needed
|
||||||
|
const wxString strFunc = wxString::FromAscii(szFunc);
|
||||||
|
|
||||||
if ( !wxTheApp )
|
if ( !wxTheApp )
|
||||||
{
|
{
|
||||||
// by default, show the assert dialog box -- we can't customize this
|
// by default, show the assert dialog box -- we can't customize this
|
||||||
// behaviour
|
// behaviour
|
||||||
ShowAssertDialog(szFile, nLine, szFunc, szCond, szMsg);
|
ShowAssertDialog(szFile, nLine, strFunc, szCond, szMsg);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// let the app process it as it wants
|
// let the app process it as it wants
|
||||||
wxTheApp->OnAssertFailure(szFile, nLine, szFunc, szCond, szMsg);
|
wxTheApp->OnAssertFailure(szFile, nLine, strFunc, szCond, szMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
s_bInAssert = false;
|
s_bInAssert = false;
|
||||||
|
Reference in New Issue
Block a user