Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
don't use printf bug logs. Even when raising an error
authormquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Thu, 23 Jun 2005 15:20:02 +0000 (15:20 +0000)
committermquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Thu, 23 Jun 2005 15:20:02 +0000 (15:20 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@1397 48e7efb5-ca39-0410-a469-dd3cf9ba447f

include/xbt/error.h

index c42728c..b8ea1f0 100644 (file)
@@ -65,12 +65,10 @@ typedef enum {
 /** @brief return the error code if != no_error
  *  @hideinitializer
  */
 /** @brief return the error code if != no_error
  *  @hideinitializer
  */
-#define TRY(action) do {                                \
-  if ((errcode=action) != no_error) {                   \
-     fprintf (stderr, "%s:%d: '%s' error raising...\n", \
-            __FILE__,__LINE__,                         \
-             xbt_error_name(errcode));                  \
-     return errcode;                                    \
+#define TRY(action) do {                                       \
+  if ((errcode=action) != no_error) {                          \
+     ERROR1("'%s' error raising...", xbt_error_name(errcode)); \
+     return errcode;                                           \
   } } while (0)
    
 /** @brief return the error code if != no_error and != \a catched
   } } while (0)
    
 /** @brief return the error code if != no_error and != \a catched
@@ -83,9 +81,7 @@ typedef enum {
  */
 #define TRYFAIL(action) do {                                   \
   if ((errcode=action) != no_error) {                          \
  */
 #define TRYFAIL(action) do {                                   \
   if ((errcode=action) != no_error) {                          \
-     fprintf(stderr,"%s:%d: Got '%s' error !\n",               \
-            __FILE__,__LINE__,                                \
-             xbt_error_name(errcode));                         \
+     ERROR1("Got '%s' error !", xbt_error_name(errcode));      \
      fflush(stdout);                                           \
      xbt_abort();                                              \
   } } while(0)
      fflush(stdout);                                           \
      xbt_abort();                                              \
   } } while(0)
@@ -97,7 +93,7 @@ typedef enum {
 #define TRYEXPECT(action,expected_error)  do {                 \
   errcode=action;                                              \
   if (errcode != expected_error) {                             \
 #define TRYEXPECT(action,expected_error)  do {                 \
   errcode=action;                                              \
   if (errcode != expected_error) {                             \
-    fprintf(stderr,"Got error %s (instead of %s expected)\n",  \
+    ERROR2("Got error %s (instead of %s expected)\n",          \
            xbt_error_name(errcode),                          \
            xbt_error_name(expected_error));                  \
     xbt_abort();                                              \
            xbt_error_name(errcode),                          \
            xbt_error_name(expected_error));                  \
     xbt_abort();                                              \