public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Joseph Myers <joseph@codesourcery.com>
To: David Malcolm <dmalcolm@redhat.com>
Cc: <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH, stage1] Better error recovery for merge-conflict markers
Date: Fri, 20 Mar 2015 17:50:00 -0000	[thread overview]
Message-ID: <alpine.DEB.2.10.1503201737170.9325@digraph.polyomino.org.uk> (raw)
In-Reply-To: <1426866606-65042-1-git-send-email-dmalcolm@redhat.com>

On Fri, 20 Mar 2015, David Malcolm wrote:

> I believe that the presense of these markers in source code is almost
> always a bug (are there any GCC frontends in which the markers are
> parsable as something valid?)

Well, obviously they are valid inside #if 0, strings (where you have a 
test, though not one at start of line "\
<<<<<<<") and comments (where you don't have a test).  They are also valid 
when stringized:

#define str(s) #s
const char *s = str(
<<<<<<<
);

must be accepted.  They are also valid in the expansion of a macro that 
doesn't get expanded.

#define foo \
<<<<<<<

That is, in general, the invalidity only occurs when preprocessing tokens 
are converted to tokens.

In C++ (C++11 and later), >>>>>>> can also close a sequence of nested 
template argument lists, thanks to the rule about replacing >> by > > in 
that context.  And of course it's OK, if odd, to put that at the start of 
a line.  So in that case the preprocessing tokens do get converted to 
tokens, and that token sequence (interpreted as >> >> >> > and then 
contextually adjusted to > > > > > > >) is valid.

-- 
Joseph S. Myers
joseph@codesourcery.com

  reply	other threads:[~2015-03-20 17:50 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-20 15:38 David Malcolm
2015-03-20 17:50 ` Joseph Myers [this message]
2015-04-17 21:47   ` David Malcolm
2015-05-07 21:56     ` Joseph Myers
2015-04-09  8:29 ` Bert Wesarg
2016-02-08  9:07   ` Bert Wesarg
2016-02-10 17:42     ` David Malcolm
2015-03-20 18:09 Manuel López-Ibáñez

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=alpine.DEB.2.10.1503201737170.9325@digraph.polyomino.org.uk \
    --to=joseph@codesourcery.com \
    --cc=dmalcolm@redhat.com \
    --cc=gcc-patches@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).