__ms_va_list and NULL

André Hentschel nerv at dawncrow.de
Tue May 10 13:02:20 CDT 2011


Hi Piotr and folks,
Most ARM crosscompilers (can't test with a native ARM one right now) don't like using NULL for a va_list and i'm not the only one seeing this issue.
Piotr, i think that's your code, so maybe you can tell if it needs to be tuned or if that is a bug in the compiler (as the normal x86(_64) gcc works here).
I hacked around that issue and attached the patch for documentation purpose, at least it compiles fine, don't know if it runs.

without that patch:
arm-linux-gnueabi-gcc -c -I. -I. -I../../include -I../../include  -D__WINESRC__ -D_MT -D_REENTRANT -fPIC -Wall -pipe -fno-strength-reduce -fno-strict-aliasing -Wdeclaration-after-statement -Wempty-body -Wstrict-prototypes -Wtype-limits -Wwrite-strings -Wpointer-arith  -g -O2  -o wcs.o wcs.c
In file included from wcs.c:38:
printf.h: In function ‘create_positional_ctx_a’:
printf.h:610: error: incompatible type for argument 9 of ‘pf_printf_a’
printf.h:338: note: expected ‘va_list’ but argument is of type ‘void *’
In file included from wcs.c:40:
printf.h: In function ‘create_positional_ctx_w’:
printf.h:610: error: incompatible type for argument 9 of ‘pf_printf_w’
printf.h:338: note: expected ‘va_list’ but argument is of type ‘void *’
wcs.c: In function ‘MSVCRT_vsprintf_p_l’:
wcs.c:886: error: incompatible type for argument 9 of ‘pf_printf_a’
printf.h:338: note: expected ‘va_list’ but argument is of type ‘void *’
wcs.c: In function ‘MSVCRT_vswprintf_p_l’:
wcs.c:940: error: incompatible type for argument 9 of ‘pf_printf_w’
printf.h:338: note: expected ‘va_list’ but argument is of type ‘void *’
make: *** [wcs.o] Fehler 1


--

diff --git a/dlls/msvcrt/printf.h b/dlls/msvcrt/printf.h
index 64d159e..4267133 100644
--- a/dlls/msvcrt/printf.h
+++ b/dlls/msvcrt/printf.h
@@ -605,9 +605,10 @@ static int FUNC_NAME(create_positional_ctx)(void *args_ctx, const APICHAR *forma
     struct FUNC_NAME(_str_ctx) puts_ctx = {INT_MAX, NULL};
     printf_arg *args = args_ctx;
     int i, j;
+    __ms_va_list empty = {0};
 
     i = FUNC_NAME(pf_printf)(FUNC_NAME(puts_clbk_str), &puts_ctx, format, NULL, TRUE, FALSE,
-            arg_clbk_type, args_ctx, NULL);
+            arg_clbk_type, args_ctx, empty);
     if(i < 0)
         return i;
 
diff --git a/dlls/msvcrt/wcs.c b/dlls/msvcrt/wcs.c
index 2f2c140..f60cf75 100644
--- a/dlls/msvcrt/wcs.c
+++ b/dlls/msvcrt/wcs.c
@@ -870,6 +870,7 @@ int CDECL MSVCRT_vsprintf_p_l(char *buffer, MSVCRT_size_t length, const char *fo
     printf_arg args_ctx[MSVCRT__ARGMAX+1];
     struct _str_ctx_a puts_ctx = {length, buffer};
     int ret;
+    __ms_va_list empty = {0};
 
     memset(args_ctx, 0, sizeof(args_ctx));
 
@@ -883,7 +884,7 @@ int CDECL MSVCRT_vsprintf_p_l(char *buffer, MSVCRT_size_t length, const char *fo
                 arg_clbk_valist, NULL, args);
     else
         ret = pf_printf_a(puts_clbk_str_a, &puts_ctx, format, locale, TRUE, TRUE,
-                arg_clbk_positional, args_ctx, NULL);
+                arg_clbk_positional, args_ctx, empty);
 
     puts_clbk_str_a(&puts_ctx, 1, &nullbyte);
     return ret;
@@ -924,6 +925,7 @@ int CDECL MSVCRT_vswprintf_p_l(MSVCRT_wchar_t *buffer, MSVCRT_size_t length,
     printf_arg args_ctx[MSVCRT__ARGMAX+1];
     struct _str_ctx_w puts_ctx = {length, buffer};
     int ret;
+    __ms_va_list empty = {0};
 
     memset(args_ctx, 0, sizeof(args_ctx));
 
@@ -937,7 +939,7 @@ int CDECL MSVCRT_vswprintf_p_l(MSVCRT_wchar_t *buffer, MSVCRT_size_t length,
                 arg_clbk_valist, NULL, args);
     else
         ret = pf_printf_w(puts_clbk_str_w, &puts_ctx, format, locale, TRUE, TRUE,
-                arg_clbk_positional, args_ctx, NULL);
+                arg_clbk_positional, args_ctx, empty);
 
     puts_clbk_str_w(&puts_ctx, 1, &nullbyte);
     return ret;

-- 

Best Regards, André Hentschel



More information about the wine-devel mailing list