Merge branch 'iso-varargs' into 'master'

internals: Assume compiler supports a subset of ISO varargs syntax

See merge request dbus/dbus!36

Reviewed-by: rhabacker
Reviewed-by: pwithnall
This commit is contained in:
Simon McVittie 2018-11-16 11:41:32 +00:00
commit dde5844c59
5 changed files with 1 additions and 69 deletions

View file

@ -475,11 +475,6 @@ set (DBUS_DAEMON_NAME "dbus-daemon" CACHE STRING "The name of the dbus daemon ex
#include(ConfigureChecks.cmake)
# better use flags for gcc
if (MINGW)
set (HAVE_GNUC_VARARGS 1)
endif(MINGW)
# compiler definitions
add_definitions(-DHAVE_CONFIG_H)
add_definitions(${DBUS_BUS_CFLAGS})

View file

@ -176,28 +176,6 @@ if(NOT HAVE_DIRFD)
" HAVE_DDFD)
endif()
CHECK_C_SOURCE_COMPILES("
int a(int p1, int p2, int p3)
{
}
int main()
{
#define call_a(params...) a(1,params)
call_a(2,3);
}
" HAVE_GNUC_VARARGS)
CHECK_C_SOURCE_COMPILES("
int a(int p1, int p2, int p3)
{
}
int main()
{
#define call_a(...) a(1,__VA_ARGS__)
call_a(2,3);
}
" HAVE_ISO_VARARGS)
check_type_size("short" SIZEOF_SHORT)
check_type_size("int" SIZEOF_INT)
check_type_size("long" SIZEOF_LONG)

View file

@ -13,12 +13,6 @@
* should be placed in this file
*/
/* Have GNU-style varargs macros */
#cmakedefine HAVE_GNUC_VARARGS 1
/* Have ISO C99 varargs macros */
#cmakedefine HAVE_ISO_VARARGS 1
#cmakedefine DBUS_CONSOLE_AUTH_DIR "@DBUS_CONSOLE_AUTH_DIR@"
#cmakedefine DBUS_DATADIR "@DBUS_DATADIR@"
#cmakedefine DBUS_BINDIR "@DBUS_BINDIR@"

View file

@ -777,35 +777,6 @@ dnl Make it easy to check if we have MSG_NOSIGNAL without actually having to inc
AC_CHECK_DECLS([MSG_NOSIGNAL], [], [], [[ #include <sys/types.h>
#include <sys/socket.h> ]])
dnl check for flavours of varargs macros (test from GLib)
AC_MSG_CHECKING(for ISO C99 varargs macros in C)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
int a(int p1, int p2, int p3);
#define call_a(...) a(1,__VA_ARGS__)
call_a(2,3);
]])],
[dbus_have_iso_c_varargs=yes],
[dbus_have_iso_c_varargs=no])
AC_MSG_RESULT($dbus_have_iso_c_varargs)
AC_MSG_CHECKING(for GNUC varargs macros)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
int a(int p1, int p2, int p3);
#define call_a(params...) a(1,params)
call_a(2,3);
]])],
[dbus_have_gnuc_varargs=yes],
[dbus_have_gnuc_varargs=no])
AC_MSG_RESULT($dbus_have_gnuc_varargs)
dnl Output varargs tests
if test x$dbus_have_iso_c_varargs = xyes; then
AC_DEFINE(HAVE_ISO_VARARGS,1,[Have ISO C99 varargs macros])
fi
if test x$dbus_have_gnuc_varargs = xyes; then
AC_DEFINE(HAVE_GNUC_VARARGS,1,[Have GNU-style varargs macros])
fi
dnl Check for various credentials.
AC_MSG_CHECKING(for struct cmsgcred)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[

View file

@ -117,13 +117,7 @@ void _dbus_set_verbose (dbus_bool_t state);
# define _dbus_verbose_reset _dbus_verbose_reset_real
# define _dbus_is_verbose _dbus_is_verbose_real
#else
# ifdef HAVE_ISO_VARARGS
# define _dbus_verbose(...) do { } while (0)
# elif defined (HAVE_GNUC_VARARGS)
# define _dbus_verbose(format...) do { } while (0)
# else
static void _dbus_verbose(const char * x,...) {;}
# endif
# define _dbus_verbose(...) do { } while (0)
# define _dbus_verbose_reset() do { } while (0)
# define _dbus_is_verbose() FALSE
#endif /* !DBUS_ENABLE_VERBOSE_MODE */