This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Ada] Implement new partition-wide restriction No_Long_Long_Integer


This new restriction No_Long_Long_Integer forbids any explicit reference
to type Standard.Long_Long_Integer, and also forbids declaring range
types whose implicit base type is Long_Long_Integer, and modular types
whose size exceeds Long_Integer'Size. The following is compiled with
-gnatl:

     1. pragma Restrictions (No_Long_Long_Integer);
     2. function NoLLI (m, n : Long_Long_Integer) return Boolean is
                               |
        >>> violation of restriction "No_Long_Long_Integer" at line 1

     3.    X : long_Long_Integer := m;
               |
        >>> violation of restriction "No_Long_Long_Integer" at line 1

     4.    type R is range 1 .. Integer'Last + 1;
                     |
        >>> violation of restriction "No_Long_Long_Integer" at line 1

     5.    type ROK is range 1 .. Integer'Last;
     6.    RV : R := 3;
     7.    type LM is mod 2 ** 33;
                            |
        >>> violation of restriction "No_Long_Long_Integer" at line 1

     8.    type LMOK is mod 2 ** 32;
     9. begin
    10.    return X > 3 and then RV > 2;
    11. end NoLLI;

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

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

	* restrict.ads (Implementation_Restriction): Add No_Long_Long_Integer.
	* s-rident.ads (Partition_Boolean_Restrictions): Add
	No_Long_Long_Integer.
	* sem_ch3.adb (Modular_Type_Declaration): Size must be <=
	Long_Integer'Size if restriction No_Long_Long_Integer is active.
	(Signed_Integer_Type_Declaration): Do not allow Long_Long_Integer
	as the implicit base type for a signed integer type declaration
	if restriction No_Long_Long_Integer is active.
	* sem_util.ads, sem_util.adb (Set_Entity_With_Checks): Include check for
	No_Long_Long_Integer.

Attachment: difs
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]