diff options
author | Simon McVittie <smcv@collabora.com> | 2018-11-15 18:55:57 +0000 |
---|---|---|
committer | Simon McVittie <smcv@collabora.com> | 2018-11-15 18:55:57 +0000 |
commit | f93b63587f7f88b65eeb837882432e3db1e97176 (patch) | |
tree | 0b5c1c31ddb8722e5f9b4497885ad33ee4eaa1a7 | |
parent | a6674bff178a812d4109a745ff5a4167b5d5c1e6 (diff) | |
download | dbus-f93b63587f7f88b65eeb837882432e3db1e97176.tar.gz |
internals: Assume compiler supports a subset of ISO varargs syntax
We have considerable anecdotal evidence that every relevant compiler
supports at least the small part of ISO varargs syntax that we need
here, because tools/tool-common.h has contained
#define VERBOSE(...) do {} while (0)
since dbus 1.9.2 (2014) and nobody has complained yet. With that in
mind, let's simplify.
Signed-off-by: Simon McVittie <smcv@collabora.com>
-rw-r--r-- | cmake/CMakeLists.txt | 5 | ||||
-rw-r--r-- | cmake/ConfigureChecks.cmake | 22 | ||||
-rw-r--r-- | cmake/config.h.cmake | 6 | ||||
-rw-r--r-- | configure.ac | 29 | ||||
-rw-r--r-- | dbus/dbus-internals.h | 8 |
5 files changed, 1 insertions, 69 deletions
diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 53fa4561..ba905612 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -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}) diff --git a/cmake/ConfigureChecks.cmake b/cmake/ConfigureChecks.cmake index 8f2ad315..310b1bbb 100644 --- a/cmake/ConfigureChecks.cmake +++ b/cmake/ConfigureChecks.cmake @@ -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) diff --git a/cmake/config.h.cmake b/cmake/config.h.cmake index 9dbda5a9..d2238816 100644 --- a/cmake/config.h.cmake +++ b/cmake/config.h.cmake @@ -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@" diff --git a/configure.ac b/configure.ac index 916633d8..89337836 100644 --- a/configure.ac +++ b/configure.ac @@ -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([[ diff --git a/dbus/dbus-internals.h b/dbus/dbus-internals.h index ae9ab626..5120ab9a 100644 --- a/dbus/dbus-internals.h +++ b/dbus/dbus-internals.h @@ -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 */ |