From patchwork Mon Jun 13 14:43:25 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Schwinge X-Patchwork-Id: 634680 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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 3rSwWw2rJyz9t1F for ; Tue, 14 Jun 2016 00:43:56 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=V4Tr05N3; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:in-reply-to:references:date:message-id:mime-version :content-type:content-transfer-encoding; q=dns; s=default; b=nz0 EL5QTBdUgznp2Vk0997tn8WAjt7O1yVus8zYUHXckAXe0jK3c1jkr0g4UzNZyIEh d6AJSXPL95YwSMKSMBAINZ/fv0rGh9F68xxY9mHDz3KP3wcye4y2/y46v/HnHBVB cog7qnUYBGMRfL1oeImBe5GZwO2DoqumeUFEn0jA= 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 :to:subject:in-reply-to:references:date:message-id:mime-version :content-type:content-transfer-encoding; s=default; bh=0Ana3ssJT RXY+pNnz/UMHRkifA8=; b=V4Tr05N3UJYESQP5+Td0SUexUXW+dKOZ7pQdVvLqq 0MR/NvFI2Omd+YjDbu04IOkkb8cUaPnFXZSiSU/APEzkdMXEI/6eKbNNSFX6+sRP n4LPY4ozgc6yDVJwkZ08jAN/ClNoRIK+usIgTZLOYQd9d5DozjXr+8Z88hcUDHUt T4= Received: (qmail 31208 invoked by alias); 13 Jun 2016 14:43:44 -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 31127 invoked by uid 89); 13 Jun 2016 14:43:43 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE, SPF_PASS, URIBL_RED autolearn=ham version=3.3.2 spammy=Hx-languages-length:4248, supporter, cancel 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 (AES256-GCM-SHA384 encrypted) ESMTPS; Mon, 13 Jun 2016 14:43:32 +0000 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=SVR-IES-FEM-01.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1bCT5N-0006jJ-Is from Thomas_Schwinge@mentor.com ; Mon, 13 Jun 2016 07:43:29 -0700 Received: from hertz.schwinge.homeip.net (137.202.0.76) by SVR-IES-FEM-01.mgc.mentorg.com (137.202.0.104) with Microsoft SMTP Server id 14.3.224.2; Mon, 13 Jun 2016 15:43:28 +0100 From: Thomas Schwinge To: Jakub Jelinek , Subject: [PR middle-end/71373] Document missing OMP_CLAUSE_* in gcc/tree-nested.c In-Reply-To: <87h9ddrlrx.fsf@hertz.schwinge.homeip.net> References: <87h9ddrlrx.fsf@hertz.schwinge.homeip.net> User-Agent: Notmuch/0.9-101-g81dad07 (http://notmuchmail.org) Emacs/24.4.1 (x86_64-pc-linux-gnu) Date: Mon, 13 Jun 2016 16:43:25 +0200 Message-ID: <877fdtqhde.fsf@hertz.schwinge.homeip.net> MIME-Version: 1.0 Hi! On Wed, 01 Jun 2016 17:06:42 +0200, Thomas Schwinge wrote: > Here are the OpenACC bits of . In the PR, Jakub clarified that all the missing other OMP_CLAUSE_* are in fact all unreachable here. OK to document this as follows, in trunk? The "anything else" default case in fact now is just the non-clause OMP_CLAUSE_ERROR, so when adding a case for that one, we could then remove the default case, and thus get a compiler warning when new clauses are added in the future, without handling them here. That makes sense to me (would have made apparent much earlier the original problem of missing handling for certain OMP_CLAUSE_*), but based on feedback received, it feels as if I'm the only supporter of such "defensive" programming paradigms? commit c6b10a9bc1437395c4931d43f30e778152a28cb2 Author: Thomas Schwinge Date: Mon Jun 13 16:29:37 2016 +0200 [PR middle-end/71373] Document missing OMP_CLAUSE_* in gcc/tree-nested.c gcc/ * tree-nested.c (convert_nonlocal_omp_clauses): (convert_local_omp_clauses): Document missing OMP_CLAUSE_*. --- gcc/tree-nested.c | 60 ++++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 42 insertions(+), 18 deletions(-) Grüße Thomas diff --git gcc/tree-nested.c gcc/tree-nested.c index 812f619..62cb01f 100644 --- gcc/tree-nested.c +++ gcc/tree-nested.c @@ -1203,17 +1203,29 @@ convert_nonlocal_omp_clauses (tree *pclauses, struct walk_stmt_info *wi) case OMP_CLAUSE_AUTO: break; + /* OpenACC tile clauses are discarded during gimplification. */ case OMP_CLAUSE_TILE: - /* OpenACC tile clauses are discarded during gimplification, so we - don't expect to see anything here. */ - gcc_unreachable (); - + /* The following clause belongs to the OpenACC cache directive, which + is discarded during gimplification. */ case OMP_CLAUSE__CACHE_: - /* These clauses belong to the OpenACC cache directive, which is - discarded during gimplification, so we don't expect to see - anything here. */ - gcc_unreachable (); - + /* The following clauses are only allowed in the OpenMP declare simd + directive, so not seen here. */ + case OMP_CLAUSE_UNIFORM: + case OMP_CLAUSE_INBRANCH: + case OMP_CLAUSE_NOTINBRANCH: + /* The following clauses are only allowed on OpenMP cancel and + cancellation point directives, which at this point have already + been lowered into a function call. */ + case OMP_CLAUSE_FOR: + case OMP_CLAUSE_PARALLEL: + case OMP_CLAUSE_SECTIONS: + case OMP_CLAUSE_TASKGROUP: + /* The following clauses are only added during OMP lowering; nested + function decomposition happens before that. */ + case OMP_CLAUSE__LOOPTEMP_: + case OMP_CLAUSE__SIMDUID_: + case OMP_CLAUSE__GRIDDIM_: + /* Anything else. */ default: gcc_unreachable (); } @@ -1899,17 +1911,29 @@ convert_local_omp_clauses (tree *pclauses, struct walk_stmt_info *wi) case OMP_CLAUSE_AUTO: break; + /* OpenACC tile clauses are discarded during gimplification. */ case OMP_CLAUSE_TILE: - /* OpenACC tile clauses are discarded during gimplification, so we - don't expect to see anything here. */ - gcc_unreachable (); - + /* The following clause belongs to the OpenACC cache directive, which + is discarded during gimplification. */ case OMP_CLAUSE__CACHE_: - /* These clauses belong to the OpenACC cache directive, which is - discarded during gimplification, so we don't expect to see - anything here. */ - gcc_unreachable (); - + /* The following clauses are only allowed in the OpenMP declare simd + directive, so not seen here. */ + case OMP_CLAUSE_UNIFORM: + case OMP_CLAUSE_INBRANCH: + case OMP_CLAUSE_NOTINBRANCH: + /* The following clauses are only allowed on OpenMP cancel and + cancellation point directives, which at this point have already + been lowered into a function call. */ + case OMP_CLAUSE_FOR: + case OMP_CLAUSE_PARALLEL: + case OMP_CLAUSE_SECTIONS: + case OMP_CLAUSE_TASKGROUP: + /* The following clauses are only added during OMP lowering; nested + function decomposition happens before that. */ + case OMP_CLAUSE__LOOPTEMP_: + case OMP_CLAUSE__SIMDUID_: + case OMP_CLAUSE__GRIDDIM_: + /* Anything else. */ default: gcc_unreachable (); }