Bug 3786 - cpp ignores space after backslash
Summary: cpp ignores space after backslash
Status: RESOLVED DUPLICATE of bug 8270
Alias: None
Product: gcc
Classification: Unclassified
Component: preprocessor (show other bugs)
Version: 3.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: wrong-code
Depends on:
Blocks:
 
Reported: 2001-07-24 02:26 UTC by Martin v. Loewis
Modified: 2005-10-26 01:42 UTC (History)
7 users (show)

See Also:
Host: sparc-sun-solaris2.8
Target: sparc-sun-solaris2.8
Build: sparc-sun-solaris2.8
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin v. Loewis 2001-07-24 02:26:00 UTC
  The preprocessor will ignore spaces between a backslash and a newline
  for continuation lines. This is in violation of C99, 5.1.1.2,
  # Each instance of a backslash character (\) immediately followed 
  # by a new-line character is deleted
  As a result, a // comment ending in a backslash eats the next line.

Release:
3.0

Environment:
System: SunOS pandora 5.8 Generic_108528-06 sun4u sparc SUNW,Ultra-Enterprise
Architecture: sun4

host: sparc-sun-solaris2.8
build: sparc-sun-solaris2.8
target: sparc-sun-solaris2.8
configured with: ../configure --enable-shared --enable-threads --with-cpu=v8 --with-gnu-ld --with-gnu-as --enable-version-specific-runtime-libs

How-To-Repeat:
/* Compile the following program with g++ -E. Notice the space after
   the backslash. */
// This is a single-line comment  \ 
int i;
Comment 1 Martin v. Loewis 2001-07-24 02:26:00 UTC
Fix:
  In cpplex.c:skip_escaped_newlines, rewrite the escape logic to not
  accept spaces immediately after the backslash, atleast not if in
  some strict mode.
Comment 2 Joseph S. Myers 2001-07-24 10:33:55 UTC
From: "Joseph S. Myers" <jsm28@cam.ac.uk>
To: <loewis@informatik.hu-berlin.de>
Cc: <gcc-gnats@gcc.gnu.org>,  <gcc-bugs@gcc.gnu.org>
Subject: Re: preprocessor/3786: cpp ignores space after backslash
Date: Tue, 24 Jul 2001 10:33:55 +0100 (BST)

 On Tue, 24 Jul 2001 loewis@informatik.hu-berlin.de wrote:
 
 >   The preprocessor will ignore spaces between a backslash and a newline
 >   for continuation lines. This is in violation of C99, 5.1.1.2,
 >   # Each instance of a backslash character (\) immediately followed 
 >   # by a new-line character is deleted
 >   As a result, a // comment ending in a backslash eats the next line.
 
 This is part of the implementation-defined translation phase 1 mapping:
 invisible white space at the end of lines is ignored.  There *is* a bug -
 that this feature ought to be mentioned under "Implementation-defined
 behavior" in the manual.
 
 -- 
 Joseph S. Myers
 jsm28@cam.ac.uk
 
Comment 3 Neil Booth 2001-07-29 05:19:53 UTC
State-Changed-From-To: open->closed
State-Changed-Why: Not a bug - this is documented behaviour in the manual.
Comment 4 Andrew Pinski 2005-10-26 01:42:03 UTC
Reopening to ...
Comment 5 Andrew Pinski 2005-10-26 01:42:19 UTC
Mark as a dup of bug 8270.

*** This bug has been marked as a duplicate of 8270 ***