public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "ipinkas at nds dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug preprocessor/44191] -E output broken for gcc-4.5.0
Date: Tue, 11 Sep 2012 22:40:00 -0000	[thread overview]
Message-ID: <bug-44191-4-bcWVYRSpiR@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-44191-4@http.gcc.gnu.org/bugzilla/>

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44191

Israel Pinkas <ipinkas at nds dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ipinkas at nds dot com

--- Comment #2 from Israel Pinkas <ipinkas at nds dot com> 2012-09-11 22:40:08 UTC ---
A am not sure what Jakub means by Locus, but the C and C++ standards are clear
that during the preprocessing stage, the sequence backslash-newline is dropped
from the stream.  Line splicing occurs before tokenization.

While in most situations there is no difference, there are some cases which are
affected by this bug:

1. Token splicing.  Two tokens are separated by only a backslash-newline in the
source are supposed to be concatenated into a single token.  In a bizzare twist
to this bug, this behavior is preserved.  See example below.

2. Use of cpp for other purposes.  There exist multiple software packages which
are not compilers for C-line languages that use cpp as a preprocessor,
accepting that cpp is C-oriented in a number of ways.  This includes some
assemblers and other packages that need file inclusion, conditional
compilation, and simple macros.  Many of these packages rely on the line
splicing.

The bug description needs to be slighly ammended.  The splicing behavior was
changed only when the first character following the newline is a space or tab. 
The following demonstrates:

==== x.txt ====
Test\
ing
Test\
 case
==== END ====
$ cpp x.txt
# 1 "x.txt"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "x.txt"
Testing

Test
 code
==========

The first instance spliced the tokens.  However, the second instance left the
newline, a change in behavior and a deviation from the spec.


       reply	other threads:[~2012-09-11 22:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-44191-4@http.gcc.gnu.org/bugzilla/>
2012-09-11 22:40 ` ipinkas at nds dot com [this message]
2010-05-18 22:34 [Bug c/44191] New: " gcc-bug at andihellmund dot com
2010-05-18 22:45 ` [Bug preprocessor/44191] " jakub at gcc dot gnu dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-44191-4-bcWVYRSpiR@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).