GCOV fix for the Mingw platform
Christopher Faylor
cgf@redhat.com
Sun May 25 16:18:00 GMT 2003
On Fri, May 23, 2003 at 09:19:11PM +0200, Pascal Obry wrote:
>
>Here is a patch for GCOV on the mingw platform. It fixes the way directory
>separators are handled when using gcov's -l option.
This looks like an obvious fix to me however, it's missing a ChangeLog.
cgf
><<
>*** 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.
More information about the Gcc-patches
mailing list