From: Chengwei Yang Date: Tue, 25 Jun 2013 07:42:23 +0000 (+0800) Subject: Explicitly define macros to get less confusing conditions X-Git-Tag: dbus-1.7.6~167 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e632ceab0acc280bf1163dcde1853495599868e2;p=thirdparty%2Fdbus.git Explicitly define macros to get less confusing conditions Bug: https://bugs.freedesktop.org/show_bug.cgi?id=65990 Signed-off-by: Chengwei Yang Reviewed-by: Simon McVittie --- diff --git a/cmake/config.h.cmake b/cmake/config.h.cmake index f3829cc34..7b9d3109c 100644 --- a/cmake/config.h.cmake +++ b/cmake/config.h.cmake @@ -43,7 +43,13 @@ #cmakedefine DBUS_ENABLE_ANSI 1 #cmakedefine DBUS_ENABLE_VERBOSE_MODE 1 #cmakedefine DBUS_DISABLE_ASSERT 1 +#ifndef DBUS_DISABLE_ASSERT +# define DBUS_ENABLE_ASSERT 1 +#endif #cmakedefine DBUS_DISABLE_CHECKS 1 +#ifndef DBUS_DISABLE_CHECKS +# define DBUS_ENABLE_CHECKS 1 +#endif /* xmldocs */ /* doxygen */ #cmakedefine DBUS_GCOV_ENABLED 1 diff --git a/configure.ac b/configure.ac index 4c63f982f..782dfbaee 100644 --- a/configure.ac +++ b/configure.ac @@ -297,6 +297,15 @@ if test x$enable_checks = xno; then DISABLE_UNUSED_WARNINGS="unused-label" fi +AH_BOTTOM([ +/* explicitly define these macros to get less confusing conditions */ +#ifndef DBUS_DISABLE_ASSERT +# define DBUS_ENABLE_ASSERT 1 +#endif +#ifndef DBUS_DISABLE_CHECKS +# define DBUS_ENABLE_CHECKS 1 +#endif]) + if test x$enable_userdb_cache = xyes; then AC_DEFINE(DBUS_ENABLE_USERDB_CACHE,1,[Build with caching of user data]) fi diff --git a/dbus/dbus-connection.c b/dbus/dbus-connection.c index efc1cfbd9..fda334a47 100644 --- a/dbus/dbus-connection.c +++ b/dbus/dbus-connection.c @@ -337,7 +337,7 @@ struct DBusConnection unsigned int have_connection_lock : 1; /**< Used to check locking */ #endif -#if !defined(DBUS_DISABLE_CHECKS) || !defined(DBUS_DISABLE_ASSERT) +#if defined(DBUS_ENABLE_CHECKS) || defined(DBUS_ENABLE_ASSERT) int generation; /**< _dbus_current_generation that should correspond to this connection */ #endif }; @@ -1354,7 +1354,7 @@ _dbus_connection_new_for_transport (DBusTransport *transport) connection->disconnected_message_arrived = FALSE; connection->disconnected_message_processed = FALSE; -#if !defined(DBUS_DISABLE_CHECKS) || !defined(DBUS_DISABLE_ASSERT) +#if defined(DBUS_ENABLE_CHECKS) || defined(DBUS_ENABLE_ASSERT) connection->generation = _dbus_current_generation; #endif