From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 62124 invoked by alias); 23 Mar 2015 09:44:48 -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 62055 invoked by uid 48); 23 Mar 2015 09:44:44 -0000 From: "ktietz at gcc dot gnu.org" 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: Mon, 23 Mar 2015 09:49: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: ktietz at gcc dot gnu.org 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/msg02339.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=8270 --- Comment #57 from Kai Tietz --- (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