Skip to content

Don't check how to copy a va_list if we have va_copy; only use _DBUS_VA_COPY_ASSIGN on MSVC

Simon McVittie requested to merge smcv/dbus:va-copy into master

If we already have ISO C va_copy() or its non-standard counterpart __va_copy(), then there's no need to do an AC_RUN_IFELSE or its CMake equivalent to detect whether "args2 = args1" or "*args2 = *args1" works. AC_RUN_IFELSE is problematic during cross-compilation, where the program cannot be run (you have to know in advance that the test program will be run and what its result will be), so we want to avoid it whenever possible. In particular, this caused https://gitlab.freedesktop.org/dbus/dbus/-/jobs/44508 and https://gitlab.freedesktop.org/dbus/dbus/-/jobs/44510 to fail.

While fixing that, I noticed that the CMake build system uses _DBUS_VA_COPY_ASSIGN to implement va_copy() whenever no va_copy() or __va_copy() is available, ignoring the result of the check for DBUS_VA_COPY_AS_ARRAY. Restrict this behaviour to be specific to MSVC.

Merge request reports