From patchwork Mon Sep 12 08:19:35 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: 1157 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5044:0:0:0:0:0 with SMTP id h4csp1782665wrt; Mon, 12 Sep 2022 01:35:39 -0700 (PDT) X-Google-Smtp-Source: AA6agR4qSqFQmkx8RlCxuY89O6rCKqnAhOi0xb/dZKixIEZkel4CMBlzNnWCXj0hSFZZboezlKnr X-Received: by 2002:a17:907:708:b0:77e:ff47:34b1 with SMTP id xb8-20020a170907070800b0077eff4734b1mr762417ejb.493.1662971739592; Mon, 12 Sep 2022 01:35:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662971739; cv=none; d=google.com; s=arc-20160816; b=SVbHSqW+p5nhO95VEEeAqhpTvvSVo5xJO+RLfGRRek3ojHpEGaAfQ7yezK9m0Oq8Zy qusoj2IRfFTjupUiL2GhKjw5cPS3U3FjknQLTbhaYabJGrUwx9apmDm+kx3L6h5ptfYS jQ7nm23RDfj5diL52Z6d7/FLexA5C+r4D16eGq0vnOYPflQ4YSC66it5xFnMfEGwRFd/ 1Mc2WVetyI2Q8b9cBbY1VWe9L5ea85lxziLvBdta5XZiznR8YnGJBGKXbDe1lZbEdGqh gEG+UWVPniIief1LQriCLnet+RiU528m85k49fVX7ojEmZiLcRdkFQRQno15+lwe5K6Z w2RQ== 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=297+F7x59Dlj5hnpLOy/kqIusun7saGDYbzjQkYIxqM=; b=01mjW3ZyHOjviE0hdHmVAjgdphny9oXg3NSmgFiOJR3t7A2lfpg1I0wL/FuPjYXgYx UE9qvIz+/i1jFoYJfhYZCC/3NQl8yqLpsv8TIY6JlhSc+tWdQ/yjcBE5hz0VyS0JOig7 rmTL9+CmnIApGmyLjRCbk036TiN26ftYz6Rv/YGbCIlOS1n7ye16aUDV6CrofhtiVOgo CYfos+7VbXW5HP8PNCc9IchdqkiBFYkgeTVWeZhSLb3b/Mn/vgLJFV32QS8d94qPEEOw G5lGYMPO+rFj8jOeK48Lbt4H6jKIcwdeNCl0t5M4hAvWwgY5OD0oyrCKGEXdvHUq2Muu kUYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b="I/BlCObb"; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c 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 (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id eb13-20020a0564020d0d00b00446f6e9c6cesi8048273edb.351.2022.09.12.01.35.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Sep 2022 01:35:39 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b="I/BlCObb"; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c 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 BDE67389942D for ; Mon, 12 Sep 2022 08:27:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BDE67389942D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1662971233; bh=297+F7x59Dlj5hnpLOy/kqIusun7saGDYbzjQkYIxqM=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=I/BlCObbhHwyxqrf13awlz49BJ9DVddvpdNbIqnofV1byYUVrwr8paZbALY5pw5MO zcCsOclRQbTQHorZiVw8gywRJvqf8eGlWsnHadmGnp0wPGlgx2f2xNAODdZ/WO85PS qnYZ1SxTuHM3ApiUECYTTXy+XDw+hnVrDrUHrrbM= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by sourceware.org (Postfix) with ESMTPS id 3D00C3857004 for ; Mon, 12 Sep 2022 08:19:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 3D00C3857004 Received: by mail-wr1-x433.google.com with SMTP id e16so14067348wrx.7 for ; Mon, 12 Sep 2022 01:19:37 -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=297+F7x59Dlj5hnpLOy/kqIusun7saGDYbzjQkYIxqM=; b=PzrWzDcvZtZVvkO/5F14ZnUbr0vghC0wXBLKU4kwU3oWLVgUW64vW/2fTWOcqOuMCp QgqRTTCagvAvKz0a+mPGaUyuDx3M6B6SgEoKLnGSStWNEv/gYz1/1noEvaKB3LUZFWjW B1QUaCM8c1cC6CQd6EuAdmEHj3RLcaTfolp2M2jQ2Im7U4Z9CKaCvvg8VVjxSqnziaV5 3V8AwQwUgUU+cWyR/qwDUd79L/7I7byPYSCz0R4mvyHHErhxTgK0GIbwWBclKJEfqxmF DNgx+ZDtrqZH+XJT8mpPZ1GIM00eVKEwF4rZV5X6kU1EyalcKNcMyb5GLaxR8xov8buU amgg== X-Gm-Message-State: ACgBeo2OpkYVnLE5hnb6byT/IIyYdlS1X0l5jLeBKFrvNNKNIkzI1brD HmOSIruU7WdUpO0Shq7D6TLPs0dQ6IekZw== X-Received: by 2002:a5d:6da2:0:b0:228:64cb:5333 with SMTP id u2-20020a5d6da2000000b0022864cb5333mr13544285wrs.428.1662970776174; Mon, 12 Sep 2022 01:19:36 -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 i2-20020a5d4382000000b00228933481dbsm6561716wrq.47.2022.09.12.01.19.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Sep 2022 01:19:35 -0700 (PDT) Date: Mon, 12 Sep 2022 10:19:35 +0200 To: gcc-patches@gcc.gnu.org Subject: [Ada] Accept explicit SPARK_Mode Auto as configuration pragma Message-ID: <20220912081935.GA1513026@poulhies-Precision-5550> MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-12.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, 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: Yannick Moy 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?1743752254656592265?= X-GMAIL-MSGID: =?utf-8?q?1743752254656592265?= An explicit value of Auto is now accepted for a configuration pragma SPARK_Mode, as a way to exempt a unit from complete adherence to SPARK rules when using a global configuration pragma file where SPARK_Mode=>On is specified. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * sem_prag.adb (Analyze_Pragma): Accept SPARK_Mode=>Auto as configuration pragma. (Get_SPARK_Mode): Make the value for Auto explicit. * snames.ads-tmpl (Name_Auto): Add name. 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 @@ -23176,7 +23176,7 @@ package body Sem_Prag is -- SPARK_Mode -- ---------------- - -- pragma SPARK_Mode [(On | Off)]; + -- pragma SPARK_Mode [(Auto | On | Off)]; when Pragma_SPARK_Mode => Do_SPARK_Mode : declare Mode_Id : SPARK_Mode_Type; @@ -23662,7 +23662,7 @@ package body Sem_Prag is -- Check the legality of the mode (no argument = ON) if Arg_Count = 1 then - Check_Arg_Is_One_Of (Arg1, Name_On, Name_Off); + Check_Arg_Is_One_Of (Arg1, Name_Auto, Name_On, Name_Off); Mode := Chars (Get_Pragma_Arg (Arg1)); else Mode := Name_On; @@ -23713,6 +23713,15 @@ package body Sem_Prag is -- the pragma resides to find a potential construct. else + -- An explicit mode of Auto is only allowed as a configuration + -- pragma. Escape "pragma" to avoid replacement with "aspect". + + if Mode_Id = None then + Error_Pragma_Arg + ("only configuration 'p'r'a'g'm'a% can have value &", + Arg1); + end if; + Stmt := Prev (N); while Present (Stmt) loop @@ -31169,7 +31178,9 @@ package body Sem_Prag is function Get_SPARK_Mode_Type (N : Name_Id) return SPARK_Mode_Type is begin - if N = Name_On then + if N = Name_Auto then + return None; + elsif N = Name_On then return On; elsif N = Name_Off then return Off; diff --git a/gcc/ada/snames.ads-tmpl b/gcc/ada/snames.ads-tmpl --- a/gcc/ada/snames.ads-tmpl +++ b/gcc/ada/snames.ads-tmpl @@ -782,6 +782,7 @@ package Snames is Name_Assertion : constant Name_Id := N + $; Name_Assertions : constant Name_Id := N + $; Name_Attribute_Name : constant Name_Id := N + $; + Name_Auto : constant Name_Id := N + $; Name_Body_File_Name : constant Name_Id := N + $; Name_Boolean_Entry_Barriers : constant Name_Id := N + $; Name_By_Any : constant Name_Id := N + $;