From patchwork Mon Mar 19 16:41:51 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnaud Charlet X-Patchwork-Id: 147580 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]) by ozlabs.org (Postfix) with SMTP id AC32FB6FBC for ; Tue, 20 Mar 2012 03:42:44 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1332780164; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Received:Date:From:To:Cc:Subject:Message-ID: MIME-Version:Content-Type:Content-Disposition:User-Agent: Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:Sender:Delivered-To; bh=9bO64BLIpdFcrnL0BAUe C7aNr6A=; b=yY/KM9fg7GQPR/9brbBZXiMVwvt77LLdkOtTcYVnZ5d2jeu7TQKU yY/Iih4JzjCHmpHWAvmSxBamld267Y2p6jJ96eV+eCFbcHI0PtCXbEk9/IP9Ypxo jrcwCQgSZ2iPjxZ+c64GcYmSGJ+xJC0fwrvjgEPKuzVDX3a8mXRrCh4= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Received:Received:Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type:Content-Disposition:User-Agent:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=DpQorXRRTOeAB+SYlEWF/7ekbHDzkxjIqpijkoqbyMezhhndKwPx+3JSE7+p0f OaKDmsVsvz/zRHGxlC1yTwseQOGDyA8gOuu4GcdaCo9QUHdONcw7uxfrtuTMox0e YJmYBtKZDaPBa9sHnnCriYbqmcEW2TzEaa0bAsHHcXVgo=; Received: (qmail 22977 invoked by alias); 19 Mar 2012 16:42:29 -0000 Received: (qmail 22959 invoked by uid 22791); 19 Mar 2012 16:42:28 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 19 Mar 2012 16:41:52 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id CE5421C6885; Mon, 19 Mar 2012 12:41:51 -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 g5qixhcbg2by; Mon, 19 Mar 2012 12:41:51 -0400 (EDT) Received: from kwai.gnat.com (kwai.gnat.com [205.232.38.4]) by rock.gnat.com (Postfix) with ESMTP id AC8A11C6857; Mon, 19 Mar 2012 12:41:51 -0400 (EDT) Received: by kwai.gnat.com (Postfix, from userid 4192) id AB39D3FEE8; Mon, 19 Mar 2012 12:41:51 -0400 (EDT) Date: Mon, 19 Mar 2012 12:41:51 -0400 From: Arnaud Charlet To: gcc-patches@gcc.gnu.org Cc: Robert Dewar Subject: [Ada] Initial framework for Valid_Scalars attribute Message-ID: <20120319164151.GA24682@adacore.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) 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 This is the initial checkin to establish the framework for this new attribute which will check subcomponents of composite objects. No test yet, since the implementation is not there yet! Tested on x86_64-pc-linux-gnu, committed on trunk 2012-03-19 Robert Dewar * exp_attr.adb, sem_attr.adb, sem_attr.ads, snames.ads-tmpl: Add initial framework for Valid_Scalars attribute. Index: exp_attr.adb =================================================================== --- exp_attr.adb (revision 185520) +++ exp_attr.adb (working copy) @@ -5368,6 +5368,15 @@ Validity_Checks_On := Save_Validity_Checks_On; end Valid; + ------------------- + -- Valid_Scalars -- + ------------------- + + when Attribute_Valid_Scalars => Valid_Scalars : declare + begin + raise Program_Error; + end Valid_Scalars; + ----------- -- Value -- ----------- Index: sem_attr.adb =================================================================== --- sem_attr.adb (revision 185520) +++ sem_attr.adb (working copy) @@ -5196,6 +5196,15 @@ Set_Etype (N, Standard_Boolean); + ------------------- + -- Valid_Scalars -- + ------------------- + + when Attribute_Valid_Scalars => + Check_E0; + Check_Type; + -- More stuff TBD ??? + ----------- -- Value -- ----------- @@ -6034,7 +6043,7 @@ return; -- No other cases are foldable (they certainly aren't static, and at - -- the moment we don't try to fold any cases other than these three). + -- the moment we don't try to fold any cases other than the ones above). else Check_Expressions; @@ -8145,6 +8154,7 @@ Attribute_Universal_Literal_String | Attribute_Unrestricted_Access | Attribute_Valid | + Attribute_Valid_Scalars | Attribute_Value | Attribute_Wchar_T_Size | Attribute_Wide_Value | Index: sem_attr.ads =================================================================== --- sem_attr.ads (revision 185520) +++ sem_attr.ads (working copy) @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1992-2011, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2012, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -549,6 +549,13 @@ -- Natural'Size is typically 31, the value of Natural'VADS_Size is 32. -- For all other types, Size and VADS_Size yield the same value. + ------------------- + -- Valid_Scalars -- + ------------------- + + Attribute_Valid_Scalars => True, + -- Typ'Valid_Scalars applies to ??? + ---------------- -- Value_Size -- ---------------- Index: snames.ads-tmpl =================================================================== --- snames.ads-tmpl (revision 185520) +++ snames.ads-tmpl (working copy) @@ -854,6 +854,7 @@ Name_VADS_Size : constant Name_Id := N + $; -- GNAT Name_Val : constant Name_Id := N + $; Name_Valid : constant Name_Id := N + $; + Name_Valid_Scalars : constant Name_Id := N + $; -- GNAT Name_Value_Size : constant Name_Id := N + $; -- GNAT Name_Variable_Indexing : constant Name_Id := N + $; -- GNAT Name_Version : constant Name_Id := N + $; @@ -1418,6 +1419,7 @@ Attribute_VADS_Size, Attribute_Val, Attribute_Valid, + Attribute_Valid_Scalars, Attribute_Value_Size, Attribute_Variable_Indexing, Attribute_Version,