Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Declare needed categories in XBT_LOG_CONNECT macro.
authorArnaud Giersch <arnaud.giersch@iut-bm.univ-fcomte.fr>
Wed, 28 Mar 2012 09:19:28 +0000 (11:19 +0200)
committerArnaud Giersch <arnaud.giersch@iut-bm.univ-fcomte.fr>
Wed, 28 Mar 2012 13:24:33 +0000 (15:24 +0200)
Also temporarily reactivate the assert in the non MSVC case,
to check the compilation.

include/xbt/log.h

index 79a8584..d1d7315 100644 (file)
@@ -113,12 +113,20 @@ typedef enum {
  */
 #if defined(_MSC_VER)
 # define _XBT_LOG_PARENT_INITIALIZER(parent) NULL
  */
 #if defined(_MSC_VER)
 # define _XBT_LOG_PARENT_INITIALIZER(parent) NULL
-# define XBT_LOG_CONNECT(child, parent_cat)             \
-  _XBT_LOGV(child).parent = &_XBT_LOGV(parent_cat)
+# define XBT_LOG_CONNECT(child, parent_cat)                             \
+  if (1) {                                                              \
+    XBT_LOG_EXTERNAL_CATEGORY(child);                                   \
+    XBT_LOG_EXTERNAL_CATEGORY(parent_cat);                              \
+    _XBT_LOGV(child).parent = &_XBT_LOGV(parent_cat);                   \
+  } else ((void)0)
 #else
 # define _XBT_LOG_PARENT_INITIALIZER(parent) &_XBT_LOGV(parent)
 # define XBT_LOG_CONNECT(child, parent_cat)                             \
 #else
 # define _XBT_LOG_PARENT_INITIALIZER(parent) &_XBT_LOGV(parent)
 # define XBT_LOG_CONNECT(child, parent_cat)                             \
-  /*  xbt_assert(_XBT_LOGV(child).parent == &_XBT_LOGV(parent_cat)) */
+  if (1) {                                                              \
+    XBT_LOG_EXTERNAL_CATEGORY(child);                                   \
+    XBT_LOG_EXTERNAL_CATEGORY(parent_cat);                              \
+    xbt_assert(_XBT_LOGV(child).parent == &_XBT_LOGV(parent_cat));      \
+  } else ((void)0)
 #endif
 
 /* XBT_LOG_NEW_SUBCATEGORY_helper:
 #endif
 
 /* XBT_LOG_NEW_SUBCATEGORY_helper: