diff mbox

[Ada] Short_Integer should be considered implementation defined

Message ID 20141017090829.GA14825@adacore.com
State New
Headers show

Commit Message

Arnaud Charlet Oct. 17, 2014, 9:08 a.m. UTC
For the purposes of restriction No_Implementation_Identifiers,
Standard.Short_Integer should be considered as being implementation
defined and this was not the case. In addition, this patch fixes
a compiler blow up with a compiler built with assertions in the
test for implementation-defined identifiers. Note that the latter
problem is not documented in the KP entry for this ticket, since
it shows up only in compilers built with assertions.

The following should compile as indicated with -gnatld7 -gnatj55

     1. pragma Restriction_Warnings
     2.          (No_Implementation_Identifiers);
     3. package ImplIdent is
     4.      subtype Integer_8 is Standard.Short_Short_Integer;
                                           |
        >>> warning: violation of restriction
            "No_Implementation_Identifiers" at line 1

     5.      subtype Integer_16 is Standard.Short_Integer;
                                            |
        >>> warning: violation of restriction
            "No_Implementation_Identifiers" at line 1

     6. end;

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

2014-10-17  Robert Dewar  <dewar@adacore.com>

	* cstand.adb (Create_Standard): Mark Short_Integer as
	implementation defined.
	* sem_util.adb (Set_Entity_With_Checks): Avoid blow up for
	compiler built with assertions for No_Implementation_Identifiers test.
diff mbox

Patch

Index: sem_util.adb
===================================================================
--- sem_util.adb	(revision 216371)
+++ sem_util.adb	(working copy)
@@ -16462,8 +16462,9 @@ 
          --  the entities within it).
 
          if (Is_Implementation_Defined (Val)
-               or else
-             Is_Implementation_Defined (Scope (Val)))
+              or else
+                (Present (Scope (Val))
+                  and then Is_Implementation_Defined (Scope (Val))))
            and then not (Ekind_In (Val, E_Package, E_Generic_Package)
                           and then Is_Library_Level_Entity (Val))
          then
Index: cstand.adb
===================================================================
--- cstand.adb	(revision 216367)
+++ cstand.adb	(working copy)
@@ -735,6 +735,7 @@ 
 
       Build_Signed_Integer_Type
         (Standard_Short_Integer, Standard_Short_Integer_Size);
+      Set_Is_Implementation_Defined (Standard_Short_Integer);
 
       Build_Signed_Integer_Type
         (Standard_Integer, Standard_Integer_Size);