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] Improvements to pragma Obsolescent


This patch does two things, first it makes the old "obsolete" form
official (where the Entity argument is omitted) official and fully
supported. Second it removes the requirement for pragma argument
identifiers to be present (whether or not the Entity argument is
present). The following test, compiled with -gnatwa -gnatj60
shows the new capabilities:

     1. package obsid is
     2.    X : Integer;
     3.    pragma Obsolescent (X, "x no good");
     4.    type Y is (Z);
     5.    pragma Obsolescent (Entity => Z, Message => "bad enum");
     6.    A : Integer;
     7.    pragma Obsolescent;
     8.    B : Integer;
     9.    pragma Obsolescent ("B is junk");
    10. end obsid;

    1. with obsid; use obsid;
    2. package useobs is
    3.    W : Integer := X;
                         |
       >>> warning: reference to obsolescent variable "X"
           declared at obsid.ads:2
           x no good

    4.    V : Y := Z;
                   |
       >>> warning: reference to obsolescent enumeration
           literal "Z" declared at obsid.ads:4
           bad enum

    5.    M : Integer := A;
                         |
       >>> warning: reference to obsolescent variable "A"
           declared at obsid.ads:6

    6.    N : Integer := B;
                         |
       >>> warning: reference to obsolescent variable "B"
           declared at obsid.ads:8
           B is junk

    7. end useobs;

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

2009-04-08  Robert Dewar  <dewar@adacore.com>

	* gnat_rm.texi: Update documentation of pragma Obsolescent
	
	* sem_prag.adb (Analyze_Pragma, case Obsolescent): Allow identifiers to
	be omitted, and allow Entity parameter to be omitted.

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]