https://gcc.gnu.org/bugzilla/show_bug.cgi?id=8270

--- Comment #57 from Kai Tietz <ktietz at gcc dot gnu.org> ---
(In reply to doug mcilroy from comment #56)
> (In reply to Kai Tietz from comment #55)
> Comment #55 overlooks the Standard's translation phase 1, which replaces an
> implementation-defined end-of-line indicator with a new-line character.
> GCC's convention of including in the end-of-line indicator any white space
> that is preceded by a backslash conforms, though it may be a surprise.

Sure, sorry for omitting that.  Common understanding of "multibyte" (this term
is indeed misleading here) newline characters are in common the combination of
'\r' and '\n'.  So by interpreting any whitespace + new-line being seen as a
single-character is valid, but has indeed semantic differences.

> The surprise is perversely out of sympathy with the raison d'etre of the
> standard--maximal portability. It is incompatible with the most direct (and
> historically prior) implementations, wherein the end-of-line indicator is
> simply a new-line character.

Agreed, and we should at least consider to provide an option - beside the
necessary warning - to not strip whitespaces from right-handside of lines
containing a backslash at line's end.
Should we use an existing option (like -ansi), or introduce new option for
this?

> A suitable fix is to warn when white space occurs in an end-of-line
> indicator. This will break no code that GCC currently compiles, yet draw
> attention to the nonportable construct.

Well, in general we are warning, but within comments.  For C-style comments
there is indeed not much reason to warn, as there is no semantic difference. 
But for C++-style comments we should, as here indeed a semantic difference can
occure for gnu-style end-of-line treating

Reply via email to