From patchwork Wed Aug 21 08:31:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Marie de Rodat X-Patchwork-Id: 1150694 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-507423-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=adacore.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="G9/dLXiH"; 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 46D19r2B0Fz9sBp for ; Wed, 21 Aug 2019 18:32:15 +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:date :from:to:cc:subject:message-id:mime-version:content-type; q=dns; s=default; b=hokOWca7v4abdym6GqmjJ9ZpT6k6PwaCP1Sj4ZP2+6/UZEk8Th JPwyl6qaMOdW80+w9s5HSNMxgntpe+qiz6clUkAd+26oxs8WG8hT8ZY8obNpJrUQ R++ocqiAlr/kTAkWQIoWo9Ba2qqKCvg6c2IENHlGTg3BXLd2kLN/22buc= 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:date :from:to:cc:subject:message-id:mime-version:content-type; s= default; bh=GBXebzW9eiMO3S0eA8Cad8P3bQk=; b=G9/dLXiHyl0sV8Y/L8d0 VsyqFgDaOcBjg3tnj+dP5/ap2l7Mm2LGG1Fr0PUGQm+KjT1fZsPYr2MA4SOmjdAS fSO8D97WlbfVjPCc49/p1U981i68A9ruP4HsiIN/zqJasMe297riWW/MLq/ZuWaH RwhPEMXAUhXLP5a9NtsNjEg= Received: (qmail 95176 invoked by alias); 21 Aug 2019 08:31:45 -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 95129 invoked by uid 89); 21 Aug 2019 08:31:44 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-11.9 required=5.0 tests=BAYES_00, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=(unknown) X-HELO: rock.gnat.com Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 21 Aug 2019 08:31:43 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 9562B1163EF; Wed, 21 Aug 2019 04:31:41 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id W79MYCRdderb; Wed, 21 Aug 2019 04:31:41 -0400 (EDT) Received: from tron.gnat.com (tron.gnat.com [IPv6:2620:20:4000:0:46a8:42ff:fe0e:e294]) by rock.gnat.com (Postfix) with ESMTP id 8038F1163EA; Wed, 21 Aug 2019 04:31:41 -0400 (EDT) Received: by tron.gnat.com (Postfix, from userid 4862) id 77FDA646; Wed, 21 Aug 2019 04:31:41 -0400 (EDT) Date: Wed, 21 Aug 2019 04:31:41 -0400 From: Pierre-Marie de Rodat To: gcc-patches@gcc.gnu.org Cc: Justin Squirek Subject: [Ada] Max_Entry_Queue_Length aspect for protected entries Message-ID: <20190821083141.GA71799@adacore.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) X-IsSubscribed: yes Allow values of negative one to be accepted as a valid parameter as a special case. Tested on x86_64-pc-linux-gnu, committed on trunk 2019-08-21 Justin Squirek gcc/ada/ * doc/gnat_rm/implementation_defined_pragmas.rst: Modify documentation to reflect expected behavior. * gnat_rm.texi: Regenerate. * sem_prag.adb (Analyze_Pragma): Modify handling of pragma Max_Entry_Queue_Length to not reject integer values of negative one. * sem_util.adb (Get_Max_Queue_Length): Add processing for values of negative one to fit within the current scheme. --- gcc/ada/doc/gnat_rm/implementation_defined_pragmas.rst +++ gcc/ada/doc/gnat_rm/implementation_defined_pragmas.rst @@ -3888,8 +3888,10 @@ Syntax:: This pragma is used to specify the maximum callers per entry queue for individual protected entries and entry families. It accepts a single -positive integer as a parameter and must appear after the declaration -of an entry. +integer (-1 or more) as a parameter and must appear after the declaration of an +entry. + +A value of -1 represents no additional restriction on queue length. Pragma No_Body ============== --- gcc/ada/gnat_rm.texi +++ gcc/ada/gnat_rm.texi @@ -1764,9 +1764,9 @@ Syntax: pragma Aggregate_Individually_Assign; @end example -Where possible GNAT will store the binary representation of a record aggregate +Where possible, GNAT will store the binary representation of a record aggregate in memory for space and performance reasons. This configuration pragma changes -this behaviour so that record aggregates are instead always converted into +this behavior so that record aggregates are instead always converted into individual assignment statements. @node Pragma Allow_Integer_Address,Pragma Annotate,Pragma Aggregate_Individually_Assign,Implementation Defined Pragmas @@ -5394,8 +5394,10 @@ pragma Max_Entry_Queue (static_integer_EXPRESSION); This pragma is used to specify the maximum callers per entry queue for individual protected entries and entry families. It accepts a single -positive integer as a parameter and must appear after the declaration -of an entry. +integer (-1 or more) as a parameter and must appear after the declaration of an +entry. + +A value of -1 represents no additional restriction on queue length. @node Pragma No_Body,Pragma No_Caching,Pragma Max_Queue_Length,Implementation Defined Pragmas @anchor{gnat_rm/implementation_defined_pragmas pragma-no-body}@anchor{a1} --- gcc/ada/sem_prag.adb +++ gcc/ada/sem_prag.adb @@ -19538,7 +19538,7 @@ package body Sem_Prag is | Pragma_Max_Entry_Queue_Depth | Pragma_Max_Queue_Length => - Max_Queue_Length : declare + Max_Entry_Queue_Length : declare Arg : Node_Id; Entry_Decl : Node_Id; Entry_Id : Entity_Id; @@ -19589,9 +19589,9 @@ package body Sem_Prag is Val := Expr_Value (Arg); - if Val <= 0 then + if Val < -1 then Error_Pragma_Arg - ("argument for pragma% must be positive", Arg1); + ("argument for pragma% cannot be less than -1", Arg1); elsif not UI_Is_In_Int_Range (Val) then Error_Pragma_Arg @@ -19609,7 +19609,7 @@ package body Sem_Prag is end if; Record_Rep_Item (Entry_Id, N); - end Max_Queue_Length; + end Max_Entry_Queue_Length; ----------------- -- Memory_Size -- --- gcc/ada/sem_util.adb +++ gcc/ada/sem_util.adb @@ -9752,16 +9752,27 @@ package body Sem_Util is function Get_Max_Queue_Length (Id : Entity_Id) return Uint is pragma Assert (Is_Entry (Id)); Prag : constant Entity_Id := Get_Pragma (Id, Pragma_Max_Queue_Length); + Max : Uint; begin - -- A value of 0 represents no maximum specified, and entries and entry - -- families with no Max_Queue_Length aspect or pragma default to it. + -- A value of 0 or -1 represents no maximum specified, and entries and + -- entry families with no Max_Queue_Length aspect or pragma default to + -- it. if not Present (Prag) then return Uint_0; end if; - return Intval (Expression (First (Pragma_Argument_Associations (Prag)))); + Max := Intval (Expression (First (Pragma_Argument_Associations (Prag)))); + + -- Since -1 and 0 are equivalent, return 0 for instances of -1 for + -- uniformity. + + if Max = -1 then + return Uint_0; + end if; + + return Max; end Get_Max_Queue_Length; ------------------------