From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 121950 invoked by alias); 21 Mar 2015 14:40:14 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 121868 invoked by uid 48); 21 Mar 2015 14:40:11 -0000 From: "doug at cs dot dartmouth.edu" To: gcc-bugs@gcc.gnu.org Subject: [Bug preprocessor/8270] [4.8/4.9/5 Regression] back-slash white space newline with comments, no warning Date: Sat, 21 Mar 2015 15:25:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: preprocessor X-Bugzilla-Version: 3.2 X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: minor X-Bugzilla-Who: doug at cs dot dartmouth.edu X-Bugzilla-Status: NEW X-Bugzilla-Priority: P5 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 4.8.5 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2015-03/txt/msg02211.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=8270 --- Comment #56 from doug mcilroy --- (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.