Patchwork [Ada] Initial framework for Valid_Scalars attribute

login
register
mail settings
Submitter Arnaud Charlet
Date March 19, 2012, 4:41 p.m.
Message ID <20120319164151.GA24682@adacore.com>
Download mbox | patch
Permalink /patch/147580/
State New
Headers show

Comments

Arnaud Charlet - March 19, 2012, 4:41 p.m.
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  <dewar@adacore.com>

	* exp_attr.adb, sem_attr.adb, sem_attr.ads, snames.ads-tmpl: Add
	initial framework for Valid_Scalars attribute.

Patch

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,