Patchwork [google/gcc-4_7] Fix problem with asm spec for -gsplit-dwarf

login
register
mail settings
Submitter Cary Coutant
Date Sept. 12, 2012, 11:18 p.m.
Message ID <20120912231850.998DFE0C81@ccoutant.mtv.corp.google.com>
Download mbox | patch
Permalink /patch/183470/
State New
Headers show

Comments

Cary Coutant - Sept. 12, 2012, 11:18 p.m.
2012-09-12   Cary Coutant  <ccoutant@google.com>

gcc/
	* gcc.c (replace_extension_spec_func): Restrict search for
	extension to last component of path.
Sterling Augustine - Sept. 12, 2012, 11:22 p.m.
On Wed, Sep 12, 2012 at 4:18 PM, Cary Coutant <ccoutant@google.com> wrote:
> 2012-09-12   Cary Coutant  <ccoutant@google.com>
>
> gcc/
>         * gcc.c (replace_extension_spec_func): Restrict search for
>         extension to last component of path.
>
> Index: gcc/gcc.c
> ===================================================================
> --- gcc/gcc.c   (revision 191233)
> +++ gcc/gcc.c   (working copy)
> @@ -8413,12 +8413,18 @@ replace_extension_spec_func (int argc, c
>    char *name;
>    char *p;
>    char *result;
> +  int i;
>
>    if (argc != 2)
>      fatal_error ("too few arguments to %%:replace-extension");
>
>    name = xstrdup (argv[0]);
> -  p = strrchr (name, '.');
> +
> +  for (i = strlen(name) - 1; i >= 0; i--)
> +    if (IS_DIR_SEPARATOR (name[i]))
> +      break;
> +
> +  p = strrchr (name + i + 1, '.');
>    if (p != NULL)
>        *p = '\0';
>

This is OK for Google 4.7.

Sterling
Cary Coutant - Sept. 12, 2012, 11:24 p.m.
>> 2012-09-12   Cary Coutant  <ccoutant@google.com>
>>
>> gcc/
>>         * gcc.c (replace_extension_spec_func): Restrict search for
>>         extension to last component of path.
>
> This is OK for Google 4.7.

Thanks, committed as r191234.

-cary

Patch

Index: gcc/gcc.c
===================================================================
--- gcc/gcc.c	(revision 191233)
+++ gcc/gcc.c	(working copy)
@@ -8413,12 +8413,18 @@  replace_extension_spec_func (int argc, c
   char *name;
   char *p;
   char *result;
+  int i;
 
   if (argc != 2)
     fatal_error ("too few arguments to %%:replace-extension");
 
   name = xstrdup (argv[0]);
-  p = strrchr (name, '.');
+
+  for (i = strlen(name) - 1; i >= 0; i--)
+    if (IS_DIR_SEPARATOR (name[i]))
+      break;
+
+  p = strrchr (name + i + 1, '.');
   if (p != NULL)
       *p = '\0';