Fix incorrect use of VG_(tool_panic). Adapt checker script accordingly.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14544 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/coregrind/m_addrinfo.c b/coregrind/m_addrinfo.c
index 21fd413..05566fd 100644
--- a/coregrind/m_addrinfo.c
+++ b/coregrind/m_addrinfo.c
@@ -550,7 +550,7 @@
          break;
 
       default:
-         VG_(tool_panic)("mc_pp_AddrInfo");
+         VG_(core_panic)("mc_pp_AddrInfo");
    }
 }
 
diff --git a/coregrind/m_errormgr.c b/coregrind/m_errormgr.c
index ae04087..0de1529 100644
--- a/coregrind/m_errormgr.c
+++ b/coregrind/m_errormgr.c
@@ -310,7 +310,7 @@
             VG_(printf)("\nUnhandled error type: %u. VG_(needs).tool_errors\n"
                         "probably needs to be set.\n",
                         e1->ekind);
-            VG_(tool_panic)("unhandled error type");
+            VG_(core_panic)("unhandled error type");
          }
    }
 }
@@ -999,7 +999,7 @@
          }
       }
       // XXX: this isn't right.  See bug 203651.
-      if (p_min == NULL) continue; //VG_(tool_panic)("show_all_errors()");
+      if (p_min == NULL) continue; //VG_(core_panic)("show_all_errors()");
 
       VG_(umsg)("\n");
       VG_(umsg)("%d errors in context %d of %d:\n",
@@ -1869,7 +1869,7 @@
                "\nUnhandled suppression type: %u.  VG_(needs).tool_errors\n"
                "probably needs to be set.\n",
                err->ekind);
-            VG_(tool_panic)("unhandled suppression type");
+            VG_(core_panic)("unhandled suppression type");
          }
    }
 }
diff --git a/coregrind/m_libcprint.c b/coregrind/m_libcprint.c
index 8d30b00..e367767 100644
--- a/coregrind/m_libcprint.c
+++ b/coregrind/m_libcprint.c
@@ -315,7 +315,7 @@
       case 1: ex = 10;    break;
       case 2: ex = 100;   break;
       case 3: ex = 1000;  break;
-      default: VG_(tool_panic)("Currently can only handle 3 decimal places");
+      default: VG_(core_panic)("Currently can only handle 3 decimal places");
       }
       p2 = ((100*n*ex) / m) % ex;
       // Have to generate the format string in order to be flexible about
diff --git a/coregrind/m_main.c b/coregrind/m_main.c
index 9663474..94dc415 100644
--- a/coregrind/m_main.c
+++ b/coregrind/m_main.c
@@ -2026,7 +2026,7 @@
       Bool  ok;
       ok = VG_(sanity_check_needs)( &s );
       if (!ok) {
-         VG_(tool_panic)(s);
+         VG_(core_panic)(s);
       }
    }
 
diff --git a/tests/check_headers_and_includes b/tests/check_headers_and_includes
index dd366d1..3c53386 100755
--- a/tests/check_headers_and_includes
+++ b/tests/check_headers_and_includes
@@ -12,6 +12,8 @@
 #     export headers
 # (6) coregrind/ *.[ch] must not use tl_assert
 # (7) include/*.h and tool *.[ch] must not use vg_assert
+# (8) coregrind/ *.[ch] must not use VG_(tool_panic)
+# (9) include/*.h and tool *.[ch] must not use VG_(core_panic)
 #-------------------------------------------------------------------
 
 use strict;
@@ -225,6 +227,11 @@
     if ($assert ne "") {
         error("File $path_name must not use vg_assert\n");
     }
+# Must not use VG_(core_panic)
+    my $panic = `grep 'VG_(core_panic)' $file`;
+    if ($panic ne "") {
+        error("File $path_name must not use VG_(core_panic)\n");
+    }
 }
 
 #---------------------------------------------------------------------
@@ -254,6 +261,18 @@
     if ($assert ne "") {
         error("File $path_name must not use tl_assert\n");
     }
+# Must not use VG_(tool_panic)
+    my $panic = `grep 'VG_(tool_panic)' $file`;
+    if ($panic ne "") {
+        chomp($panic);
+# Do not complain about the definition of VG_(tool_panic)
+        if (($path_name eq "coregrind/m_libcassert.c") &&
+            ($panic eq "void VG_(tool_panic) ( const HChar* str )")) {
+# OK
+        } else {
+            error("File $path_name must not use VG_(tool_panic)\n");
+        }
+    }
 }
 
 #---------------------------------------------------------------------
@@ -279,6 +298,11 @@
     if ($assert ne "") {
         error("File $path_name must not use vg_assert\n");
     }
+# Must not use VG_(core_panic)
+    my $panic = `grep 'VG_(core_panic)' $file`;
+    if ($panic ne "") {
+        error("File $path_name must not use VG_(core_panic)\n");
+    }
 }
 
 sub process_file {