X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/6c4ab580734068602bd6479476dc7ad8bdf619aa..3a2947e432dde3d65f3319db5527e235074fbd43:/include/xbt/log.h diff --git a/include/xbt/log.h b/include/xbt/log.h index 5bba6f6915..e51c491c12 100644 --- a/include/xbt/log.h +++ b/include/xbt/log.h @@ -28,12 +28,12 @@ /* XBT_LOG_MAYDAY: define this to replace the logging facilities with basic printf function. Useful to debug the logging facilities themselves */ #undef XBT_LOG_MAYDAY -/*#define XBT_LOG_MAYDAY*/ +//#define XBT_LOG_MAYDAY #ifndef _XBT_LOG_H_ #define _XBT_LOG_H_ -#include "xbt/misc.h" +#include "simgrid_config.h" #include SG_BEGIN_DECL() @@ -92,10 +92,12 @@ SG_BEGIN_DECL() /* The root of the category hierarchy. */ #define XBT_LOG_ROOT_CAT root -/* In strict ansi C, we are not allowed to initialize a variable with - * a non-constant value. But the whole tree of categories is - * connected by setting the address of the parent category as a field - * of the child one. +/* The whole tree of categories is connected by setting the address of + * the parent category as a field of the child one. + * + * In strict ansi C, we are allowed to initialize a variable with "a + * pointer to an lvalue designating an object of static storage + * duration" [ISO/IEC 9899:1999, Section 6.6]. * * Unfortunately, Visual C builder does not target any standard * compliance, and C99 is not an exception to this unfortunate rule. @@ -110,7 +112,7 @@ SG_BEGIN_DECL() * you don't want to see your child category become a child of root * directly. */ -#if defined(__STRICT_ANSI__) || defined(_MSC_VER) +#if defined(_MSC_VER) # define _XBT_LOG_PARENT_INITIALIZER(parent) NULL # define XBT_LOG_CONNECT(parent_cat,child) _XBT_LOGV(child).parent = &_XBT_LOGV(parent_cat) #else @@ -389,20 +391,29 @@ XBT_PUBLIC_DATA(s_xbt_log_category_t) _XBT_LOGV(XBT_LOG_ROOT_CAT); * Setting the LogEvent's valist member is done inside _log_logEvent. */ #ifdef _XBT_WIN32 -#define _XBT_LOG_PRE(catv, priority) do { \ - if (_XBT_LOG_ISENABLEDV(catv, priority)) { \ - s_xbt_log_event_t _log_ev = \ - {NULL,priority,__FILE__,_XBT_FUNCTION,__LINE__}; \ - _log_ev.cat = &(catv); \ - _log_ev.buffer = (char*) calloc(XBT_LOG_BUFF_SIZE + 1, sizeof(char)); \ - _xbt_log_event_log(&_log_ev +#include /* calloc */ +#define _XBT_LOG_PRE(catv, prio) do { \ + if (_XBT_LOG_ISENABLEDV(catv, prio)) { \ + s_xbt_log_event_t _log_ev; \ + _log_ev.cat = &(catv); \ + _log_ev.priority = (prio); \ + _log_ev.fileName = __FILE__; \ + _log_ev.functionName = _XBT_FUNCTION; \ + _log_ev.lineNum = __LINE__; \ + _log_ev.buffer = (char*) calloc(XBT_LOG_BUFF_SIZE + 1, sizeof(char)); \ + _xbt_log_event_log(&_log_ev #else -#define _XBT_LOG_PRE(catv, priority) do { \ - if (_XBT_LOG_ISENABLEDV(catv, priority)) { \ - s_xbt_log_event_t _log_ev = \ - {NULL,priority,__FILE__,_XBT_FUNCTION,__LINE__}; \ - _log_ev.cat = &(catv); \ - _xbt_log_event_log(&_log_ev \ +#include /* memset */ +#define _XBT_LOG_PRE(catv, prio) do { \ + if (_XBT_LOG_ISENABLEDV(catv, prio)) { \ + s_xbt_log_event_t _log_ev; \ + _log_ev.cat = &(catv); \ + _log_ev.priority = (prio); \ + _log_ev.fileName = __FILE__; \ + _log_ev.functionName = _XBT_FUNCTION; \ + _log_ev.lineNum = __LINE__; \ + memset(_log_ev.buffer, 0, XBT_LOG_BUFF_SIZE); \ + _xbt_log_event_log(&_log_ev #endif