[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pcc-list
Subject:    Re: cpp loses * character in comments with -C
From:       Anders Magnusson <ragge () ludd ! ltu ! se>
Date:       2010-06-05 11:48:48
Message-ID: 4C0A39A0.90901 () ludd ! ltu ! se
[Download RAW message or body]

Hi,

Iain Hibbert wrote:
> Hi,
>
> I found that using the -C argument for cpp, an embedded * in the comment
> would get lost.. eg
>
>   /* this function returns "char *" */
>
> when preprocessed with -C would be output as
>
>   /* this function returns "char "" */
>
> the patch below fixes this, by restoring the lost '*' value to ch in case
> it needs to be printed
>   
Great, nice catch, thanks!  Patch applied.

-- Ragge

> (and also, removing the insignificant else, feel free to keep that)
>
> this fixes an issue with libc build on NetBSD, where the preprocessor was
> being used to strip code from <sys/syscall.h> leaving significant comments
> to be further processed by sed. (I don't know why sed can't just extract
> the significant comments itself, lets not ask just now :)
>
> iain
>
> Index: token.c
> ===================================================================
> RCS file: /cvsroot/pcc/cc/cpp/token.c,v
> retrieving revision 1.34
> diff -u -r1.34 token.c
> --- token.c	20 Apr 2010 11:20:20 -0000	1.34
> +++ token.c	4 Jun 2010 20:51:04 -0000
> @@ -188,8 +188,9 @@
>  							} else
>  								PUTCH(' ');
>  							break;
> -						} else
> -							unch(ch);
> +						}
> +						unch(ch);
> +						ch = '*';
>  					}
>  					if (Cflag) PUTCH(ch);
>  				}
>
>
>
>   

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic