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]

Re: [PATCH, committed] make sure fixincl created files end with newline


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);
> >     }
> >  }


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