Explicitly define macros to get less confusing conditions
authorChengwei Yang <chengwei.yang@intel.com>
Tue, 25 Jun 2013 07:42:23 +0000 (15:42 +0800)
committerSimon McVittie <simon.mcvittie@collabora.co.uk>
Tue, 25 Jun 2013 11:26:59 +0000 (12:26 +0100)
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=65990
Signed-off-by: Chengwei Yang <chengwei.yang@intel.com>
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
cmake/config.h.cmake
configure.ac
dbus/dbus-connection.c

index f3829cc342cd31055bf076480a6359dbddc6a705..7b9d3109c03507945d1fb7f2ba2a7ccd1d4105f7 100644 (file)
 #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
index 4c63f982ff4d563c097cf91fb75cc71e72913f1f..782dfbaee28a3b9d98f9802d6a28153ac017cf3d 100644 (file)
@@ -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
index efc1cfbd9e4e5604e8cff5853fa0d9234d56605f..fda334a4714d54cfc57e3df1a50df4efbe854a06 100644 (file)
@@ -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