fix compation with Watcom after latest vararg templates changes
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45862 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -99,10 +99,14 @@ public:
|
||||
DoPsPrintfFormatWchar, DoPsPrintfFormatUtf8)
|
||||
#ifdef __WATCOMC__
|
||||
// workaround for http://bugzilla.openwatcom.org/show_bug.cgi?id=351
|
||||
WX_DEFINE_VARARG_FUNC_VOID(PsPrintf, 1, (const char*),
|
||||
DoPsPrintfFormatWchar, DoPsPrintfFormatUtf8)
|
||||
WX_DEFINE_VARARG_FUNC_VOID(PsPrintf, 1, (const wchar_t*),
|
||||
DoPsPrintfFormatWchar, DoPsPrintfFormatUtf8)
|
||||
WX_VARARG_WATCOM_WORKAROUND(void, PsPrintf, 1, (const wxString&),
|
||||
(wxFormatString(f1)));
|
||||
WX_VARARG_WATCOM_WORKAROUND(void, PsPrintf, 1, (const wxCStrData&),
|
||||
(wxFormatString(f1)));
|
||||
WX_VARARG_WATCOM_WORKAROUND(void, PsPrintf, 1, (const char*),
|
||||
(wxFormatString(f1)));
|
||||
WX_VARARG_WATCOM_WORKAROUND(void, PsPrintf, 1, (const wchar_t*),
|
||||
(wxFormatString(f1)));
|
||||
#endif
|
||||
|
||||
void PsPrint( const wxString& psdata );
|
||||
|
@@ -488,18 +488,18 @@ WXDLLIMPEXP_BASE const wxChar* wxSysErrorMsg(unsigned long nErrCode = 0);
|
||||
// can't use WX_WATCOM_ONLY_CODE here because the macro would expand to
|
||||
// something too big for Borland C++ to handle
|
||||
#define DECLARE_LOG_FUNCTION_WATCOM(level) \
|
||||
WX_DEFINE_VARARG_FUNC_VOID(wxLog##level, \
|
||||
1, (const char*), \
|
||||
wxDoLog##level##Wchar, \
|
||||
wxDoLog##level##Utf8) \
|
||||
WX_DEFINE_VARARG_FUNC_VOID(wxLog##level, \
|
||||
1, (const wchar_t*), \
|
||||
wxDoLog##level##Wchar, \
|
||||
wxDoLog##level##Utf8) \
|
||||
WX_DEFINE_VARARG_FUNC_VOID(wxLog##level, \
|
||||
WX_VARARG_WATCOM_WORKAROUND(void, wxLog##level, \
|
||||
1, (const wxString&), \
|
||||
(wxFormatString(f1))) \
|
||||
WX_VARARG_WATCOM_WORKAROUND(void, wxLog##level, \
|
||||
1, (const wxCStrData&), \
|
||||
wxDoLog##level##Wchar, \
|
||||
wxDoLog##level##Utf8)
|
||||
(wxFormatString(f1))) \
|
||||
WX_VARARG_WATCOM_WORKAROUND(void, wxLog##level, \
|
||||
1, (const char*), \
|
||||
(wxFormatString(f1))) \
|
||||
WX_VARARG_WATCOM_WORKAROUND(void, wxLog##level, \
|
||||
1, (const wchar_t*), \
|
||||
(wxFormatString(f1)))
|
||||
#else
|
||||
#define DECLARE_LOG_FUNCTION_WATCOM(level)
|
||||
#endif
|
||||
@@ -523,18 +523,18 @@ WXDLLIMPEXP_BASE const wxChar* wxSysErrorMsg(unsigned long nErrCode = 0);
|
||||
// can't use WX_WATCOM_ONLY_CODE here because the macro would expand to
|
||||
// something too big for Borland C++ to handle
|
||||
#define DECLARE_LOG_FUNCTION2_EXP_WATCOM(level, argclass, arg, expdecl) \
|
||||
WX_DEFINE_VARARG_FUNC_VOID(wxLog##level, \
|
||||
2, (argclass, const char*), \
|
||||
wxDoLog##level##Wchar, \
|
||||
wxDoLog##level##Utf8) \
|
||||
WX_DEFINE_VARARG_FUNC_VOID(wxLog##level, \
|
||||
2, (argclass, const wchar_t*), \
|
||||
wxDoLog##level##Wchar, \
|
||||
wxDoLog##level##Utf8) \
|
||||
WX_DEFINE_VARARG_FUNC_VOID(wxLog##level, \
|
||||
WX_VARARG_WATCOM_WORKAROUND(void, wxLog##level, \
|
||||
2, (argclass, const wxString&), \
|
||||
(f1, wxFormatString(f2))) \
|
||||
WX_VARARG_WATCOM_WORKAROUND(void, wxLog##level, \
|
||||
2, (argclass, const wxCStrData&), \
|
||||
wxDoLog##level##Wchar, \
|
||||
wxDoLog##level##Utf8)
|
||||
(f1, wxFormatString(f2))) \
|
||||
WX_VARARG_WATCOM_WORKAROUND(void, wxLog##level, \
|
||||
2, (argclass, const char*), \
|
||||
(f1, wxFormatString(f2))) \
|
||||
WX_VARARG_WATCOM_WORKAROUND(void, wxLog##level, \
|
||||
2, (argclass, const wchar_t*), \
|
||||
(f1, wxFormatString(f2)))
|
||||
#else
|
||||
#define DECLARE_LOG_FUNCTION2_EXP_WATCOM(level, argclass, arg, expdecl)
|
||||
#endif
|
||||
|
@@ -155,23 +155,56 @@ public:
|
||||
// // extensions
|
||||
// ...);
|
||||
WX_DEFINE_VARARG_FUNC_CTOR(wxFileTypeInfo,
|
||||
4, (const wxString&, const wxString&,
|
||||
const wxString&, const wxString&),
|
||||
// NB: these are not format strings, using
|
||||
// wxFormatString here is a hack to get
|
||||
// implicit conversion to wchar_t*/char*
|
||||
4, (const wxFormatString&,
|
||||
const wxFormatString&,
|
||||
const wxFormatString&,
|
||||
const wxFormatString&),
|
||||
VarArgInitWchar, VarArgInitUtf8)
|
||||
#ifdef __WATCOMC__
|
||||
// workaround for http://bugzilla.openwatcom.org/show_bug.cgi?id=351
|
||||
WX_DEFINE_VARARG_FUNC_CTOR(wxFileTypeInfo,
|
||||
4, (const char*, const char*,
|
||||
const char*, const char*),
|
||||
VarArgInitWchar, VarArgInitUtf8)
|
||||
WX_DEFINE_VARARG_FUNC_CTOR(wxFileTypeInfo,
|
||||
4, (const wchar_t*, const wchar_t*,
|
||||
const wchar_t*, const wchar_t*),
|
||||
VarArgInitWchar, VarArgInitUtf8)
|
||||
WX_DEFINE_VARARG_FUNC_CTOR(wxFileTypeInfo,
|
||||
4, (const wxCStrData&, const wxCStrData&,
|
||||
const wxCStrData&, const wxCStrData&),
|
||||
VarArgInitWchar, VarArgInitUtf8)
|
||||
WX_VARARG_WATCOM_WORKAROUND_CTOR(
|
||||
wxFileTypeInfo,
|
||||
4, (const wxString&,
|
||||
const wxString&,
|
||||
const wxString&,
|
||||
const wxString&),
|
||||
(wxFormatString(f1),
|
||||
wxFormatString(f2),
|
||||
wxFormatString(f3),
|
||||
wxFormatString(f4)));
|
||||
WX_VARARG_WATCOM_WORKAROUND_CTOR(
|
||||
wxFileTypeInfo,
|
||||
4, (const wxCStrData&,
|
||||
const wxCStrData&,
|
||||
const wxCStrData&,
|
||||
const wxCStrData&),
|
||||
(wxFormatString(f1),
|
||||
wxFormatString(f2),
|
||||
wxFormatString(f3),
|
||||
wxFormatString(f4)));
|
||||
WX_VARARG_WATCOM_WORKAROUND_CTOR(
|
||||
wxFileTypeInfo,
|
||||
4, (const char*,
|
||||
const char*,
|
||||
const char*,
|
||||
const char*),
|
||||
(wxFormatString(f1),
|
||||
wxFormatString(f2),
|
||||
wxFormatString(f3),
|
||||
wxFormatString(f4)));
|
||||
WX_VARARG_WATCOM_WORKAROUND_CTOR(
|
||||
wxFileTypeInfo,
|
||||
4, (const wchar_t*,
|
||||
const wchar_t*,
|
||||
const wchar_t*,
|
||||
const wchar_t*),
|
||||
(wxFormatString(f1),
|
||||
wxFormatString(f2),
|
||||
wxFormatString(f3),
|
||||
wxFormatString(f4)));
|
||||
#endif
|
||||
|
||||
// the array elements correspond to the parameters of the ctor above in
|
||||
|
@@ -41,12 +41,14 @@ public:
|
||||
DoPrintfWchar, DoPrintfUtf8)
|
||||
#ifdef __WATCOMC__
|
||||
// workaround for http://bugzilla.openwatcom.org/show_bug.cgi?id=351
|
||||
WX_DEFINE_VARARG_FUNC_VOID(Printf, 1, (const char*),
|
||||
DoPrintfWchar, DoPrintfUtf8)
|
||||
WX_DEFINE_VARARG_FUNC_VOID(Printf, 1, (const wchar_t*),
|
||||
DoPrintfWchar, DoPrintfUtf8)
|
||||
WX_DEFINE_VARARG_FUNC_VOID(Printf, 1, (const wxCStrData&),
|
||||
DoPrintfWchar, DoPrintfUtf8)
|
||||
WX_VARARG_WATCOM_WORKAROUND(void, Printf, 1, (const wxString&),
|
||||
(wxFormatString(f1)));
|
||||
WX_VARARG_WATCOM_WORKAROUND(void, Printf, 1, (const wxCStrData&),
|
||||
(wxFormatString(f1)));
|
||||
WX_VARARG_WATCOM_WORKAROUND(void, Printf, 1, (const char*),
|
||||
(wxFormatString(f1)));
|
||||
WX_VARARG_WATCOM_WORKAROUND(void, Printf, 1, (const wchar_t*),
|
||||
(wxFormatString(f1)));
|
||||
#endif
|
||||
|
||||
protected:
|
||||
|
@@ -1579,12 +1579,15 @@ public:
|
||||
WX_DEFINE_VARARG_FUNC(int, Printf, 1, (const wxFormatString&),
|
||||
DoPrintfWchar, DoPrintfUtf8)
|
||||
#ifdef __WATCOMC__
|
||||
WX_DEFINE_VARARG_FUNC(int, Printf, 1, (const char*),
|
||||
DoPrintfWchar, DoPrintfUtf8)
|
||||
WX_DEFINE_VARARG_FUNC(int, Printf, 1, (const wchar_t*),
|
||||
DoPrintfWchar, DoPrintfUtf8)
|
||||
WX_DEFINE_VARARG_FUNC(int, Printf, 1, (const wxCStrData&),
|
||||
DoPrintfWchar, DoPrintfUtf8)
|
||||
// workaround for http://bugzilla.openwatcom.org/show_bug.cgi?id=351
|
||||
WX_VARARG_WATCOM_WORKAROUND(int, Printf, 1, (const wxString&),
|
||||
(wxFormatString(f1)));
|
||||
WX_VARARG_WATCOM_WORKAROUND(int, Printf, 1, (const wxCStrData&),
|
||||
(wxFormatString(f1)));
|
||||
WX_VARARG_WATCOM_WORKAROUND(int, Printf, 1, (const char*),
|
||||
(wxFormatString(f1)));
|
||||
WX_VARARG_WATCOM_WORKAROUND(int, Printf, 1, (const wchar_t*),
|
||||
(wxFormatString(f1)));
|
||||
#endif
|
||||
#endif // !wxNEEDS_WXSTRING_PRINTF_MIXIN
|
||||
// as vprintf(), returns the number of characters written or < 0 on error
|
||||
@@ -1597,12 +1600,14 @@ public:
|
||||
DoFormatWchar, DoFormatUtf8)
|
||||
#ifdef __WATCOMC__
|
||||
// workaround for http://bugzilla.openwatcom.org/show_bug.cgi?id=351
|
||||
WX_DEFINE_VARARG_FUNC(static wxString, Format, 1, (const char*),
|
||||
DoFormatWchar, DoFormatUtf8)
|
||||
WX_DEFINE_VARARG_FUNC(static wxString, Format, 1, (const wchar_t*),
|
||||
DoFormatWchar, DoFormatUtf8)
|
||||
WX_DEFINE_VARARG_FUNC(static wxString, Format, 1, (const wxCStrData&),
|
||||
DoFormatWchar, DoFormatUtf8)
|
||||
WX_VARARG_WATCOM_WORKAROUND(static wxString, Format, 1, (const wxString&),
|
||||
(wxFormatString(f1)));
|
||||
WX_VARARG_WATCOM_WORKAROUND(static wxString, Format, 1, (const wxCStrData&),
|
||||
(wxFormatString(f1)));
|
||||
WX_VARARG_WATCOM_WORKAROUND(static wxString, Format, 1, (const char*),
|
||||
(wxFormatString(f1)));
|
||||
WX_VARARG_WATCOM_WORKAROUND(static wxString, Format, 1, (const wchar_t*),
|
||||
(wxFormatString(f1)));
|
||||
#endif
|
||||
#endif
|
||||
// the same as above, but takes a va_list
|
||||
@@ -1644,12 +1649,14 @@ public:
|
||||
DoPrintfWchar, DoPrintfUtf8)
|
||||
#ifdef __WATCOMC__
|
||||
// workaround for http://bugzilla.openwatcom.org/show_bug.cgi?id=351
|
||||
WX_DEFINE_VARARG_FUNC(int, sprintf, 1, (const char*),
|
||||
DoPrintfWchar, DoPrintfUtf8)
|
||||
WX_DEFINE_VARARG_FUNC(int, sprintf, 1, (const wchar_t*),
|
||||
DoPrintfWchar, DoPrintfUtf8)
|
||||
WX_DEFINE_VARARG_FUNC(int, sprintf, 1, (const wxCStrData&),
|
||||
DoPrintfWchar, DoPrintfUtf8)
|
||||
WX_VARARG_WATCOM_WORKAROUND(int, sprintf, 1, (const wxString&),
|
||||
(wxFormatString(f1)));
|
||||
WX_VARARG_WATCOM_WORKAROUND(int, sprintf, 1, (const wxCStrData&),
|
||||
(wxFormatString(f1)));
|
||||
WX_VARARG_WATCOM_WORKAROUND(int, sprintf, 1, (const char*),
|
||||
(wxFormatString(f1)));
|
||||
WX_VARARG_WATCOM_WORKAROUND(int, sprintf, 1, (const wchar_t*),
|
||||
(wxFormatString(f1)));
|
||||
#endif
|
||||
#endif // wxNEEDS_WXSTRING_PRINTF_MIXIN
|
||||
|
||||
|
@@ -732,4 +732,65 @@ private:
|
||||
inline void name(_WX_VARARG_FIXED_UNUSED_EXPAND(numfixed, fixed)) \
|
||||
{}
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// workaround for OpenWatcom bug #351
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#ifdef __WATCOMC__
|
||||
// workaround for http://bugzilla.openwatcom.org/show_bug.cgi?id=351
|
||||
|
||||
// This macro can be used to forward a 'vararg' template to another one with
|
||||
// different fixed arguments types. Parameters are same as for
|
||||
// WX_DEFINE_VARARG_FUNC (rettype=void can be used here), 'convfixed' is how
|
||||
// to convert fixed arguments. For example, this is typical code for dealing
|
||||
// with different forms of format string:
|
||||
//
|
||||
// WX_DEFINE_VARARG_FUNC_VOID(Printf, 1, (const wxFormatString&),
|
||||
// DoPrintfWchar, DoPrintfUtf8)
|
||||
// #ifdef __WATCOMC__
|
||||
// WX_VARARG_WATCOM_WORKAROUND(void, Printf, 1, (const wxString&),
|
||||
// (wxFormatString(f1)))
|
||||
// WX_VARARG_WATCOM_WORKAROUND(void, Printf, 1, (const char*),
|
||||
// (wxFormatString(f1)))
|
||||
// ...
|
||||
#define WX_VARARG_WATCOM_WORKAROUND(rettype, name, numfixed, fixed, convfixed)\
|
||||
_WX_VARARG_ITER(_WX_VARARG_MAX_ARGS, \
|
||||
_WX_VARARG_WATCOM_WORKAROUND, \
|
||||
rettype, name, convfixed, dummy, numfixed, fixed)
|
||||
|
||||
#define WX_VARARG_WATCOM_WORKAROUND_CTOR(name, numfixed, fixed, convfixed) \
|
||||
_WX_VARARG_ITER(_WX_VARARG_MAX_ARGS, \
|
||||
_WX_VARARG_WATCOM_WORKAROUND_CTOR, \
|
||||
dummy, name, convfixed, dummy, numfixed, fixed)
|
||||
|
||||
#define _WX_VARARG_WATCOM_UNPACK_1(a1) a1
|
||||
#define _WX_VARARG_WATCOM_UNPACK_2(a1, a2) a1, a2
|
||||
#define _WX_VARARG_WATCOM_UNPACK_3(a1, a2, a3) a1, a2, a3
|
||||
#define _WX_VARARG_WATCOM_UNPACK_4(a1, a2, a3, a4) a1, a2, a3, a4
|
||||
#define _WX_VARARG_WATCOM_UNPACK(N, convfixed) \
|
||||
_WX_VARARG_WATCOM_UNPACK_##N convfixed
|
||||
|
||||
#define _WX_VARARG_WATCOM_WORKAROUND(N, rettype, name, \
|
||||
convfixed, dummy, numfixed, fixed) \
|
||||
template<_WX_VARARG_JOIN(N, _WX_VARARG_TEMPL)> \
|
||||
rettype name(_WX_VARARG_FIXED_EXPAND(numfixed, fixed), \
|
||||
_WX_VARARG_JOIN(N, _WX_VARARG_ARG)) \
|
||||
{ \
|
||||
return name(_WX_VARARG_WATCOM_UNPACK(numfixed, convfixed), \
|
||||
_WX_VARARG_JOIN(N, _WX_VARARG_PASS_WCHAR)); \
|
||||
}
|
||||
|
||||
#define _WX_VARARG_WATCOM_WORKAROUND_CTOR(N, dummy1, name, \
|
||||
convfixed, dummy2, numfixed, fixed) \
|
||||
template<_WX_VARARG_JOIN(N, _WX_VARARG_TEMPL)> \
|
||||
name(_WX_VARARG_FIXED_EXPAND(numfixed, fixed), \
|
||||
_WX_VARARG_JOIN(N, _WX_VARARG_ARG)) \
|
||||
{ \
|
||||
name(_WX_VARARG_WATCOM_UNPACK(numfixed, convfixed), \
|
||||
_WX_VARARG_JOIN(N, _WX_VARARG_PASS_WCHAR)); \
|
||||
}
|
||||
|
||||
#endif // __WATCOMC__
|
||||
|
||||
#endif // _WX_STRVARARG_H_
|
||||
|
@@ -364,13 +364,13 @@ wxVsnprintf(wchar_t *str, size_t size, const wxString& format, va_list argptr);
|
||||
#undef wxSnprintf
|
||||
|
||||
#define wxPrintf(fmt, ...) \
|
||||
wxPrintf_Impl(wxString(fmt), __VA_ARGS__)
|
||||
wxPrintf_Impl(wxFormatString(fmt), __VA_ARGS__)
|
||||
#define wxFprintf(f, fmt, ...) \
|
||||
wxFprintf_Impl(f, wxString(fmt), __VA_ARGS__)
|
||||
wxFprintf_Impl(f, wxFormatString(fmt), __VA_ARGS__)
|
||||
#define wxSprintf(s, fmt, ...) \
|
||||
wxSprintf_Impl(s, wxString(fmt), __VA_ARGS__)
|
||||
wxSprintf_Impl(s, wxFormatString(fmt), __VA_ARGS__)
|
||||
#define wxSnprintf(s, n, fmt, ...) \
|
||||
wxSnprintf_Impl(s, n, wxString(fmt), __VA_ARGS__)
|
||||
wxSnprintf_Impl(s, n, wxFormatString(fmt), __VA_ARGS__)
|
||||
#endif // __WATCOMC__
|
||||
|
||||
|
||||
|
@@ -337,7 +337,7 @@ void wxDoLogVerboseUtf8(const char *format, ...)
|
||||
|
||||
#ifdef __WATCOMC__
|
||||
// workaround for http://bugzilla.openwatcom.org/show_bug.cgi?id=351
|
||||
void wxDoLogTrace(int mask, const wxChar *format, ...)
|
||||
void wxDoLogTraceWchar(int mask, const wxChar *format, ...)
|
||||
{
|
||||
va_list argptr;
|
||||
va_start(argptr, format);
|
||||
@@ -345,7 +345,7 @@ void wxDoLogVerboseUtf8(const char *format, ...)
|
||||
va_end(argptr);
|
||||
}
|
||||
|
||||
void wxDoLogTrace(const char *mask, const wxChar *format, ...)
|
||||
void wxDoLogTraceWchar(const char *mask, const wxChar *format, ...)
|
||||
{
|
||||
va_list argptr;
|
||||
va_start(argptr, format);
|
||||
@@ -353,7 +353,7 @@ void wxDoLogVerboseUtf8(const char *format, ...)
|
||||
va_end(argptr);
|
||||
}
|
||||
|
||||
void wxDoLogTrace(const wchar_t *mask, const wxChar *format, ...)
|
||||
void wxDoLogTraceWchar(const wchar_t *mask, const wxChar *format, ...)
|
||||
{
|
||||
va_list argptr;
|
||||
va_start(argptr, format);
|
||||
@@ -441,7 +441,7 @@ void WXDLLEXPORT wxDoLogSysErrorUtf8(long lErrCode, const char *format, ...)
|
||||
|
||||
#ifdef __WATCOMC__
|
||||
// workaround for http://bugzilla.openwatcom.org/show_bug.cgi?id=351
|
||||
void WXDLLEXPORT wxDoLogSysError(unsigned long lErrCode, const wxChar *format, ...)
|
||||
void WXDLLEXPORT wxDoLogSysErrorWchar(unsigned long lErrCode, const wxChar *format, ...)
|
||||
{
|
||||
va_list argptr;
|
||||
va_start(argptr, format);
|
||||
@@ -449,7 +449,7 @@ void WXDLLEXPORT wxDoLogSysError(unsigned long lErrCode, const wxChar *format, .
|
||||
va_end(argptr);
|
||||
}
|
||||
|
||||
void WXDLLEXPORT wxVLogSysError(unsigned long err, const wxChar *format, va_list argptr)
|
||||
void WXDLLEXPORT wxVLogSysError(unsigned long err, const wxString& format, va_list argptr)
|
||||
{ wxVLogSysError((long)err, format, argptr); }
|
||||
#endif // __WATCOMC__
|
||||
|
||||
|
Reference in New Issue
Block a user