On Tue, Oct 15, 2013 at 2:18 AM, Peter Eisentraut <pete...@gmx.net> wrote: > On Mon, 2013-10-14 at 23:08 +1300, David Rowley wrote: > >> >> Looks like something like: >> >> >> #ifndef WIN32 >> #define HAVE_VA_COPY 1 >> #endif >> >> >> would need to be added to asprintf.c, but also some work needs to be >> done with mcxt.c as it uses va_copy unconditionally. Perhaps just >> defining a macro for va_copy would be better for windows. I was not >> quite sure the best header file for such a macro so I did not write a >> patch to fix it. > > Does Windows not have va_copy? What do they use instead?
No, Windows doesn't have va_copy, instead they use something like below: #define va_copy(dest, src) (dest = src) Please refer below link for details of porting va_copy() on Windows: http://stackoverflow.com/questions/558223/va-copy-porting-to-visual-c I could see that there is similar handling in code of vasprintf(), such that if va_copy is not available then directly assign src to dst. #if defined(HAVE_VA_COPY) va_copy(ap2, ap); #define my_va_end(ap2) va_end(ap2) #elif defined(HAVE___BUILTIN_VA_COPY) __builtin_va_copy(ap2, ap); #define my_va_end(ap2) __builtin_va_end(ap2) #else ap2 = ap; #define my_va_end(ap2) do {} while (0) #endif I think rather than having writing code like above at places where va_copy is used, we can use something like: #ifdef WIN32 #define va_copy(dest, src) (dest = src) #endif and define HAVE_VA_COPY to 1 for non-windows platform. With Regards, Amit Kapila. EnterpriseDB: http://www.enterprisedb.com -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers