From patchwork Wed Sep 26 18:41:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cesar Philippidis X-Patchwork-Id: 975348 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-486500-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="IWxkUwLz"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42L6Gv6sjbz9s3l for ; Thu, 27 Sep 2018 04:41:42 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :subject:to:message-id:date:mime-version:content-type; q=dns; s= default; b=ENjBz72IYYWclOhy5vZnbt4agydriJmKoJ6GG8acpuIcdtl5f4pr5 2PoMGsjFshjNNH0unQ1tHS7WUjnN9WtZad66cdiqF8hbD/MSIBQ5OiRDBER9Gh9i ndGZziSfb+Gq9zdnq73jeKYBel3roPdz8brNvlne82cE6itUmtV2rA= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :subject:to:message-id:date:mime-version:content-type; s= default; bh=TiPY6slv67z0IHaWHqnkGgWW1Fc=; b=IWxkUwLzaJg7H6To/lrS 99tigeJClRDFlF/yZp4vn9/5yTfPHNqdv9uLzDnogW+IkObRt14jMCAzyIFEGp5c krFIcnK8C9tXRm2130UdEg3isLkNuK2AmEcdf74MrZgw7mfID5q63bQGBrWQmLFr Tx9L2FkXRfxy3hSHeU9ggJ8= Received: (qmail 32205 invoked by alias); 26 Sep 2018 18:41:35 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 32192 invoked by uid 89); 26 Sep 2018 18:41:34 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.5 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=shape, H*r:0700 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 26 Sep 2018 18:41:33 +0000 Received: from svr-orw-mbx-04.mgc.mentorg.com ([147.34.90.204]) by relay1.mentorg.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-SHA384:256) id 1g5Ekd-0002Me-81 from Cesar_Philippidis@mentor.com for gcc-patches@gcc.gnu.org; Wed, 26 Sep 2018 11:41:31 -0700 Received: from [127.0.0.1] (147.34.91.1) by SVR-ORW-MBX-04.mgc.mentorg.com (147.34.90.204) with Microsoft SMTP Server (TLS) id 15.0.1320.4; Wed, 26 Sep 2018 11:41:28 -0700 From: Cesar Philippidis Subject: [patch, openacc] Use correct location information for OpenACC shape and simple, clauses in C/C++ To: "gcc-patches@gcc.gnu.org" , Thomas Schwinge Message-ID: <4fb8850e-3c18-9031-f007-e75924dcefae@codesourcery.com> Date: Wed, 26 Sep 2018 11:41:28 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 Thomas, this is your old gomp4 patch that updates the error locations for gang, worker and vector clauses. Those functions are parsed in {c,cp}_parser_oacc_shape_clause. I'm not sure how much of an impact this patch has given that it does not require any test suite changes. However, we do have a couple of tests in og8 that haven't been merged to trunk, so perhaps this functionality will be exercised in a later patch series. Unfortunately, there are a lot inter-dependencies between all of the pending og8->trunk patches. Is this patch OK for trunk? I bootstrapped and regtested it for x86_64 Linux with nvptx offloading. Cesar [OpenACC] Use correct location information for OpenACC shape and simple clauses in C/C++ 2018-XX-YY Thomas Schwinge Cesar Philippidis gcc/c/ * c-parser.c (c_parser_oacc_shape_clause) (c_parser_oacc_simple_clause): Add loc formal parameter. Adjust all users. gcc/cp/ * parser.c (cp_parser_oacc_shape_clause): Add loc formal parameter. Adjust all users. (cherry picked from gomp-4_0-branch r239519) update fallout for acc finalize / if_present --- diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c index b8fc000b50d..d1e9876065a 100644 --- a/gcc/c/c-parser.c +++ b/gcc/c/c-parser.c @@ -12602,12 +12602,12 @@ c_parser_oacc_single_int_clause (c_parser *parser, omp_clause_code code, */ static tree -c_parser_oacc_shape_clause (c_parser *parser, omp_clause_code kind, +c_parser_oacc_shape_clause (c_parser *parser, location_t loc, + omp_clause_code kind, const char *str, tree list) { const char *id = "num"; tree ops[2] = { NULL_TREE, NULL_TREE }, c; - location_t loc = c_parser_peek_token (parser)->location; if (kind == OMP_CLAUSE_VECTOR) id = "length"; @@ -12739,12 +12739,12 @@ c_parser_oacc_shape_clause (c_parser *parser, omp_clause_code kind, seq */ static tree -c_parser_oacc_simple_clause (c_parser *parser, enum omp_clause_code code, - tree list) +c_parser_oacc_simple_clause (c_parser * /* parser */, location_t loc, + enum omp_clause_code code, tree list) { check_no_duplicate_clause (list, code, omp_clause_code_name[code]); - tree c = build_omp_clause (c_parser_peek_token (parser)->location, code); + tree c = build_omp_clause (loc, code); OMP_CLAUSE_CHAIN (c) = list; return c; @@ -14046,8 +14046,8 @@ c_parser_oacc_all_clauses (c_parser *parser, omp_clause_mask mask, c_name = "async"; break; case PRAGMA_OACC_CLAUSE_AUTO: - clauses = c_parser_oacc_simple_clause (parser, OMP_CLAUSE_AUTO, - clauses); + clauses = c_parser_oacc_simple_clause (parser, here, OMP_CLAUSE_AUTO, + clauses); c_name = "auto"; break; case PRAGMA_OACC_CLAUSE_COLLAPSE: @@ -14091,8 +14091,8 @@ c_parser_oacc_all_clauses (c_parser *parser, omp_clause_mask mask, c_name = "device_resident"; break; case PRAGMA_OACC_CLAUSE_FINALIZE: - clauses = c_parser_oacc_simple_clause (parser, OMP_CLAUSE_FINALIZE, - clauses); + clauses = c_parser_oacc_simple_clause (parser, here, + OMP_CLAUSE_FINALIZE, clauses); c_name = "finalize"; break; case PRAGMA_OACC_CLAUSE_FIRSTPRIVATE: @@ -14101,7 +14101,7 @@ c_parser_oacc_all_clauses (c_parser *parser, omp_clause_mask mask, break; case PRAGMA_OACC_CLAUSE_GANG: c_name = "gang"; - clauses = c_parser_oacc_shape_clause (parser, OMP_CLAUSE_GANG, + clauses = c_parser_oacc_shape_clause (parser, here, OMP_CLAUSE_GANG, c_name, clauses); break; case PRAGMA_OACC_CLAUSE_HOST: @@ -14113,13 +14113,15 @@ c_parser_oacc_all_clauses (c_parser *parser, omp_clause_mask mask, c_name = "if"; break; case PRAGMA_OACC_CLAUSE_IF_PRESENT: - clauses = c_parser_oacc_simple_clause (parser, OMP_CLAUSE_IF_PRESENT, + clauses = c_parser_oacc_simple_clause (parser, here, + OMP_CLAUSE_IF_PRESENT, clauses); c_name = "if_present"; break; case PRAGMA_OACC_CLAUSE_INDEPENDENT: - clauses = c_parser_oacc_simple_clause (parser, OMP_CLAUSE_INDEPENDENT, - clauses); + clauses = c_parser_oacc_simple_clause (parser, here, + OMP_CLAUSE_INDEPENDENT, + clauses); c_name = "independent"; break; case PRAGMA_OACC_CLAUSE_LINK: @@ -14151,7 +14153,7 @@ c_parser_oacc_all_clauses (c_parser *parser, omp_clause_mask mask, c_name = "reduction"; break; case PRAGMA_OACC_CLAUSE_SEQ: - clauses = c_parser_oacc_simple_clause (parser, OMP_CLAUSE_SEQ, + clauses = c_parser_oacc_simple_clause (parser, here, OMP_CLAUSE_SEQ, clauses); c_name = "seq"; break; @@ -14165,7 +14167,7 @@ c_parser_oacc_all_clauses (c_parser *parser, omp_clause_mask mask, break; case PRAGMA_OACC_CLAUSE_VECTOR: c_name = "vector"; - clauses = c_parser_oacc_shape_clause (parser, OMP_CLAUSE_VECTOR, + clauses = c_parser_oacc_shape_clause (parser, here, OMP_CLAUSE_VECTOR, c_name, clauses); break; case PRAGMA_OACC_CLAUSE_VECTOR_LENGTH: @@ -14180,7 +14182,7 @@ c_parser_oacc_all_clauses (c_parser *parser, omp_clause_mask mask, break; case PRAGMA_OACC_CLAUSE_WORKER: c_name = "worker"; - clauses = c_parser_oacc_shape_clause (parser, OMP_CLAUSE_WORKER, + clauses = c_parser_oacc_shape_clause (parser, here, OMP_CLAUSE_WORKER, c_name, clauses); break; default: diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index e80c1fba670..e91540f24d4 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -31920,13 +31920,13 @@ cp_parser_oacc_single_int_clause (cp_parser *parser, omp_clause_code code, */ static tree -cp_parser_oacc_shape_clause (cp_parser *parser, omp_clause_code kind, +cp_parser_oacc_shape_clause (cp_parser *parser, location_t loc, + omp_clause_code kind, const char *str, tree list) { const char *id = "num"; cp_lexer *lexer = parser->lexer; tree ops[2] = { NULL_TREE, NULL_TREE }, c; - location_t loc = cp_lexer_peek_token (lexer)->location; if (kind == OMP_CLAUSE_VECTOR) id = "length"; @@ -33830,7 +33830,7 @@ cp_parser_oacc_all_clauses (cp_parser *parser, omp_clause_mask mask, break; case PRAGMA_OACC_CLAUSE_GANG: c_name = "gang"; - clauses = cp_parser_oacc_shape_clause (parser, OMP_CLAUSE_GANG, + clauses = cp_parser_oacc_shape_clause (parser, here, OMP_CLAUSE_GANG, c_name, clauses); break; case PRAGMA_OACC_CLAUSE_HOST: @@ -33898,7 +33898,8 @@ cp_parser_oacc_all_clauses (cp_parser *parser, omp_clause_mask mask, break; case PRAGMA_OACC_CLAUSE_VECTOR: c_name = "vector"; - clauses = cp_parser_oacc_shape_clause (parser, OMP_CLAUSE_VECTOR, + clauses = cp_parser_oacc_shape_clause (parser, here, + OMP_CLAUSE_VECTOR, c_name, clauses); break; case PRAGMA_OACC_CLAUSE_VECTOR_LENGTH: @@ -33913,7 +33914,8 @@ cp_parser_oacc_all_clauses (cp_parser *parser, omp_clause_mask mask, break; case PRAGMA_OACC_CLAUSE_WORKER: c_name = "worker"; - clauses = cp_parser_oacc_shape_clause (parser, OMP_CLAUSE_WORKER, + clauses = cp_parser_oacc_shape_clause (parser, here, + OMP_CLAUSE_WORKER, c_name, clauses); break; default: -- 2.17.1