From patchwork Thu Apr 25 10:13:22 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnaud Charlet X-Patchwork-Id: 239453 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 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "localhost", Issuer "www.qmailtoaster.com" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 724AD2C00CA for ; Thu, 25 Apr 2013 20:13:30 +1000 (EST) 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=Qxr/Mu5aB6IBbhq+rRpzF4hDAd94P9Qhan2Paz/2tQOod4nJRK FOA33dASfJa/tMpmzzGdfpeX6e/mQ4EMCJQKrRiVGIHiR1WNZJiDH+yqyvY2VK+v xmiFpKY44uJfqqX2bOuQNqPCoR/jMShj5V7EihvmVzOcu5bXtBGdXwdIg= 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=CoFXH3hQ6DijiK8vr/Q/9Mcorks=; b=RqPB7SK3HlxwoI/+Q6uw snmqmnLvO+FVoE24+5BcCJy5r6hvUy8tqk5x7azt8Xoq1FZOgnK0MmZmu4ul1/P8 f3T0abzokS7YEKSEUD6xhkZI4e86tCOgvf3tWgXvha57mCvR5Otz/LYP8MgLHXt5 4HmlztzvDU2Knw2wdNUOcUE= Received: (qmail 8535 invoked by alias); 25 Apr 2013 10:13:24 -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 8523 invoked by uid 89); 25 Apr 2013 10:13:24 -0000 X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL, BAYES_00, RCVD_IN_HOSTKARMA_NO autolearn=ham version=3.3.1 Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Thu, 25 Apr 2013 10:13:23 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 61E561C778E; Thu, 25 Apr 2013 06:13:22 -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 LhiKL+eRFEOg; Thu, 25 Apr 2013 06:13:22 -0400 (EDT) Received: from kwai.gnat.com (kwai.gnat.com [205.232.38.4]) by rock.gnat.com (Postfix) with ESMTP id 36B171C76E0; Thu, 25 Apr 2013 06:13:22 -0400 (EDT) Received: by kwai.gnat.com (Postfix, from userid 4192) id 2D21A3FF09; Thu, 25 Apr 2013 06:13:22 -0400 (EDT) Date: Thu, 25 Apr 2013 06:13:22 -0400 From: Arnaud Charlet To: gcc-patches@gcc.gnu.org Cc: Hristian Kirtchev Subject: [Ada] Locally enabled invariants are ignored Message-ID: <20130425101322.GA1174@adacore.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) X-Virus-Found: No This patch moves routine Find_Pragma from sem_util to einfo. No change in behavior, no test. Tested on x86_64-pc-linux-gnu, committed on trunk 2013-04-25 Hristian Kirtchev * einfo.ads, einfo.adb: Remove with and use clauses for Namet. (Find_Pragma): New routine. * sem_util.ads, sem_util.adb (Find_Pragma): Moved to einfo. Index: einfo.adb =================================================================== --- einfo.adb (revision 198282) +++ einfo.adb (working copy) @@ -33,7 +33,6 @@ -- Turn off subprogram ordering, not used for this unit with Atree; use Atree; -with Namet; use Namet; with Nlists; use Nlists; with Output; use Output; with Sinfo; use Sinfo; @@ -6102,6 +6101,26 @@ return Etype (Discrete_Subtype_Definition (Parent (Id))); end Entry_Index_Type; + ----------------- + -- Find_Pragma -- + ----------------- + + function Find_Pragma (Id : Entity_Id; Name : Name_Id) return Node_Id is + Item : Node_Id; + + begin + Item := First_Rep_Item (Id); + while Present (Item) loop + if Nkind (Item) = N_Pragma and then Pragma_Name (Item) = Name then + return Item; + end if; + + Item := Next_Rep_Item (Item); + end loop; + + return Empty; + end Find_Pragma; + --------------------- -- First_Component -- --------------------- Index: einfo.ads =================================================================== --- einfo.ads (revision 198275) +++ einfo.ads (working copy) @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with Namet; use Namet; with Snames; use Snames; with Types; use Types; with Uintp; use Uintp; @@ -7351,6 +7352,11 @@ -- expression is deferred to the freeze point. For further details see -- Sem_Ch13.Analyze_Aspect_Specifications. + function Find_Pragma (Id : Entity_Id; Name : Name_Id) return Node_Id; + -- Given entity Id and pragma name Name, attempt to find the corresponding + -- pragma in Id's chain of representation items. The function returns Empty + -- if no such pragma has been found. + function Get_Attribute_Definition_Clause (E : Entity_Id; Id : Attribute_Id) return Node_Id; Index: sem_util.adb =================================================================== --- sem_util.adb (revision 198282) +++ sem_util.adb (working copy) @@ -4882,26 +4882,6 @@ end if; end Find_Parameter_Type; - ----------------- - -- Find_Pragma -- - ----------------- - - function Find_Pragma (Id : Entity_Id; Name : Name_Id) return Node_Id is - Item : Node_Id; - - begin - Item := First_Rep_Item (Id); - while Present (Item) loop - if Nkind (Item) = N_Pragma and then Pragma_Name (Item) = Name then - return Item; - end if; - - Item := Next_Rep_Item (Item); - end loop; - - return Empty; - end Find_Pragma; - ----------------------------- -- Find_Static_Alternative -- ----------------------------- Index: sem_util.ads =================================================================== --- sem_util.ads (revision 198282) +++ sem_util.ads (working copy) @@ -494,11 +494,6 @@ -- Return the type of formal parameter Param as determined by its -- specification. - function Find_Pragma (Id : Entity_Id; Name : Name_Id) return Node_Id; - -- Given entity Id and pragma name Name, attempt to find the corresponding - -- pragma in Id's chain of representation items. The function returns Empty - -- if no such pragma has been found. - function Find_Static_Alternative (N : Node_Id) return Node_Id; -- N is a case statement whose expression is a compile-time value. -- Determine the alternative chosen, so that the code of non-selected