preprocessor/3786: cpp ignores space after backslash

loewis@informatik.hu-berlin.de loewis@informatik.hu-berlin.de
Tue Jul 24 02:26:00 GMT 2001


>Number:         3786
>Category:       preprocessor
>Synopsis:       cpp ignores space after backslash
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    unassigned
>State:          open
>Class:          wrong-code
>Submitter-Id:   net
>Arrival-Date:   Tue Jul 24 02:26:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     loewis@informatik.hu-berlin.de
>Release:        3.0
>Organization:
>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
>Description:
  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.
>How-To-Repeat:
/* Compile the following program with g++ -E. Notice the space after
   the backslash. */
// This is a single-line comment  \ 
int i;
>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.
>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the Gcc-bugs mailing list