added tests for va_copy and va_list
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@29605 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
d85cfb3784
commit
8fa53e0eee
59
configure.in
59
configure.in
@ -1713,6 +1713,65 @@ AC_CACHE_CHECK([size of wchar_t], wx_cv_sizeof_wchar_t,
|
||||
|
||||
AC_DEFINE_UNQUOTED(SIZEOF_WCHAR_T, $wx_cv_sizeof_wchar_t)
|
||||
|
||||
dnl checks needed to define wxVaCopy
|
||||
AC_CACHE_CHECK([for va_copy],
|
||||
wx_cv_func_va_copy,
|
||||
[
|
||||
AC_COMPILE_IFELSE([
|
||||
#include <stdarg.h>
|
||||
void foo(char *f, ...)
|
||||
{
|
||||
va_list ap1, ap2;
|
||||
va_start(ap1, f);
|
||||
va_copy(ap2, ap1);
|
||||
va_end(ap2);
|
||||
va_end(ap1);
|
||||
}],
|
||||
wx_cv_func_va_copy=yes,
|
||||
wx_cv_func_va_copy=no
|
||||
)
|
||||
]
|
||||
)
|
||||
|
||||
if test $wx_cv_func_va_copy = "yes"; then
|
||||
AC_DEFINE(HAVE_VA_COPY)
|
||||
else
|
||||
dnl try to understand how can we copy va_lists
|
||||
AC_CACHE_CHECK([if va_list can be copied by value],
|
||||
wx_cv_type_va_list_lvalue,
|
||||
[
|
||||
AC_RUN_IFELSE([
|
||||
#include <stdarg.h>
|
||||
int foo(char *f, ...)
|
||||
{
|
||||
va_list ap1, ap2;
|
||||
va_start(ap1, f);
|
||||
ap2 = ap1;
|
||||
if ( va_arg(ap1, int) != 17 || va_arg(ap2, int) != 17 )
|
||||
return 1;
|
||||
va_end(ap2);
|
||||
va_end(ap1);
|
||||
return 0;
|
||||
}
|
||||
int main()
|
||||
{
|
||||
return foo("hi", 17);
|
||||
}],
|
||||
wx_cv_type_va_list_lvalue=yes,
|
||||
wx_cv_type_va_list_lvalue=no,
|
||||
dnl assume most common case for cross-compiling...
|
||||
wx_cv_type_va_list_lvalue=yes
|
||||
)
|
||||
]
|
||||
)
|
||||
|
||||
if test $wx_cv_type_va_list_lvalue != "yes"; then
|
||||
dnl we suppose that the only thing which can't be copied like this
|
||||
dnl are arrays... only experience will show whether this is really true
|
||||
AC_DEFINE(VA_LIST_IS_ARRAY)
|
||||
fi
|
||||
fi
|
||||
|
||||
dnl check for large file support
|
||||
AC_SYS_LARGEFILE
|
||||
|
||||
|
10
setup.h.in
10
setup.h.in
@ -173,6 +173,16 @@
|
||||
*/
|
||||
#undef HAVE_STATIC_CAST
|
||||
|
||||
/*
|
||||
* Define if your compiler has C99 va_copy
|
||||
*/
|
||||
#undef HAVE_VA_COPY
|
||||
|
||||
/*
|
||||
* Define if va_list type is an array
|
||||
*/
|
||||
#undef VA_LIST_IS_ARRAY
|
||||
|
||||
/*
|
||||
* Define if your compiler has std::wstring
|
||||
*/
|
||||
|
10
setup.h_vms
10
setup.h_vms
@ -182,6 +182,16 @@
|
||||
*/
|
||||
#define HAVE_STATIC_CAST 1
|
||||
|
||||
/*
|
||||
* Define if your compiler has C99 va_copy
|
||||
*/
|
||||
#undef HAVE_VA_COPY
|
||||
|
||||
/*
|
||||
* Define if va_list type is an array
|
||||
*/
|
||||
#undef VA_LIST_IS_ARRAY
|
||||
|
||||
/*
|
||||
* Define if your compiler has std::wstring
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user