This is the mail archive of the 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: cpplib preparation for identifier spelling preservation

"Joseph S. Myers" <> writes:

> In fact I think
> the special phase 1 handling of backslash-whitespace-newline is a bad
> idea (cf. discussions of how this does not allow writing some C++0x
> raw strings) and we should remove that as well and then close bug 8270
> as fixed, but that may be more controversial.)

I assume you are talking about the way that gcc ignores whitespace
between a backslash and a newline.  The argument in favor of the current
behaviour is that gcc's behaviour is not affected by something which can
not be seen.  The argument against is that this violates the common
understanding of the language, although it is technically permitted by
the standard.

I think the sensible approach is

1) Treat \\\n as a line continuation (this is obvious).

2) Treat \\\r\n as a line continuation.

3) Otherwise, do not treat \\.+\n as a line continuation.

4) When not in a /* */ comment, issue a warning about \\[ \t\r\f\v]+\n
   when not treating it as a line continuation.  The warning should be
   on by default, with an option to turn it off.  This would be a
   recreation of the old -Wwhite-space option.

5) It would be nice if that warning were suppressed in the case of a //
   comment ending in a backslash followed by whitespace if the next line
   starts with zero or more whitespace characters followed by a //


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