]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Reorganized error printing code slightly.
authorBart Van Assche <bvanassche@acm.org>
Sun, 23 Mar 2008 07:54:02 +0000 (07:54 +0000)
committerBart Van Assche <bvanassche@acm.org>
Sun, 23 Mar 2008 07:54:02 +0000 (07:54 +0000)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7758

exp-drd/drd_error.c
exp-drd/drd_error.h

index 38e2456ac3f376efd83d7c2a4d6fb296596be05e..4389e7bf238d77c910966677b4c545ba93bbbab0 100644 (file)
 #include "pub_tool_tooliface.h"   // VG_(needs_tool_errors)()
 
 
-/* Local type definitions. */
-
-typedef enum {
-  ConflictingAccessSupp
-} DRD_SuppKind;
-
-
 /* Local variables. */
 
 static Bool s_drd_show_conflicting_segments = True;
@@ -253,12 +246,26 @@ static UInt drd_tool_error_update_extra(Error* e)
 
 static Bool drd_tool_error_recog(Char* const name, Supp* const supp)
 {
-  SuppKind skind;
+  SuppKind skind = 0;
 
-  if (VG_(strcmp)(name, "ConflictingAccess") == 0)
-    skind = ConflictingAccessSupp;
-  else if (VG_(strcmp)(name, "CondErr") == 0)
-    skind = CondErr;
+  if (VG_(strcmp)(name, STR_DataRaceErr) == 0)
+    ;
+  else if (VG_(strcmp)(name, STR_MutexErr) == 0)
+    ;
+  else if (VG_(strcmp)(name, STR_CondErr) == 0)
+    ;
+  else if (VG_(strcmp)(name, STR_CondRaceErr) == 0)
+    ;
+  else if (VG_(strcmp)(name, STR_CondDestrErr) == 0)
+    ;
+  else if (VG_(strcmp)(name, STR_SemaphoreErr) == 0)
+    ;
+  else if (VG_(strcmp)(name, STR_BarrierErr) == 0)
+    ;
+  else if (VG_(strcmp)(name, STR_RwlockErr) == 0)
+    ;
+  else if (VG_(strcmp)(name, STR_GenericErr) == 0)
+    ;
   else
     return False;
 
@@ -283,15 +290,15 @@ static Char* drd_tool_error_name(Error* e)
 {
   switch (VG_(get_error_kind)(e))
   {
-  case DataRaceErr:  return "ConflictingAccess";
-  case MutexErr:     return "MutexErr";
-  case CondErr:      return "CondErr";
-  case CondRaceErr:  return "CondRaceErr";
-  case CondDestrErr: return "CondDestrErr";
-  case SemaphoreErr: return "SemaphoreErr";
-  case BarrierErr:   return "BarrierErr";
-  case RwlockErr:    return "RwlockErr";
-  case GenericErr:   return "GenericErr";
+  case DataRaceErr:  return VGAPPEND(STR_, DataRaceErr);
+  case MutexErr:     return VGAPPEND(STR_, MutexErr);
+  case CondErr:      return VGAPPEND(STR_, CondErr);
+  case CondRaceErr:  return VGAPPEND(STR_, CondRaceErr);
+  case CondDestrErr: return VGAPPEND(STR_, CondDestrErr);
+  case SemaphoreErr: return VGAPPEND(STR_, SemaphoreErr);
+  case BarrierErr:   return VGAPPEND(STR_, BarrierErr);
+  case RwlockErr:    return VGAPPEND(STR_, RwlockErr);
+  case GenericErr:   return VGAPPEND(STR_, GenericErr);
   default:
     tl_assert(0);
   }
index 1bbd066a22d61bd690ecedcf9f3723bd191ac70c..c9fa953dac3f7ec58537575885f19f88df83570c 100644 (file)
 /* DRD error types. */
 
 typedef enum {
+#define STR_DataRaceErr  "ConflictingAccess"
    DataRaceErr    = 1,
+#define STR_MutexErr     "MutexErr"
    MutexErr       = 2,
+#define STR_CondErr      "CondErr"
    CondErr        = 3,
+#define STR_CondRaceErr  "CondRaceErr"
    CondRaceErr    = 4,
+#define STR_CondDestrErr "CondDestrErr"
    CondDestrErr   = 5,
+#define STR_SemaphoreErr "SemaphoreErr"
    SemaphoreErr   = 6,
+#define STR_BarrierErr   "BarrierErr"
    BarrierErr     = 7,
+#define STR_RwlockErr    "RwlockErr"
    RwlockErr      = 8,
+#define STR_GenericErr   "GenericErr"
    GenericErr     = 9,
 } DrdErrorKind;