This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug preprocessor/8270] [4.8/4.9/5 Regression] back-slash white space newline with comments, no warning
- From: "doug at cs dot dartmouth.edu" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sat, 21 Mar 2015 14:40:04 +0000
- Subject: [Bug preprocessor/8270] [4.8/4.9/5 Regression] back-slash white space newline with comments, no warning
- Auto-submitted: auto-generated
- References: <bug-8270-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=8270
--- Comment #56 from doug mcilroy <doug at cs dot dartmouth.edu> ---
(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.
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.
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.
Here is what the C11 standard says about the end-of-line indicator:
5.1.1.2
Physical source file multibyte characters are mapped, in an implementation
defined manner, to the source character set (introducing new-line characters
for end-of-line indicators) if necessary.
5.2.1 paragraph 3
In source files, there shall be some way of indicating the end of each line of
text; this International Standard treats such an end-of-line indicator as if it
were a single new-line character.