Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
s/_XBT_GNUC_FUNCTION/_XBT_FUNCTION/ (that's how to get __FUNCTION__ portably)
authormquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Fri, 1 Jul 2005 20:33:49 +0000 (20:33 +0000)
committermquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Fri, 1 Jul 2005 20:33:49 +0000 (20:33 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@1527 48e7efb5-ca39-0410-a469-dd3cf9ba447f

include/xbt/log.h
include/xbt/misc.h

index c730041..970571b 100644 (file)
@@ -279,7 +279,7 @@ extern xbt_log_appender_t xbt_log_default_appender;
 #define _XBT_LOG_PRE(catv, priority) do {                              \
      if (_XBT_LOG_ISENABLEDV(catv, priority)) {                        \
          s_xbt_log_event_t _log_ev =                                   \
 #define _XBT_LOG_PRE(catv, priority) do {                              \
      if (_XBT_LOG_ISENABLEDV(catv, priority)) {                        \
          s_xbt_log_event_t _log_ev =                                   \
-             {&(catv),priority,__FILE__,_XBT_GNUC_FUNCTION,__LINE__};         \
+             {&(catv),priority,__FILE__,_XBT_FUNCTION,__LINE__};         \
          _xbt_log_event_log(&_log_ev
 
 #define _XBT_LOG_POST                          \
          _xbt_log_event_log(&_log_ev
 
 #define _XBT_LOG_POST                          \
@@ -535,12 +535,12 @@ extern xbt_log_appender_t xbt_log_default_appender;
 #define CRITICAL6(f,a1,a2,a3,a4,a5,a6) LOG6(xbt_log_priority_critical, f,a1,a2,a3,a4,a5,a6)
 /* @} */
 
 #define CRITICAL6(f,a1,a2,a3,a4,a5,a6) LOG6(xbt_log_priority_critical, f,a1,a2,a3,a4,a5,a6)
 /* @} */
 
-#define XBT_IN               LOG1(xbt_log_priority_trace, ">> begin of %s",     _XBT_GNUC_FUNCTION)
-#define XBT_IN1(fmt,a)       LOG2(xbt_log_priority_trace, ">> begin of %s" fmt, _XBT_GNUC_FUNCTION, a)
-#define XBT_IN2(fmt,a,b)     LOG3(xbt_log_priority_trace, ">> begin of %s" fmt, _XBT_GNUC_FUNCTION, a,b)
-#define XBT_IN3(fmt,a,b,c)   LOG4(xbt_log_priority_trace, ">> begin of %s" fmt, _XBT_GNUC_FUNCTION, a,b,c)
-#define XBT_IN4(fmt,a,b,c,d) LOG5(xbt_log_priority_trace, ">> begin of %s" fmt, _XBT_GNUC_FUNCTION, a,b,c,d)
-#define XBT_OUT              LOG1(xbt_log_priority_trace, "<< end of %s",       _XBT_GNUC_FUNCTION)
+#define XBT_IN               LOG1(xbt_log_priority_trace, ">> begin of %s",     _XBT_FUNCTION)
+#define XBT_IN1(fmt,a)       LOG2(xbt_log_priority_trace, ">> begin of %s" fmt, _XBT_FUNCTION, a)
+#define XBT_IN2(fmt,a,b)     LOG3(xbt_log_priority_trace, ">> begin of %s" fmt, _XBT_FUNCTION, a,b)
+#define XBT_IN3(fmt,a,b,c)   LOG4(xbt_log_priority_trace, ">> begin of %s" fmt, _XBT_FUNCTION, a,b,c)
+#define XBT_IN4(fmt,a,b,c,d) LOG5(xbt_log_priority_trace, ">> begin of %s" fmt, _XBT_FUNCTION, a,b,c,d)
+#define XBT_OUT              LOG1(xbt_log_priority_trace, "<< end of %s",       _XBT_FUNCTION)
 #define XBT_HERE             LOG0(xbt_log_priority_trace, "-- was here")
 
 #endif /* ! _XBT_LOG_H_ */
 #define XBT_HERE             LOG0(xbt_log_priority_trace, "-- was here")
 
 #endif /* ! _XBT_LOG_H_ */
index 22eb219..0a97552 100644 (file)
 /* inline and __FUNCTION__ are only in GCC when -ansi is off */
 
 #if defined(__GNUC__) && ! defined(__STRICT_ANSI__)
 /* inline and __FUNCTION__ are only in GCC when -ansi is off */
 
 #if defined(__GNUC__) && ! defined(__STRICT_ANSI__)
-
-# define _XBT_GNUC_FUNCTION __FUNCTION__
+# define _XBT_FUNCTION __FUNCTION__
+# define _XBT_INLINE inline
+#elif (defined(__STDC__) && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L)
+# define _XBT_FUNC__ __func__      /* ISO-C99 compliant */
 # define _XBT_INLINE inline
 #else
 # define _XBT_INLINE inline
 #else
-# define _XBT_GNUC_FUNCTION "function"
+# define _XBT_FUNCTION "function"
 # define _XBT_INLINE 
 #endif
 
 # define _XBT_INLINE 
 #endif