This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GCOV fix for the Mingw platform


Here is a patch for GCOV on the mingw platform. It fixes the way directory
separators are handled when using gcov's -l option.

<<
*** gcc/gcov.c.old	Tue May 13 18:59:40 2003
--- gcc/gcov.c	Tue May 13 19:00:10 2003
***************
*** 1058,1065 ****
  	  int objdir_count = strlen (object_directory);
  	  source_file_name = xmalloc (objdir_count + strlen (s_ptr->name) + 2);
  	  strcpy (source_file_name, object_directory);
! 	  if (object_directory[objdir_count - 1] != '/')
! 	    source_file_name[objdir_count++] = '/';
  	  strcpy (source_file_name + objdir_count, s_ptr->name);
  	}
        else
--- 1058,1066 ----
  	  int objdir_count = strlen (object_directory);
  	  source_file_name = xmalloc (objdir_count + strlen (s_ptr->name) + 2);
  	  strcpy (source_file_name, object_directory);
! 	  if (object_directory[objdir_count - 1] != '/'
! 	      && object_directory[objdir_count - 1] != DIR_SEPARATOR)
! 	    source_file_name[objdir_count++] = DIR_SEPARATOR;
  	  strcpy (source_file_name + objdir_count, s_ptr->name);
  	}
        else
***************
*** 1286,1292 ****
  	    }
  
  	  count = strlen (source_file_name);
! 	  cptr = strrchr (s_ptr->name, '/');
  	  if (cptr)
  	    cptr = cptr + 1;
  	  else
--- 1287,1293 ----
  	    }
  
  	  count = strlen (source_file_name);
! 	  cptr = strrchr (s_ptr->name, DIR_SEPARATOR);
  	  if (cptr)
  	    cptr = cptr + 1;
  	  else
***************
*** 1295,1301 ****
  	    {
  	      gcov_file_name = xmalloc (count + 7 + strlen (input_file_name));
  
! 	      cptr = strrchr (input_file_name, '/');
  	      if (cptr)
  		strcpy (gcov_file_name, cptr + 1);
  	      else
--- 1296,1302 ----
  	    {
  	      gcov_file_name = xmalloc (count + 7 + strlen (input_file_name));
  
! 	      cptr = strrchr (input_file_name, DIR_SEPARATOR);
  	      if (cptr)
  		strcpy (gcov_file_name, cptr + 1);
  	      else
***************
*** 1303,1309 ****
  
  	      strcat (gcov_file_name, ".");
  
! 	      cptr = strrchr (source_file_name, '/');
  	      if (cptr)
  		strcat (gcov_file_name, cptr + 1);
  	      else
--- 1304,1310 ----
  
  	      strcat (gcov_file_name, ".");
  
! 	      cptr = strrchr (source_file_name, DIR_SEPARATOR);
  	      if (cptr)
  		strcat (gcov_file_name, cptr + 1);
  	      else
***************
*** 1312,1318 ****
  	  else
  	    {
  	      gcov_file_name = xmalloc (count + 6);
! 	      cptr = strrchr (source_file_name, '/');
  	      if (cptr)
  		strcpy (gcov_file_name, cptr + 1);
  	      else
--- 1313,1319 ----
  	  else
  	    {
  	      gcov_file_name = xmalloc (count + 6);
! 	      cptr = strrchr (source_file_name, DIR_SEPARATOR);
  	      if (cptr)
  		strcpy (gcov_file_name, cptr + 1);
  	      else
>>

Pascal Obry.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]