From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id AC9B83856088 for ; Thu, 9 Jun 2022 12:23:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org AC9B83856088 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-665-nr8_r1tgOyOjpBI23LJURw-1; Thu, 09 Jun 2022 08:22:57 -0400 X-MC-Unique: nr8_r1tgOyOjpBI23LJURw-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id BFFDC1C1827F; Thu, 9 Jun 2022 12:22:56 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.192.11]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7B690492CA3; Thu, 9 Jun 2022 12:22:56 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.17.1/8.17.1) with ESMTPS id 259CMrYc1627343 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 9 Jun 2022 14:22:54 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 259CMrN01627342; Thu, 9 Jun 2022 14:22:53 +0200 Date: Thu, 9 Jun 2022 14:22:53 +0200 From: Jakub Jelinek To: Chung-Lin Tang Cc: Tobias Burnus , gcc-patches , Hafiz Abid Qadeer , Andrew Stubbs Subject: Re: [PATCH, OpenMP, v4] Implement uses_allocators clause for target regions Message-ID: Reply-To: Jakub Jelinek References: <46d77e14-080c-db6c-4032-e12899c5d059@codesourcery.com> <9c0945fa-1054-095e-86ae-a9d8dd1ab625@codesourcery.com> MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 2.85 on 10.11.54.9 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-4.8 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Jun 2022 12:23:02 -0000 On Thu, Jun 09, 2022 at 02:21:13PM +0800, Chung-Lin Tang wrote: > @@ -15651,6 +15653,213 @@ c_parser_omp_clause_allocate (c_parser *parser, tree list) > return nl; > } > > +/* OpenMP 5.0: > + uses_allocators ( allocator-list ) > + > + allocator-list: > + allocator > + allocator , allocator-list > + allocator ( traits-array ) > + allocator ( traits-array ) , allocator-list > + > + OpenMP 5.2: > + > + uses_allocators ( modifier : allocator-list ) Please drop the -list above. > + uses_allocators ( modifier , modifier : allocator-list ) and here too. > + struct item_tok > + { > + location_t loc; > + tree id; > + item_tok (void) : loc (UNKNOWN_LOCATION), id (NULL_TREE) {} > + }; > + struct item { item_tok name, arg; }; > + auto_vec *modifiers = NULL, *allocators = NULL; > + auto_vec *cur_list = new auto_vec (4); I was hoping you'd drop all this. See https://gcc.gnu.org/r13-1002 for implementation (both C and C++ FE) of something very similar, the only difference there is that in the case of linear clause, it is looking for val ref uval step ( whatever ) followed by , or ) (anod ref and uval not in C FE), while you are looking for memspace ( whatever ) traits ( whatever ) followed by : or by , (in case of , repeat). But in both cases you can actually use the same parser APIs for raw token pre-parsing to just compute if it is the modifier syntax or not, set bool has_modifiers based on that (when you come over probably valid syntax followed by CPP_COLON). Jakub