diff options
author | Simon McVittie <smcv@collabora.com> | 2018-11-16 16:21:48 +0000 |
---|---|---|
committer | Simon McVittie <smcv@collabora.com> | 2018-11-19 11:27:25 +0000 |
commit | f33038bc1b195c91aa70bad405cab4eaf366caea (patch) | |
tree | ff97119e644d449155f9014a00cb14aa80749a29 /cmake | |
parent | dab4a12e0e556a5a3c88abfdd83e55cab465b79c (diff) | |
download | dbus-f33038bc1b195c91aa70bad405cab4eaf366caea.tar.gz |
build: Require va_copy() or __va_copy() on non-MSVC compilers
va_copy() is a C99 feature, and should be widely supported by now.
gcc in strict C89 mode implements an equivalent __va_copy() instead.
MSVC 2013 implements va_copy(), but at the moment we still aim to support
MSVC 2010 and 2012, which don't have it. However, we know that in
Windows ABIs, va_list is a pointer, so we can use
_DBUS_VA_COPY_ASSIGN. We do not support MSVC for Autotools builds, only
CMake, due to its non-Unixish command-line interface.
Signed-off-by: Simon McVittie <smcv@collabora.com>
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/ConfigureChecks.cmake | 20 | ||||
-rw-r--r-- | cmake/config.h.cmake | 3 |
2 files changed, 1 insertions, 22 deletions
diff --git a/cmake/ConfigureChecks.cmake b/cmake/ConfigureChecks.cmake index 1144e93d..21346a24 100644 --- a/cmake/ConfigureChecks.cmake +++ b/cmake/ConfigureChecks.cmake @@ -121,25 +121,7 @@ elseif(MSVC) # this is used for msvc < 2013 set(DBUS_VA_COPY _DBUS_VA_COPY_ASSIGN) else() - CHECK_C_SOURCE_RUNS(" - #include <stdarg.h> - #include <stdlib.h> - static void f (int i, ...) { - va_list args1, args2; - va_start (args1, i); - args2 = args1; - if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42) - exit (1); - va_end (args1); va_end (args2); - } - int main() { - f (0, 42); - return 0; - } - " VA_COPY_AS_ARRAY) - if (NOT VA_COPY_AS_ARRAY) - set(DBUS_VA_COPY_AS_ARRAY 1 CACHE STRING "Set to 1 if va_list cannot be copied as a value") - endif() + message(FATAL_ERROR "dbus requires an ISO C99-compatible va_copy() macro, or a similar __va_copy(), or MSVC >= 2010") endif() CHECK_C_SOURCE_COMPILES(" diff --git a/cmake/config.h.cmake b/cmake/config.h.cmake index d2238816..6ca77675 100644 --- a/cmake/config.h.cmake +++ b/cmake/config.h.cmake @@ -71,9 +71,6 @@ /* for msvc */ #define _DBUS_VA_COPY_ASSIGN(a1,a2) { a1 = a2; } -/* Define if va_list cannot be copied as a value */ -#cmakedefine DBUS_VA_COPY_AS_ARRAY 1 - #cmakedefine DBUS_WITH_GLIB 1 #cmakedefine GLIB_VERSION_MIN_REQUIRED @GLIB_VERSION_MIN_REQUIRED@ #cmakedefine GLIB_VERSION_MAX_ALLOWED @GLIB_VERSION_MAX_ALLOWED@ |