From patchwork Mon Sep 12 08:19:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Marc_Poulhi=C3=A8s?= X-Patchwork-Id: 1149 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5044:0:0:0:0:0 with SMTP id h4csp1781327wrt; Mon, 12 Sep 2022 01:30:19 -0700 (PDT) X-Google-Smtp-Source: AA6agR6tTN6WxU8oq68HWrbFl5k+1TMZNSC0+f3sZgcTiPpKdDfqmrhcTOkrA06xKDDhzSxNlLni X-Received: by 2002:a17:907:7fa5:b0:730:5d54:4c24 with SMTP id qk37-20020a1709077fa500b007305d544c24mr17854745ejc.641.1662971418737; Mon, 12 Sep 2022 01:30:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662971418; cv=none; d=google.com; s=arc-20160816; b=zVU12M84aLGwCypC9BJYUCLiJ7Ws7SHGJPafsMUeIYRPFO2R4Lbc/X0pJBX7R3VzOh uP1QLi99Uswgx6yHrHpTmJK6fsm+c3MtM1Zyu7WBjH7+mF0JssZMV1dByv/EEGxQQCPV 8abIlqaCvPXHjspfsKd3/UC5ynpFtiKbZs46OvwGyOfTHYgU4zq+owFgCPpB8tw22tlc aZVhP/kB06yASH/PvDc/v9Z0hN1xiLEFGHvGUa6zYtfrkmqtjgccb43oasmF06PaDkh2 YHg3tW/RiyPgTwP+sU+rBmfEwZmyqWZGeCzgyNTuPCxklhXtrvHiBfquGfaPc54lK0nz skhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:reply-to:from:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence :content-disposition:mime-version:message-id:subject:to:date :dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=JvndTRszBc+uOfyXxHfwrOOgAVmGG/pn3gxbKPGKQTs=; b=tuqQ5U8cw+vNVpfiWgm2f0vrEnwt65f4thkUzqd++Cc+Lmpc4ucuq7n0UNRgypqk7Q 2GHus1Huh3RVV7tnjNGE/FJSkKSL/qwcHIauYjbfEZgWNXbWQLfrPpE6Rb1IjLJ0EMNa p1X0dw58v/t9MwBcs6nvYO1yZ2pPOz4MUgQEFf5PxqP6KLtDwqzADwrF+4eKzXt0HAzZ ISAUH/6SIvaRWKIRjuHotl51cIKozdD/7P55Q35w/WPErKAC665CHALNsgvXMKoz1XQI a6a/5ZqhD6S/d+Y87nuJSRDSKQ75jpCCOvf53bx9ft+S/eCiGW24eD89DPYXaVcXLSmu KJww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=yFSPPO2B; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id dt12-20020a170907728c00b0076f0a1c1501si3180220ejc.698.2022.09.12.01.30.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Sep 2022 01:30:18 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=yFSPPO2B; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 8A046395C03E for ; Mon, 12 Sep 2022 08:24:17 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8A046395C03E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1662971057; bh=JvndTRszBc+uOfyXxHfwrOOgAVmGG/pn3gxbKPGKQTs=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=yFSPPO2B0rLrBosOPNy4hXEDr4j836dpT2fsdvCcHbHEqSYR9+HRzouJYQvlDvzXX jq+g4kAXiDIIYnLkZUXHFDRnF48HnEcYE+QyrnPctvWN/oVuPxdB7Axk/4Q2pwbSgf 6lvMaVLYFKF/YzIZ84uHoJDJXHbfwrSVFoLZu5M0= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by sourceware.org (Postfix) with ESMTPS id 4844138515C9 for ; Mon, 12 Sep 2022 08:19:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 4844138515C9 Received: by mail-wr1-x429.google.com with SMTP id e16so14067405wrx.7 for ; Mon, 12 Sep 2022 01:19:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date; bh=JvndTRszBc+uOfyXxHfwrOOgAVmGG/pn3gxbKPGKQTs=; b=qHBpI5SwGjjM45OoW1oV+DVB5Iyi0qZiKVrYwSqBquiNa1eaWmaZrt2MpO1RNhtmzi Jst43CIBgWoxlihgiC1HktwsdrQ8Cj4CX9UKf0EewD9b295LL5sdyWMSINYRfOE69W6u U2layr3ZraQ1vEzq3S48dE1j9BYkepaKftl3yjM6z6/WdzHWB1L0GogGT4qW5Eg30e50 FdbL/PpjQIk6ObiQ3gRZ4LG7cTF7MRt8Wqahni79C5Ef1/8UkP4D0CISD7gbGyPmJeag 0NgFZtX1mhzWuylm0yeLmGdOUkTW3g9Vib6DF8uJqZCHgOfgpHgs56mWB6ntjkMtrf39 //AA== X-Gm-Message-State: ACgBeo2zXQQQBAozSa8UNwcV81Cpuq7AluYeKAKqEgJ/RzvXrorazycQ e0c6ET7xBNFeisipP90i86pNAlCz89yiGw== X-Received: by 2002:a05:6000:10ca:b0:22a:3318:861f with SMTP id b10-20020a05600010ca00b0022a3318861fmr10015979wrx.284.1662970777209; Mon, 12 Sep 2022 01:19:37 -0700 (PDT) Received: from poulhies-Precision-5550 (lmontsouris-659-1-24-67.w81-250.abo.wanadoo.fr. [81.250.175.67]) by smtp.gmail.com with ESMTPSA id x5-20020a05600c21c500b003b4727d199asm6714957wmj.15.2022.09.12.01.19.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Sep 2022 01:19:36 -0700 (PDT) Date: Mon, 12 Sep 2022 10:19:36 +0200 To: gcc-patches@gcc.gnu.org Subject: [Ada] Cleanup routine for handling SPARK_Mode kinds Message-ID: <20220912081936.GA1513041@poulhies-Precision-5550> MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-12.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, 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-Patchwork-Original-From: =?utf-8?q?Marc_Poulhi=C3=A8s_via_Gcc-patches?= From: =?utf-8?q?Marc_Poulhi=C3=A8s?= Reply-To: Marc =?iso-8859-1?q?Poulhi=E8s?= Cc: Piotr Trojanek Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1743751918711439169?= X-GMAIL-MSGID: =?utf-8?q?1743751918711439169?= Code cleanup; semantics is unaffected. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * sem_prag.adb (Get_SPARK_Mode_Type): Fix header box; replace chained IF with a CASE statement. diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb --- a/gcc/ada/sem_prag.adb +++ b/gcc/ada/sem_prag.adb @@ -31172,25 +31172,26 @@ package body Sem_Prag is end if; end Get_Base_Subprogram; - ----------------------- + ------------------------- -- Get_SPARK_Mode_Type -- - ----------------------- + ------------------------- function Get_SPARK_Mode_Type (N : Name_Id) return SPARK_Mode_Type is begin - if N = Name_Auto then - return None; - elsif N = Name_On then - return On; - elsif N = Name_Off then - return Off; + case N is + when Name_Auto => + return None; + when Name_On => + return On; + when Name_Off => + return Off; - -- Any other argument is illegal. Assume that no SPARK mode applies to - -- avoid potential cascaded errors. + -- Any other argument is illegal. Assume that no SPARK mode applies + -- to avoid potential cascaded errors. - else - return None; - end if; + when others => + return None; + end case; end Get_SPARK_Mode_Type; ------------------------------------