From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ciao.gmane.io (ciao.gmane.io [116.202.254.214]) by sourceware.org (Postfix) with ESMTPS id B4C343858401 for ; Mon, 9 Jan 2023 12:24:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B4C343858401 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=m.gmane-mx.org Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1pErCb-0005OR-7m for gcc-patches@gcc.gnu.org; Mon, 09 Jan 2023 13:24:33 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: gcc-patches@gcc.gnu.org From: Julian Brown Subject: Re: [PATCH v6 10/11] OpenMP: Support OpenMP 5.0 "declare mapper" directives for C Date: Mon, 9 Jan 2023 12:24:20 +0000 Organization: Siemens Message-ID: <20230109122420.0689a107@squid.athome> References: <59d66ab42744d047328f75b9a1282782cfa7ca7f.1671796516.git.julian@codesourcery.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="MP_/r.iHyVkBW=1dbiLCyDoqAk." In-Reply-To: <59d66ab42744d047328f75b9a1282782cfa7ca7f.1671796516.git.julian@codesourcery.com> X-Newsreader: Claws Mail 4.1.1git1 (GTK 3.24.34; x86_64-pc-linux-gnu) Cc: fortran@gcc.gnu.org X-Spam-Status: No, score=-10.7 required=5.0 tests=BAYES_00,GIT_PATCH_0,HEADER_FROM_DIFFERENT_DOMAINS,KAM_DMARC_STATUS,KAM_SHORT,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: --MP_/r.iHyVkBW=1dbiLCyDoqAk. Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline On Fri, 23 Dec 2022 04:13:03 -0800 Julian Brown wrote: > This patch adds support for "declare mapper" directives (and the > "mapper" modifier on "map" clauses) for C. As for C++, arrays of > custom-mapped objects are not supported yet. Here's a small follow-up for this one. Re-tested (with previous patches) with offloading to nvptx. OK? Julian --MP_/r.iHyVkBW=1dbiLCyDoqAk. Content-Type: text/x-patch Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=c-balanced-token-sequence-1.diff commit be53bd5db61c2e4a093a00c371ba8395737d9be9 Author: Julian Brown Date: Fri Jan 6 12:05:56 2023 +0000 OpenMP: Use c_parser_check_balanced_raw_token_sequence parsing mapper modifier This is a small cumulative patch to simplify mapper modifier parsing in c_parser_omp_clause_map, making an approximately-equivalent change to the one Jakub suggested in the review for the C++ "declare mapper" patch here: https://gcc.gnu.org/pipermail/gcc-patches/2022-May/595523.html The C version isn't quite so terse, but is still a slight improvement over the previous code, I think. 2023-01-09 Julian Brown gcc/c/ * c-parser.cc (c_parser_omp_clause_map): Use c_parser_check_balanced_raw_token_sequence to traverse mapper modifier syntax. diff --git a/gcc/c/c-parser.cc b/gcc/c/c-parser.cc index 5dca50850b38..a1b377edd886 100644 --- a/gcc/c/c-parser.cc +++ b/gcc/c/c-parser.cc @@ -17242,20 +17242,18 @@ c_parser_omp_clause_map (c_parser *parser, tree list, enum gomp_map_kind kind) if (c_parser_peek_nth_token_raw (parser, pos + 1)->type == CPP_COMMA) pos++; - else if ((c_parser_peek_nth_token_raw (parser, pos + 1)->type - == CPP_OPEN_PAREN) - && ((c_parser_peek_nth_token_raw (parser, pos + 2)->type - == CPP_NAME) - || ((c_parser_peek_nth_token_raw (parser, pos + 2)->type - == CPP_KEYWORD) - && (c_parser_peek_nth_token_raw (parser, - pos + 2)->keyword - == RID_DEFAULT))) - && (c_parser_peek_nth_token_raw (parser, pos + 3)->type - == CPP_CLOSE_PAREN) - && (c_parser_peek_nth_token_raw (parser, pos + 4)->type - == CPP_COMMA)) - pos += 4; + else if (c_parser_peek_nth_token_raw (parser, pos + 1)->type + == CPP_OPEN_PAREN) + { + unsigned int npos = pos + 2; + if (c_parser_check_balanced_raw_token_sequence (parser, &npos) + && (c_parser_peek_nth_token_raw (parser, npos)->type + == CPP_CLOSE_PAREN) + && (c_parser_peek_nth_token_raw (parser, npos + 1)->type + == CPP_COMMA)) + pos = npos + 1; + } + pos++; } --MP_/r.iHyVkBW=1dbiLCyDoqAk.--