OSDN Git Service

* tree-data-ref.c: Rename DDR_SIZE_VECT to DDR_NB_LOOPS.
[pf3gnuchains/gcc-fork.git] / gcc / coverage.c
index a558e86..0ba0c11 100644 (file)
@@ -262,12 +262,12 @@ read_counts_file (void)
          entry = *slot;
          if (!entry)
            {
-             *slot = entry = xcalloc (1, sizeof (counts_entry_t));
+             *slot = entry = XCNEW (counts_entry_t);
              entry->ident = elt.ident;
              entry->ctr = elt.ctr;
              entry->checksum = checksum;
              entry->summary.num = n_counts;
-             entry->counts = xcalloc (n_counts, sizeof (gcov_type));
+             entry->counts = XCNEWVEC (gcov_type, n_counts);
            }
          else if (entry->checksum != checksum)
            {
@@ -445,36 +445,42 @@ coverage_checksum_string (unsigned chksum, const char *string)
      as the checksums are used only for sanity checking.  */
   for (i = 0; string[i]; i++)
     {
+      int offset = 0;
+      if (!strncmp (string + i, "_GLOBAL__N_", 11))
+      offset = 11;
       if (!strncmp (string + i, "_GLOBAL__", 9))
-       for (i = i + 9; string[i]; i++)
-         if (string[i]=='_')
-           {
-             int y;
-             unsigned seed;
-             int scan;
-
-             for (y = 1; y < 9; y++)
-               if (!(string[i + y] >= '0' && string[i + y] <= '9')
-                   && !(string[i + y] >= 'A' && string[i + y] <= 'F'))
-                 break;
-             if (y != 9 || string[i + 9] != '_')
-               continue;
-             for (y = 10; y < 18; y++)
-               if (!(string[i + y] >= '0' && string[i + y] <= '9')
-                   && !(string[i + y] >= 'A' && string[i + y] <= 'F'))
-                 break;
-             if (y != 18)
-               continue;
-             scan = sscanf (string + i + 10, "%X", &seed);
-             gcc_assert (scan);
-             if (seed != crc32_string (0, flag_random_seed))
-               continue;
-             string = dup = xstrdup (string);
-             for (y = 10; y < 18; y++)
-               dup[i + y] = '0';
-             break;
-           }
-      break;
+      offset = 9;
+
+      /* C++ namespaces do have scheme:
+         _GLOBAL__N_<filename>_<wrongmagicnumber>_<magicnumber>functionname
+       since filename might contain extra underscores there seems
+       to be no better chance then walk all possible offsets looking
+       for magicnuber.  */
+      if (offset)
+        for (;string[offset]; offset++)
+        for (i = i + offset; string[i]; i++)
+          if (string[i]=='_')
+            {
+              int y;
+
+              for (y = 1; y < 9; y++)
+                if (!(string[i + y] >= '0' && string[i + y] <= '9')
+                    && !(string[i + y] >= 'A' && string[i + y] <= 'F'))
+                  break;
+              if (y != 9 || string[i + 9] != '_')
+                continue;
+              for (y = 10; y < 18; y++)
+                if (!(string[i + y] >= '0' && string[i + y] <= '9')
+                    && !(string[i + y] >= 'A' && string[i + y] <= 'F'))
+                  break;
+              if (y != 18)
+                continue;
+              if (!dup)
+                string = dup = xstrdup (string);
+              for (y = 10; y < 18; y++)
+                dup[i + y] = '0';
+            }
+        break;
     }
 
   chksum = crc32_string (chksum, string);
@@ -563,7 +569,7 @@ coverage_end_function (void)
     {
       struct function_list *item;
 
-      item = xmalloc (sizeof (struct function_list));
+      item = XNEW (struct function_list);
 
       *functions_tail = item;
       functions_tail = &item->next;
@@ -945,12 +951,12 @@ coverage_init (const char *filename)
   int len = strlen (filename);
 
   /* Name of da file.  */
-  da_file_name = xmalloc (len + strlen (GCOV_DATA_SUFFIX) + 1);
+  da_file_name = XNEWVEC (char, len + strlen (GCOV_DATA_SUFFIX) + 1);
   strcpy (da_file_name, filename);
   strcat (da_file_name, GCOV_DATA_SUFFIX);
 
   /* Name of bbg file.  */
-  bbg_file_name = xmalloc (len + strlen (GCOV_NOTE_SUFFIX) + 1);
+  bbg_file_name = XNEWVEC (char, len + strlen (GCOV_NOTE_SUFFIX) + 1);
   strcpy (bbg_file_name, filename);
   strcat (bbg_file_name, GCOV_NOTE_SUFFIX);