This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: backslash-newline, trigraphs, and the C standard
On Thu, Jan 13, 2000 at 11:54:14AM -0800, Geoff Keating wrote:
>
> Zack Weinberg <zack@wolery.cumb.org> writes:
>
> > On Wed, Jan 12, 2000 at 08:59:23PM -0800, Mark Mitchell wrote:
> > > >>>>> "Jeffrey" == Jeffrey A Law <law@cygnus.com> writes:
> > >
> > > Jeffrey> In message <20000111225102.A20712@wolery.cumb.org>you
> > > Jeffrey> write:
> > > >> So - I'd like to change it so that, in nonconforming mode,
> > > >> \-newline is replaced by (virtual) white space except inside
> > > >> strings.
> > >
> > > Jeffrey> I can live with it so long as we can still get conforming
> > > Jeffrey> code via some switch.
> > >
> > > FWIW, I'm not in favor of this idea. This is a change that can result
> > > in silent changes in program behavior. Extensions are one thing;
> > > silent changes are another.
> > >
> > > There are certainly compilers that compile faster, generate better
> > > code than GCC, and are ANSI/ISO conforming so there must be other
> > > places to look to speed up the compiler.
> >
> > Performance is not the main reason why I want to make this change; it's
> > to be able to silence trigraph warnings in comments. There are definitely
> > better places to look for performance improvements.
>
> I thought the point of the trigraph warnings is so that when you
> accidentally write a trigraph, use gcc, and then have to port to some
> compiler that has trigraphs on by default, you don't get a nasty shock.
Precisely, and since it is an easy mistake to make and easy to
correct, I put it in -Wall. I might consider moving it to -W or
turning it back off again.
> In that case, aren't trigraphs that would end comments particularly
> interesting?
Yes. I can easily imagine a stupid line-splitter script inserting a
trigraphed \-newline between the * and / of a comment end.
> I think, though, that gcc should not warn for things like
>
> /* some comment (??) */
>
> because they don't change the meaning of the code; whether trigraphs
> are used or not, it's still a comment.
Agree here.
> I don't know how easy it would be to do that in cpplib, it looks like
> it might be quite a bit of work.
The most viable approach I can think of is to move /* */ comment
handling into read_and_prescan. Currently that would be a severe
pain, but that function's slated for a redesign anyway.
What I think I'm going to do right now is turn on cpplib by default
(since no one's objected to that - if you care, speak up!) and see how
many people complain about the new warnings. Maybe we don't have to
do anything at all.
zw
- References:
- backslash-newline, trigraphs, and the C standard
- Re: backslash-newline, trigraphs, and the C standard
- Re: backslash-newline, trigraphs, and the C standard
- Re: backslash-newline, trigraphs, and the C standard
- Re: backslash-newline, trigraphs, and the C standard