public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "GoWhoopee at yahoo dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug preprocessor/8270] [4.7/4.8/4.9 Regression] back-slash white space newline with comments, no warning
Date: Fri, 13 Dec 2013 10:48:00 -0000	[thread overview]
Message-ID: <bug-8270-4-7z0npUuU6d@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-8270-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #52 from GoWhoopee at yahoo dot com ---
Whitespace is required by Translation Phase 3, consequently Translation Phase 1
should not be changing whitespace at all, only mapping multibyte characters and
trigraphs.

Comment #39: Indicates that gcc is known to work incorrectly, "This (removal of
such spaces) is part of how GCC defines the implementation-defined mapping in
translation phase 1.": the removal of white-space is not mapping multibyte
characters or trigraphs, it is removing critical information from Translation
Phases 2 and 3 resulting in misinterpretation of the source code.

Looking at the 4.8.2 source, libcpp\lex.c line 1427, there is a fix when
parsing raw strings, after the event:
______________________________________________
static void
lex_raw_string (cpp_reader *pfile, cpp_token *token, const uchar *base,
        const uchar *cur)
{
[...]
      switch (note->type)
        {
        case '\\':
        case ' ':
          /* Restore backslash followed by newline.  */
          BUF_APPEND (base, cur - base);
          base = cur;
          BUF_APPEND ("\\", 1);
        after_backslash:
          if (note->type == ' ')
        {
          /* GNU backslash whitespace newline extension.  FIXME
             could be any sequence of non-vertical space.  When we
             can properly restore any such sequence, we should mark
             this note as handled so _cpp_process_line_notes
             doesn't warn.  */
          BUF_APPEND (" ", 1);
        }

          BUF_APPEND ("\n", 1);
          break;
______________________________________________

but fixing all the varieties of broken things after the event wouldn't be
necessary if Translation Phase 1 didn't trim whitespace.

If Translation Phase 1 is required to trim whitespace for some reason
(performance, perhaps) then it should trim multiple consecutive spaces down to
exactly one space; which wouldn't break Translation Phase 2 and 3.

Does that sound like a sensible compromise?


  parent reply	other threads:[~2013-12-13 10:48 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-8270-4@http.gcc.gnu.org/bugzilla/>
2011-06-27 12:16 ` [Bug preprocessor/8270] [4.3/4.4/4.5/4.6/4.7 " rguenth at gcc dot gnu.org
2012-03-13 12:47 ` [Bug preprocessor/8270] [4.5/4.6/4.7/4.8 " jakub at gcc dot gnu.org
2012-07-02 12:40 ` [Bug preprocessor/8270] [4.6/4.7/4.8 " rguenth at gcc dot gnu.org
2013-04-12 15:15 ` [Bug preprocessor/8270] [4.7/4.8/4.9 " jakub at gcc dot gnu.org
2013-12-11 12:41 ` GoWhoopee at yahoo dot com
2013-12-11 18:33 ` pinskia at gcc dot gnu.org
2013-12-12  8:24 ` GoWhoopee at yahoo dot com
2013-12-12 15:02 ` mikpelinux at gmail dot com
2013-12-13  8:15 ` GoWhoopee at yahoo dot com
2013-12-13 10:48 ` GoWhoopee at yahoo dot com [this message]
2014-06-12 13:41 ` [Bug preprocessor/8270] [4.7/4.8/4.9/4.10 " rguenth at gcc dot gnu.org
2014-12-19 13:23 ` [Bug preprocessor/8270] [4.8/4.9/5 " jakub at gcc dot gnu.org
2015-03-19 14:21 ` ktietz at gcc dot gnu.org
2015-03-21 15:25 ` doug at cs dot dartmouth.edu
2015-03-23  9:49 ` ktietz at gcc dot gnu.org
2015-06-23  8:12 ` [Bug preprocessor/8270] [4.8/4.9/5/6 " rguenth at gcc dot gnu.org
2015-06-26 19:51 ` [Bug preprocessor/8270] [4.9/5/6 " jakub at gcc dot gnu.org
2015-06-26 20:25 ` jakub at gcc dot gnu.org
2021-05-14  9:45 ` [Bug preprocessor/8270] [9/10/11/12 " jakub at gcc dot gnu.org
2021-06-01  8:03 ` rguenth at gcc dot gnu.org
2022-05-27  9:33 ` [Bug preprocessor/8270] [10/11/12/13 " rguenth at gcc dot gnu.org
2022-06-28 10:28 ` jakub at gcc dot gnu.org
2023-07-07 10:28 ` [Bug preprocessor/8270] [11/12/13/14 " rguenth at gcc dot gnu.org
2024-03-10 12:09 ` verodeving at gmail dot com

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-8270-4-7z0npUuU6d@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).