Always use variadic macros and remove wxNO_VARIADIC_MACROS
Variadic macros are always available in C++11, which will be required very soon, so don't bother testing for them and just always use them.
This commit is contained in:
parent
0f2b8a2065
commit
73869d37fd
10 changed files with 3 additions and 71 deletions
|
|
@ -747,12 +747,6 @@
|
||||||
*/
|
*/
|
||||||
#cmakedefine VA_LIST_IS_ARRAY 1
|
#cmakedefine VA_LIST_IS_ARRAY 1
|
||||||
|
|
||||||
/*
|
|
||||||
* Define if you don't want variadic macros to be used even if they are
|
|
||||||
* supported by the compiler.
|
|
||||||
*/
|
|
||||||
#cmakedefine wxNO_VARIADIC_MACROS
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Define if your compiler has std::wstring
|
* Define if your compiler has std::wstring
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
5
configure
vendored
5
configure
vendored
|
|
@ -24278,11 +24278,6 @@ $as_echo "$wx_cv_type_va_list_lvalue" >&6; }
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test "$wxUSE_VARARG_MACROS" != "yes"; then
|
|
||||||
$as_echo "#define wxNO_VARIADIC_MACROS 1" >>confdefs.h
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
LARGEFILE_CPPFLAGS=
|
LARGEFILE_CPPFLAGS=
|
||||||
# Check whether --enable-largefile was given.
|
# Check whether --enable-largefile was given.
|
||||||
if test "${enable_largefile+set}" = set; then :
|
if test "${enable_largefile+set}" = set; then :
|
||||||
|
|
|
||||||
|
|
@ -1717,15 +1717,6 @@ else
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
dnl TODO-C++11: remove this, as it won't make sense when C++11 is required
|
|
||||||
dnl don't use vararg macros if they're explicitly disabled: this is
|
|
||||||
dnl useful if the user code using the library wants to limit itself to standard
|
|
||||||
dnl C++ only (e.g. is compiled with g++ -std=c++98)
|
|
||||||
if test "$wxUSE_VARARG_MACROS" != "yes"; then
|
|
||||||
AC_DEFINE(wxNO_VARIADIC_MACROS)
|
|
||||||
fi dnl wxUSE_VARARG_MACROS == yes
|
|
||||||
|
|
||||||
|
|
||||||
dnl check for large file support
|
dnl check for large file support
|
||||||
LARGEFILE_CPPFLAGS=
|
LARGEFILE_CPPFLAGS=
|
||||||
AC_SYS_LARGEFILE
|
AC_SYS_LARGEFILE
|
||||||
|
|
|
||||||
|
|
@ -123,23 +123,6 @@
|
||||||
#endif /* __WXFUNCTION__ already defined */
|
#endif /* __WXFUNCTION__ already defined */
|
||||||
|
|
||||||
|
|
||||||
/* Auto-detect variadic macros support unless explicitly disabled. */
|
|
||||||
#if !defined(HAVE_VARIADIC_MACROS) && !defined(wxNO_VARIADIC_MACROS)
|
|
||||||
/* Any C99 or C++11 compiler should have them. */
|
|
||||||
#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || \
|
|
||||||
(defined(__cplusplus) && __cplusplus >= 201103L)
|
|
||||||
#define HAVE_VARIADIC_MACROS 1
|
|
||||||
#elif defined(__GNUC__)
|
|
||||||
#define HAVE_VARIADIC_MACROS 1
|
|
||||||
#elif wxCHECK_VISUALC_VERSION(8)
|
|
||||||
#define HAVE_VARIADIC_MACROS 1
|
|
||||||
#endif
|
|
||||||
#endif /* !HAVE_VARIADIC_MACROS */
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef HAVE_VARIADIC_MACROS
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
wxCALL_FOR_EACH(what, ...) calls the macro from its first argument, what(pos, x),
|
wxCALL_FOR_EACH(what, ...) calls the macro from its first argument, what(pos, x),
|
||||||
for every remaining argument 'x', with 'pos' being its 1-based index in
|
for every remaining argument 'x', with 'pos' being its 1-based index in
|
||||||
|
|
@ -185,9 +168,5 @@
|
||||||
#define wxCALL_FOR_EACH(what, ...) \
|
#define wxCALL_FOR_EACH(what, ...) \
|
||||||
wxCALL_FOR_EACH_(wxCALL_FOR_EACH_NARG(__VA_ARGS__), (what, __VA_ARGS__))
|
wxCALL_FOR_EACH_(wxCALL_FOR_EACH_NARG(__VA_ARGS__), (what, __VA_ARGS__))
|
||||||
|
|
||||||
#else
|
|
||||||
#define wxCALL_FOR_EACH Error_wx_CALL_FOR_EACH_requires_variadic_macros_support
|
|
||||||
#endif /* HAVE_VARIADIC_MACROS */
|
|
||||||
|
|
||||||
#endif /* _WX_CPP_H_ */
|
#endif /* _WX_CPP_H_ */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1336,12 +1336,7 @@ inline void wxLogNop() { }
|
||||||
#define wxVLogDebug(format, argptr) wxDO_LOGV(Debug, format, argptr)
|
#define wxVLogDebug(format, argptr) wxDO_LOGV(Debug, format, argptr)
|
||||||
#else // !wxUSE_LOG_DEBUG
|
#else // !wxUSE_LOG_DEBUG
|
||||||
#define wxVLogDebug(fmt, valist) wxLogNop()
|
#define wxVLogDebug(fmt, valist) wxLogNop()
|
||||||
|
#define wxLogDebug(fmt, ...) wxLogNop()
|
||||||
#ifdef HAVE_VARIADIC_MACROS
|
|
||||||
#define wxLogDebug(fmt, ...) wxLogNop()
|
|
||||||
#else // !HAVE_VARIADIC_MACROS
|
|
||||||
WX_DEFINE_VARARG_FUNC_NOP(wxLogDebug, 1, (const wxFormatString&))
|
|
||||||
#endif
|
|
||||||
#endif // wxUSE_LOG_DEBUG/!wxUSE_LOG_DEBUG
|
#endif // wxUSE_LOG_DEBUG/!wxUSE_LOG_DEBUG
|
||||||
|
|
||||||
#if wxUSE_LOG_TRACE
|
#if wxUSE_LOG_TRACE
|
||||||
|
|
@ -1349,12 +1344,7 @@ inline void wxLogNop() { }
|
||||||
#define wxVLogTrace wxDO_LOG_IF_ENABLED_WITH_FUNC(Trace, LogVTrace)
|
#define wxVLogTrace wxDO_LOG_IF_ENABLED_WITH_FUNC(Trace, LogVTrace)
|
||||||
#else // !wxUSE_LOG_TRACE
|
#else // !wxUSE_LOG_TRACE
|
||||||
#define wxVLogTrace(mask, fmt, valist) wxLogNop()
|
#define wxVLogTrace(mask, fmt, valist) wxLogNop()
|
||||||
|
#define wxLogTrace(mask, fmt, ...) wxLogNop()
|
||||||
#ifdef HAVE_VARIADIC_MACROS
|
|
||||||
#define wxLogTrace(mask, fmt, ...) wxLogNop()
|
|
||||||
#else // !HAVE_VARIADIC_MACROS
|
|
||||||
WX_DEFINE_VARARG_FUNC_NOP(wxLogTrace, 2, (const wxString&, const wxFormatString&))
|
|
||||||
#endif // HAVE_VARIADIC_MACROS/!HAVE_VARIADIC_MACROS
|
|
||||||
#endif // wxUSE_LOG_TRACE/!wxUSE_LOG_TRACE
|
#endif // wxUSE_LOG_TRACE/!wxUSE_LOG_TRACE
|
||||||
|
|
||||||
// wxLogFatalError helper: show the (fatal) error to the user in a safe way,
|
// wxLogFatalError helper: show the (fatal) error to the user in a safe way,
|
||||||
|
|
|
||||||
|
|
@ -515,8 +515,6 @@ private:
|
||||||
wxExpectModal<> for your dialog type and implement its OnInvoked()
|
wxExpectModal<> for your dialog type and implement its OnInvoked()
|
||||||
method.
|
method.
|
||||||
*/
|
*/
|
||||||
#ifdef HAVE_VARIADIC_MACROS
|
|
||||||
|
|
||||||
#define wxTEST_DIALOG(codeToRun, ...) \
|
#define wxTEST_DIALOG(codeToRun, ...) \
|
||||||
{ \
|
{ \
|
||||||
wxTEST_DIALOG_HOOK_CLASS wx_hook(__FILE__, __LINE__, __WXFUNCTION__); \
|
wxTEST_DIALOG_HOOK_CLASS wx_hook(__FILE__, __LINE__, __WXFUNCTION__); \
|
||||||
|
|
@ -524,7 +522,6 @@ private:
|
||||||
codeToRun; \
|
codeToRun; \
|
||||||
wx_hook.CheckUnmetExpectations(); \
|
wx_hook.CheckUnmetExpectations(); \
|
||||||
}
|
}
|
||||||
#endif /* HAVE_VARIADIC_MACROS */
|
|
||||||
|
|
||||||
#endif // !WXBUILDING
|
#endif // !WXBUILDING
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -747,12 +747,6 @@
|
||||||
*/
|
*/
|
||||||
#undef VA_LIST_IS_ARRAY
|
#undef VA_LIST_IS_ARRAY
|
||||||
|
|
||||||
/*
|
|
||||||
* Define if you don't want variadic macros to be used even if they are
|
|
||||||
* supported by the compiler.
|
|
||||||
*/
|
|
||||||
#undef wxNO_VARIADIC_MACROS
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Define if your compiler has std::wstring
|
* Define if your compiler has std::wstring
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -279,7 +279,7 @@ bool wxMarkupParser::Parse(const wxString& text)
|
||||||
// and doesn't need to be defined if they're not compiled
|
// and doesn't need to be defined if they're not compiled
|
||||||
// at all (it actually would result in unused variable
|
// at all (it actually would result in unused variable
|
||||||
// messages in this case).
|
// messages in this case).
|
||||||
#if wxUSE_LOG_DEBUG || !defined(HAVE_VARIADIC_MACROS)
|
#if wxUSE_LOG_DEBUG
|
||||||
// Remember the tag starting position for the error
|
// Remember the tag starting position for the error
|
||||||
// messages.
|
// messages.
|
||||||
const size_t pos = it - text.begin();
|
const size_t pos = it - text.begin();
|
||||||
|
|
|
||||||
|
|
@ -11,8 +11,6 @@
|
||||||
|
|
||||||
#include "wx/testing.h"
|
#include "wx/testing.h"
|
||||||
|
|
||||||
#ifdef HAVE_VARIADIC_MACROS
|
|
||||||
|
|
||||||
#include "wx/msgdlg.h"
|
#include "wx/msgdlg.h"
|
||||||
#include "wx/filedlg.h"
|
#include "wx/filedlg.h"
|
||||||
|
|
||||||
|
|
@ -172,5 +170,3 @@ void ModalDialogsTestCase::InitDialog()
|
||||||
dlg.ShowModal();
|
dlg.ShowModal();
|
||||||
CPPUNIT_ASSERT( dlg.WasModal() );
|
CPPUNIT_ASSERT( dlg.WasModal() );
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // HAVE_VARIADIC_MACROS
|
|
||||||
|
|
|
||||||
|
|
@ -39,9 +39,7 @@ public:
|
||||||
private:
|
private:
|
||||||
CPPUNIT_TEST_SUITE( MiscTestCase );
|
CPPUNIT_TEST_SUITE( MiscTestCase );
|
||||||
CPPUNIT_TEST( Assert );
|
CPPUNIT_TEST( Assert );
|
||||||
#ifdef HAVE_VARIADIC_MACROS
|
|
||||||
CPPUNIT_TEST( CallForEach );
|
CPPUNIT_TEST( CallForEach );
|
||||||
#endif // HAVE_VARIADIC_MACROS
|
|
||||||
CPPUNIT_TEST( Delete );
|
CPPUNIT_TEST( Delete );
|
||||||
CPPUNIT_TEST( StaticCast );
|
CPPUNIT_TEST( StaticCast );
|
||||||
CPPUNIT_TEST_SUITE_END();
|
CPPUNIT_TEST_SUITE_END();
|
||||||
|
|
@ -83,7 +81,6 @@ void MiscTestCase::Assert()
|
||||||
wxSetAssertHandler(oldHandler);
|
wxSetAssertHandler(oldHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_VARIADIC_MACROS
|
|
||||||
void MiscTestCase::CallForEach()
|
void MiscTestCase::CallForEach()
|
||||||
{
|
{
|
||||||
#define MY_MACRO(pos, str) s += str;
|
#define MY_MACRO(pos, str) s += str;
|
||||||
|
|
@ -95,7 +92,6 @@ void MiscTestCase::CallForEach()
|
||||||
|
|
||||||
#undef MY_MACRO
|
#undef MY_MACRO
|
||||||
}
|
}
|
||||||
#endif // HAVE_VARIADIC_MACROS
|
|
||||||
|
|
||||||
void MiscTestCase::Delete()
|
void MiscTestCase::Delete()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue