mirror of
https://gitlab.freedesktop.org/dbus/dbus.git
synced 2026-04-30 22:38:06 +02:00
Merge branch 'va-copy' into 'master'
Don't check how to copy a va_list if we have va_copy; only use _DBUS_VA_COPY_ASSIGN on MSVC See merge request dbus/dbus!35 Reviewed-by: rhabacker
This commit is contained in:
commit
867c9bbe2e
6 changed files with 10 additions and 75 deletions
|
|
@ -111,7 +111,6 @@ build:x86_64-w64-mingw32:
|
|||
|
||||
build:x86_64-w64-mingw32-cmake-debug:
|
||||
stage: build
|
||||
when: manual
|
||||
image: "debian:stretch-slim"
|
||||
variables:
|
||||
ci_buildsys: "cmake"
|
||||
|
|
|
|||
4
NEWS
4
NEWS
|
|
@ -14,6 +14,10 @@ Dependencies:
|
|||
MSVC >= 2005. In practice this requirement has existed since version
|
||||
1.9.2, but it is now official.
|
||||
|
||||
• dbus now requires a C99-compatible va_copy() macro (or a __va_copy()
|
||||
macro with the same behaviour), except when building for Windows using
|
||||
MSVC and CMake.
|
||||
|
||||
Enhancements:
|
||||
|
||||
• Rewrite CONTRIBUTING.md to reflect the current setup
|
||||
|
|
|
|||
|
|
@ -117,29 +117,11 @@ if(HAVE_VA_COPY)
|
|||
set(DBUS_VA_COPY va_copy CACHE STRING "va_copy function")
|
||||
elseif(HAVE___VA_COPY)
|
||||
set(DBUS_VA_COPY __va_copy CACHE STRING "va_copy function")
|
||||
else()
|
||||
elseif(MSVC)
|
||||
# this is used for msvc < 2013
|
||||
set(DBUS_VA_COPY _DBUS_VA_COPY_ASSIGN)
|
||||
endif()
|
||||
|
||||
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")
|
||||
else()
|
||||
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("
|
||||
|
|
|
|||
|
|
@ -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@
|
||||
|
|
|
|||
39
configure.ac
39
configure.ac
|
|
@ -563,42 +563,9 @@ else if test "x$dbus_cv___va_copy" = "xyes"; then
|
|||
fi
|
||||
fi
|
||||
|
||||
if test -n "$dbus_va_copy_func"; then
|
||||
AC_DEFINE_UNQUOTED(DBUS_VA_COPY,$dbus_va_copy_func,[A 'va_copy' style function])
|
||||
fi
|
||||
|
||||
AC_LANG_PUSH(C)
|
||||
AC_CACHE_CHECK([whether va_lists can be copied by value],
|
||||
dbus_cv_va_val_copy,
|
||||
[AC_RUN_IFELSE([AC_LANG_PROGRAM(
|
||||
[[
|
||||
#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;
|
||||
}
|
||||
]])],
|
||||
[dbus_cv_va_val_copy=yes],
|
||||
[dbus_cv_va_val_copy=no],
|
||||
[dbus_cv_va_val_copy=yes])
|
||||
])
|
||||
AC_LANG_POP(C)
|
||||
|
||||
if test "x$dbus_cv_va_val_copy" = "xno"; then
|
||||
AC_DEFINE(DBUS_VA_COPY_AS_ARRAY,1, ['va_lists' cannot be copies as values])
|
||||
fi
|
||||
|
||||
AS_IF([test -n "$dbus_va_copy_func"],
|
||||
[AC_DEFINE_UNQUOTED([DBUS_VA_COPY], [$dbus_va_copy_func], [A 'va_copy' style function])],
|
||||
[AC_MSG_ERROR([dbus requires an ISO C99-compatible va_copy() macro, or a compatible __va_copy(), or MSVC >= 2010 and CMake])])
|
||||
|
||||
#### Atomic integers
|
||||
|
||||
|
|
|
|||
|
|
@ -614,20 +614,6 @@ void _dbus_logv (DBusSystemLogSeverity severity,
|
|||
const char *msg,
|
||||
va_list args) _DBUS_GNUC_PRINTF (2, 0);
|
||||
|
||||
/* Define DBUS_VA_COPY() to do the right thing for copying va_list variables.
|
||||
* config.h may have already defined DBUS_VA_COPY as va_copy or __va_copy.
|
||||
*/
|
||||
#if !defined (DBUS_VA_COPY)
|
||||
# if defined (__GNUC__) && defined (__PPC__) && (defined (_CALL_SYSV) || defined (_WIN32))
|
||||
# define DBUS_VA_COPY(ap1, ap2) (*(ap1) = *(ap2))
|
||||
# elif defined (DBUS_VA_COPY_AS_ARRAY)
|
||||
# define DBUS_VA_COPY(ap1, ap2) memcpy ((ap1), (ap2), sizeof (va_list))
|
||||
# else /* va_list is a pointer */
|
||||
# define DBUS_VA_COPY(ap1, ap2) ((ap1) = (ap2))
|
||||
# endif /* va_list is a pointer */
|
||||
#endif /* !DBUS_VA_COPY */
|
||||
|
||||
|
||||
/**
|
||||
* Casts a primitive C type to a byte array and then indexes
|
||||
* a particular byte of the array.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue