Re: [patch] bug in cpp's #ident handling in gcc 3.4 [Was: ccache with buildworld]

From: Alexander Kabaev <kan_at_FreeBSD.org>
Date: Thu, 26 Aug 2004 22:25:42 +0000
On Thu, Aug 26, 2004 at 05:49:42PM +0300, Maxim Sobolev wrote:
> Hi there,
> 
> I was looking into the problem with building world using ccache. It was 
> failing with the following error message:
> 
> /usr/src/lib/libc/rpc/key_call.c:33:10: extra tokens at end of #ident 
> directive
> 
> Further investigation revealed that pre-processor puts argument of 
> #ident directive into additional quotes (""). That is, after 
> pre-processor #ident "foo" becomes #ident ""foo"", so that compiler 
> considers that in this example ident itself is empty string and foo"" is 
> "extra tokens". Following script illustrates problem:
> 
> -bash-2.05b$ echo '#ident "foo bar"' > /tmp/foo.c
> -bash-2.05b$ cc -E /tmp/foo.c
> # 1 "/tmp/foo.c"
> # 1 "<built-in>"
> # 1 "<command line>"
> # 1 "/tmp/foo.c"
> #ident ""foo bar""
> -bash-2.05b$
> 
> This problem doesn't hit when compilation is made without ccache, since 
> in this case (for performance reasons probably) no intermediate 
> pre-processed output is emitted.
> 
> Attached please find small patch which fixes the problem for me. With 
> it, I was able to do buildworld using ccache.
> 
> It would be nice to get it committed before 5.3 is out.
> 
> Regards,
> 
> Maxim

> --- src/contrib/gcc/c-ppoutput.c	2004/08/26 14:10:04	1.1
> +++ src/contrib/gcc/c-ppoutput.c	2004/08/26 14:10:32
> _at__at_ -292,7 +292,7 _at__at_
>  	  const cpp_string *str)
>  {
>    maybe_print_line (print.map, line);
> -  fprintf (print.outf, "#ident \"%s\"\n", str->text);
> +  fprintf (print.outf, "#ident %s\n", str->text);
>    print.line++;
>  }
>  
Not going to happen unless change is first accepted into FSF repository.
Have you submitted it to GCC folks through proper channel?

--
Alexander Kabaev
Received on Thu Aug 26 2004 - 20:25:42 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:08 UTC