diff mbox

[Ada] Ada.[Wide_]Wide_Characters.Handling should be Pure

Message ID 20120106144928.GA17391@adacore.com
State New
Headers show

Commit Message

Arnaud Charlet Jan. 6, 2012, 2:49 p.m. UTC
An oversight in the preparation of the RM left out the intended pragma
Pure for Ada.Wide_[Wide_]Characters.Handling (obviously intended since
Ada.Characters.Handling is Pure). This is expected to be corrected in
a future versiobn of AI05-0266-1, and this patch adds the required
pragma Pure statements. Also Ada.Wide_[Wide_]Characters.Unicode are
now Pure, as is System.UTF_32, since the two packages in question
depend on these packages, which should be pure in any case.

Tested on x86_64-pc-linux-gnu, committed on trunk

2012-01-06  Robert Dewar  <dewar@adacore.com>

	* a-wichha.ads, a-wichun.ads, a-zchhan.ads, a-zchuni.ads,
	s-utf_32.ads: Add pragma Pure
	* s-utf_32.adb: Suppress warnings on non-static constants (now
	that this is Pure).
diff mbox

Patch

Index: a-zchuni.ads
===================================================================
--- a-zchuni.ads	(revision 182950)
+++ a-zchuni.ads	(working copy)
@@ -34,6 +34,7 @@ 
 with System.UTF_32;
 
 package Ada.Wide_Wide_Characters.Unicode is
+   pragma Pure;
 
    --  The following type defines the categories from the unicode definitions.
    --  The one addition we make is Fe, which represents the characters FFFE
Index: a-zchhan.ads
===================================================================
--- a-zchhan.ads	(revision 182950)
+++ a-zchhan.ads	(working copy)
@@ -14,6 +14,11 @@ 
 ------------------------------------------------------------------------------
 
 package Ada.Wide_Wide_Characters.Handling is
+   pragma Pure;
+   --  This package is clearly intended to be Pure, by analogy with the
+   --  base Ada.Characters.Handling package. The version in the RM does
+   --  not yet have this pragma, but that is a clear omission. This will
+   --  be fixed in a future version of AI05-0266-1.
 
    function Is_Control (Item : Wide_Wide_Character) return Boolean;
    pragma Inline (Is_Control);
Index: s-utf_32.adb
===================================================================
--- s-utf_32.adb	(revision 182950)
+++ s-utf_32.adb	(working copy)
@@ -34,6 +34,13 @@ 
 pragma Style_Checks (Off);
 --  Allow long lines in this unit
 
+--  pragma Warnings (Off, "non-static constant in preelaborated unit");
+--  We need this to be pure, and the three constants in question are not a
+--  real problem, they are completely known at compile time. This pragma
+--  is commented out for now, because we still want to be able to bootstrap
+--  with old versions of the compiler that did not support this form. We
+--  have added additional pragma Warnings (Off/On) for now ???
+
 package body System.UTF_32 is
 
    ----------------------
@@ -1850,6 +1857,9 @@ 
      (16#F0000#, 16#FFFFD#),  -- (Co)  <Plane 15 Private Use, First> .. <Plane 15 Private Use, Last>
      (16#100000#, 16#10FFFD#));  -- (Co)  <Plane 16 Private Use, First> .. <Plane 16 Private Use, Last>
 
+   pragma Warnings (Off);
+   --  Temporary, until pragma at start can be activated ???
+
    --  The following array is parallel to the Unicode_Ranges table above. For
    --  each entry in the Unicode_Ranges table, there is a corresponding entry
    --  in the following table indicating the corresponding unicode category.
@@ -6060,6 +6070,9 @@ 
         40,  -- DESERET CAPITAL LETTER LONG I .. DESERET CAPITAL LETTER EW
         32); -- TAG LATIN CAPITAL LETTER A .. TAG LATIN CAPITAL LETTER Z
 
+   pragma Warnings (On);
+   --  Temporary until pragma Warnings at start can be activated ???
+
    --  The following is a list of the 10646 names for CAPITAL LETTER entries
    --  that have no matching SMALL LETTER entry and are thus not folded
 
Index: s-utf_32.ads
===================================================================
--- s-utf_32.ads	(revision 182950)
+++ s-utf_32.ads	(working copy)
@@ -44,6 +44,7 @@ 
 pragma Compiler_Unit;
 
 package System.UTF_32 is
+   pragma Pure;
 
    type UTF_32 is range 0 .. 16#7FFF_FFFF#;
    --  So far, the only defined character codes are in 0 .. 16#01_FFFF#
Index: a-wichun.ads
===================================================================
--- a-wichun.ads	(revision 182950)
+++ a-wichun.ads	(working copy)
@@ -37,6 +37,7 @@ 
 with System.UTF_32;
 
 package Ada.Wide_Characters.Unicode is
+   pragma Pure;
 
    --  The following type defines the categories from the unicode definitions.
    --  The one addition we make is Fe, which represents the characters FFFE
Index: a-wichha.ads
===================================================================
--- a-wichha.ads	(revision 182950)
+++ a-wichha.ads	(working copy)
@@ -14,6 +14,11 @@ 
 ------------------------------------------------------------------------------
 
 package Ada.Wide_Characters.Handling is
+   pragma Pure;
+   --  This package is clearly intended to be Pure, by analogy with the
+   --  base Ada.Characters.Handling package. The version in the RM does
+   --  not yet have this pragma, but that is a clear omission. This will
+   --  be fixed in a future version of AI05-0266-1.
 
    function Is_Control (Item : Wide_Character) return Boolean;
    pragma Inline (Is_Control);