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]

[PATCH] Bug in extract_string() in repo.c


On Tue, 24 Aug 2004 11:42:37 -0700, Zack Weinberg <zack@codesourcery.com> said:

> I don't know for sure, but I suspect you will need at least one more
> layer of quotation on the single quotes so that the shell doesn't
> strip them, i.e.
> 
> // { dg-options "-frepo -DF=\"'a'\"" }
> 
> That may have nothing to do with your problem, but it would be good to
> rule it out first.

Actually the problem *is* reproducible outside the testsuite.  If
`-frepo -c' comes after the macro definition gcc gets confused by the
quoting and complains about -frepo not being used with -c.

The problem is in extract_string() in repo.c.  The effect of a
backquote should be turned off after one character.

Tested on i686-pc-linux-gnu together with my tlink.c change.

OK to apply?

Adam

2004-08-24  Adam Nemet  <anemet@lnxw.com> 
 
        * cp/repo.c (extract_string): Reset backquote after one character. 
        (get_base_filename): Fix indentation. 

Index: repo.c 
=================================================================== 
RCS file: /cvs/gcc/gcc/gcc/cp/repo.c,v 
retrieving revision 1.50 
diff -u -p -r1.50 repo.c 
--- repo.c      29 Jul 2004 17:59:28 -0000      1.50 
+++ repo.c      24 Aug 2004 21:31:06 -0000 
@@ -68,7 +68,10 @@ extract_string (char **pp) 
        break; 
       ++p; 
       if (backquote) 
-       obstack_1grow (&temporary_obstack, c); 
+       { 
+         obstack_1grow (&temporary_obstack, c); 
+         backquote = 0; 
+       } 
       else if (! inside && c == ' ') 
        break; 
       else if (! inside && c == '\\') 
@@ -99,7 +102,7 @@ get_base_filename (const char *filename) 
        output = extract_string (&p); 
       else if (strcmp (q, "-c") == 0) 
        compiling = 1; 
-      } 
+    } 
  
   if (compiling && output) 
     return output; 


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