This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH, committed] make sure fixincl created files end with newline
- From: Bruce Korb <bkorb at gnu dot org>
- To: Andreas Jaeger <aj at suse dot de>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Thu, 24 Nov 2005 23:07:13 -0800
- Subject: Re: [PATCH, committed] make sure fixincl created files end with newline
- References: <200511242156.33620.bkorb@gnu.org> <m3acftut29.fsf@gromit.moeb>
Hi Andreas,
The trigger was Kean Johnston's patch that I am reviewing.
I know nothing of PR234007. I'll apply to all active branches
'cuz it only makes sense.
Cheers - Bruce
On Thursday 24 November 2005 10:42 pm, Andreas Jaeger wrote:
> Bruce Korb <bkorb@gnu.org> writes:
>
> > 2005-11-24 Bruce Korb <bkorb@gnu.org>
> > * fixincl.c(write_replacement) "here strings" in AutoGen often/generally don't
> > have a terminating newline. This will check the last byte for '\n'.
>
> Is this a fix for PR23400? In that case it should go into the 4.1
> branch as well,
>
> Andreas
>
> >
> > Index: fixincl.c
> > ===================================================================
> > --- fixincl.c (revision 107490)
> > +++ fixincl.c (working copy)
> > @@ -1202,7 +1202,10 @@
> >
> > {
> > FILE* out_fp = create_file ();
> > - fputs (pz_text, out_fp);
> > + size_t sz = strlen (pz_text);
> > + fwrite (pz_text, sz, 1, out_fp);
> > + if (pz_text[ sz-1 ] != '\n')
> > + fputc ('\n', out_fp);
> > fclose (out_fp);
> > }
> > }