Copy va_lists by using va_copy, not by just assigning them.

This commit is contained in:
Marcus Meissner 2002-08-09 19:49:31 +00:00 committed by Alexandre Julliard
parent edeee89c3e
commit 5ee517ac3d
4 changed files with 162 additions and 1 deletions

113
configure vendored
View File

@ -8586,6 +8586,119 @@ _ACEOF
fi
echo "$as_me:$LINENO: checking for va_copy" >&5
echo $ECHO_N "checking for va_copy... $ECHO_C" >&6
if test "${ac_cv_c_va_copy+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
#include "confdefs.h"
#include <stdarg.h>
#ifdef F77_DUMMY_MAIN
# ifdef __cplusplus
extern "C"
# endif
int F77_DUMMY_MAIN() { return 1; }
#endif
int
main ()
{
va_list ap1, ap2;
va_copy(ap1,ap2);
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_c_va_copy="yes"
else
echo "$as_me: failed program was:" >&5
cat conftest.$ac_ext >&5
ac_cv_c_va_copy="no"
fi
rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
fi
echo "$as_me:$LINENO: result: $ac_cv_c_va_copy" >&5
echo "${ECHO_T}$ac_cv_c_va_copy" >&6
if test "$ac_cv_c_va_copy" = "yes"
then
cat >>confdefs.h <<\_ACEOF
#define HAVE_VA_COPY 1
_ACEOF
fi
echo "$as_me:$LINENO: checking for __va_copy" >&5
echo $ECHO_N "checking for __va_copy... $ECHO_C" >&6
if test "${ac_cv_c___va_copy+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
#include "confdefs.h"
#include <stdarg.h>
#ifdef F77_DUMMY_MAIN
# ifdef __cplusplus
extern "C"
# endif
int F77_DUMMY_MAIN() { return 1; }
#endif
int
main ()
{
va_list ap1, ap2;
__va_copy(ap1,ap2);
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_c___va_copy="yes"
else
echo "$as_me: failed program was:" >&5
cat conftest.$ac_ext >&5
ac_cv_c___va_copy="no"
fi
rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
fi
echo "$as_me:$LINENO: result: $ac_cv_c___va_copy" >&5
echo "${ECHO_T}$ac_cv_c___va_copy" >&6
if test "$ac_cv_c___va_copy" = "yes"
then
cat >>confdefs.h <<\_ACEOF
#define HAVE___VA_COPY 1
_ACEOF
fi
echo "$as_me:$LINENO: checking for GNU style IPX support" >&5
echo $ECHO_N "checking for GNU style IPX support... $ECHO_C" >&6
if test "${ac_cv_c_ipx_gnu+set}" = set; then

View File

@ -447,6 +447,34 @@ then
AC_DEFINE(HAVE_PPDEV, 1, [Define if we can use ppdev.h for parallel port access])
fi
dnl **** Check for va_copy ****
AC_CACHE_CHECK([for va_copy], ac_cv_c_va_copy,
AC_TRY_LINK(
[#include <stdarg.h>],
[va_list ap1, ap2;
va_copy(ap1,ap2);
],
[ac_cv_c_va_copy="yes"],
[ac_cv_c_va_copy="no"])
)
if test "$ac_cv_c_va_copy" = "yes"
then
AC_DEFINE(HAVE_VA_COPY, 1, [Define if we have va_copy])
fi
AC_CACHE_CHECK([for __va_copy], ac_cv_c___va_copy,
AC_TRY_LINK(
[#include <stdarg.h>],
[va_list ap1, ap2;
__va_copy(ap1,ap2);
],
[ac_cv_c___va_copy="yes"],
[ac_cv_c___va_copy="no"])
)
if test "$ac_cv_c___va_copy" = "yes"
then
AC_DEFINE(HAVE___VA_COPY, 1, [Define if we have __va_copy])
fi
dnl **** Check for IPX (currently Linux only) ****
AC_CACHE_CHECK([for GNU style IPX support], ac_cv_c_ipx_gnu,
AC_TRY_COMPILE(

View File

@ -25,6 +25,10 @@
* open file handles, sometimes not. The docs are confusing
* -No check for maximum path/argument/environment size is done
*/
#include "config.h"
#include <stdarg.h>
#include "msvcrt.h"
#include "ms_errno.h"
@ -141,12 +145,22 @@ static char* msvcrt_argvtos(const char* const* arg, char delim)
*/
static char* msvcrt_valisttos(const char* arg0, va_list alist, char delim)
{
va_list alist2 = alist;
va_list alist2;
long size;
const char *arg;
char* p;
char *ret;
#if HAVE_VA_COPY
va_copy(alist2,alist);
#else
# if HAVE___VA_COPY
__va_copy(alist2,alist);
# else
alist2 = alist;
# endif
#endif
if (!arg0 && !delim)
{
/* Return NULL for an empty environment list */

View File

@ -575,6 +575,9 @@
/* Define to 1 if you have the `usleep' function. */
#undef HAVE_USLEEP
/* Define if we have va_copy */
#undef HAVE_VA_COPY
/* Define to 1 if you have the `vfscanf' function. */
#undef HAVE_VFSCANF
@ -638,6 +641,9 @@
/* Define to 1 if you have the `__libc_fork' function. */
#undef HAVE___LIBC_FORK
/* Define if we have __va_copy */
#undef HAVE___VA_COPY
/* Define if stdcall symbols need to be decorated */
#undef NEED_STDCALL_DECORATION