public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: Joseph Myers <joseph@codesourcery.com>
Cc: Tobias Burnus <tobias@codesourcery.com>,
	gcc-patches <gcc-patches@gcc.gnu.org>,
	fortran <fortran@gcc.gnu.org>
Subject: Re: [Patch] OpenMP: Add iterator support to Fortran's depend; add affinity clause
Date: Thu, 27 May 2021 22:15:35 +0200	[thread overview]
Message-ID: <20210527201535.GS7746@tucnak> (raw)
In-Reply-To: <alpine.DEB.2.22.394.2105271953070.416177@digraph.polyomino.org.uk>

On Thu, May 27, 2021 at 07:58:03PM +0000, Joseph Myers wrote:
> On Thu, 27 May 2021, Tobias Burnus wrote:
> 
> > @Joseph: I CC'ed you in case you have comments regarding
> > c-parser.c's c_parser_check_balanced_raw_token_sequence (comment update)
> > and c_parser_check_tight_balanced_raw_token_sequence (new); the latter
> > is essentially cp_parser_skip_balanced_tokens with slight adaptions.
> 
> I don't understand why the name says either "tight" or "balanced".  As far 
> as I can see, c_parser_check_tight_balanced_raw_token_sequence isn't 
> checking for balanced token sequences (in the sense defined in C2x) at all 
> and would accept e.g. }]{[ as being balanced.  Is that really what's 
> supposed to be accepted there?  If it is, the comment on the function 
> definition needs to explain the exact definition of what token sequences 
> are accepted.

Not }]{[ but {[}], true.
I guess what Tobias posted comes from the C++ FE cp_parser_skip_balanced_tokens
which is apparently my fault.
The C++ grammar is:

balanced-token-seq:
	balanced-token
	balanced-token-seq balanced-token
balanced-token:
	( balanced-token-seq opt )
	[ balanced-token-seq opt ]
	{ balanced-token-seq opt }
	any token other than a parenthesis, a bracket, or a brace

so I bet we need something like the C c_parser_check_balanced_raw_token_sequence
instead in the C++ FE too.
For the particular OpenMP use case, I think it really doesn't matter which
one we use, if the opening and closing parens kinds/counts would match but
they wouldn't be balanced, it would be invalid in any case and we'd reported
it during parsing of the iterators.

	Jakub


  reply	other threads:[~2021-05-27 20:15 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-27 13:36 Tobias Burnus
2021-04-28 13:41 ` Jakub Jelinek
2021-04-28 20:26   ` [Patch] Fortran/OpenMP: Fix var-list expr parsing with array/dt (was: [Patch] OpenMP: Add iterator support to Fortran's depend; add affinity clause) Tobias Burnus
2021-04-28 20:31     ` Jakub Jelinek
     [not found]   ` <3bfa68db-f904-a1cb-0d18-c1a17ecfc720@codesourcery.com>
     [not found]     ` <20210527082259.GM7746@tucnak>
2021-05-27 18:30       ` [Patch] OpenMP: Add iterator support to Fortran's depend; add affinity clause Tobias Burnus
2021-05-27 18:42         ` Jakub Jelinek
2021-05-27 19:58         ` Joseph Myers
2021-05-27 20:15           ` Jakub Jelinek [this message]
2021-05-27 22:59           ` Tobias Burnus
2021-05-29  8:03             ` Jakub Jelinek
2021-05-31  8:14               ` Christophe Lyon
2021-05-31  8:19                 ` Jakub Jelinek
2021-05-31 14:43               ` Tobias Burnus

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=20210527201535.GS7746@tucnak \
    --to=jakub@redhat.com \
    --cc=fortran@gcc.gnu.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=joseph@codesourcery.com \
    --cc=tobias@codesourcery.com \
    /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).