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 No_Implementation_Identifiers/Extensions


This patch implements AI 246, restriction No_Implemention_Identifiers
and the related profile No_Implementation_Extensions. The restriction
disallows references to implementation defined identifiers (such as the
ones in package Interfaces). The profile activates the full set of
restrictions with names No_Implementation_*.

It also implements pragma Implementation_Defined, which is used
in the run-time to flag implenentation defined entities.

The following two tests show these new features in action:

     1. pragma Restrictions (No_Implementation_Identifiers);
     2. with Interfaces; use Interfaces;
     3. package UserID is
     4.    X : Long_Long_Integer;
               |
        >>> violation of restriction
            "No_Implementation_Identifiers" at line 1

     5.    Y : Integer_32;
               |
        >>> violation of restriction
            "No_Implementation_Identifiers" at line 1

     6.    Z : Long_Float;
     7.    U : Unsigned_32 := 187;
               |
        >>> violation of restriction
            "No_Implementation_Identifiers" at line 1

     8.    P : Unsigned_32 := Shift_Right (U, 3);
               1              2
        >>> violation of restriction
            "No_Implementation_Identifiers" at line 1
        >>> violation of restriction
            "No_Implementation_Identifiers" at line 1

     9. end UserId;

     1. pragma Profile (No_Implementation_Extensions);
     2. with Interfaces; use Interfaces;
     3. package UserID2 is
     4.    X : Long_Long_Integer;
               |
        >>> violation of restriction
            "No_Implementation_Identifiers", from profile
            "No_Implementation_Extensions" at line 1

     5.    Y : Integer_32;
               |
        >>> violation of restriction
            "No_Implementation_Identifiers", from profile
            "No_Implementation_Extensions" at line 1

     6.    Z : Long_Float;
     7.    U : Unsigned_32 := 187;
               |
        >>> violation of restriction
            "No_Implementation_Identifiers", from profile
            "No_Implementation_Extensions" at line 1

     8.    P : Unsigned_32 := Shift_Right (U, 3);
               1              2
        >>> violation of restriction
            "No_Implementation_Identifiers", from profile
            "No_Implementation_Extensions" at line 1
        >>> violation of restriction
            "No_Implementation_Identifiers", from profile
            "No_Implementation_Extensions" at line 1

     9. end UserId2;

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

2011-09-06  Robert Dewar  <dewar@adacore.com>

	* a-cbprqu.ads, a-cbsyqu.ads, a-cuprqu.ads, a-cusyqu.ads,
	a-intnam-aix.ads, a-intnam-darwin.ads, a-intnam-dummy.ads,
	a-intnam-freebsd.ads, a-intnam-hpux.ads, a-intnam-irix.ads,
	a-intnam-linux.ads, a-intnam-lynxos.ads, a-intnam-mingw.ads,
	a-intnam-ppc.ads, a-intnam-solaris.ads, a-intnam-tru64.ads,
	a-intnam-vms.ads, a-intnam-vxworks.ads, a-intnam.ads, interfac.ads,
	cstand.adb, s-maccod.ads: Mark all entities as Implementation_Defined
	* einfo.ads, einfo.adb (Is_Implementation_Defined): New flag
	* par-prag.adb: Add dummy entry for pragma Implementation_Defined
	* s-rident.ads: Add new restriction No_Implementation_Identifiers
	Add new profile No_Implementation_Extensions
	* sem_prag.adb: Implement pragma Implementation_Defined Implement
	profile No_Implementation_Extensions
	* sem_util.adb: Minor reformatting (Set_Entity_With_Style_Check):
	Check violation of restriction No_Implementation_Identifiers
	* snames.ads-tmpl: Add entries for pragma Implementation_Defined
	Add entry for Name_No_Implementation_Extensions

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]