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 f3829cc..7b9d310 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 4c63f98..782dfba 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 efc1cfb..fda334a 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