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] Don't flag No_Obsolescent_Features violations in instances


This patch avoids flagging violations of the No_Obsolescent_Features
restriction in generic instances. Such diagnostics are redundant
since the violation will be flagged in the template anyway.

The following is a test of this patch

gnat.adc contains pragma Restrictions (No_Obsolescent_Features);

     1. generic
     2. package obsolescent_generic is
     3.    procedure Initialize;
     4. end obsolescent_generic;

     1. package body obsolescent_generic is
     2.    procedure Initialize is
     3.       A  : Integer;
     4.       B  : Integer;
     5.       for A use at B'address;
              |
        >>> violation of restriction
            "no_obsolescent_features" at gnat.adc:1

     6.    begin
     7.       null;
     8.    end Initialize;
     9. end obsolescent_generic;

Compiling: obsolescent_instance1.ads

     1. package obsolescent_instance1 is
     2.    procedure Call;
     3. end obsolescent_instance1;

Compiling: obsolescent_instance1.adb

     1. with obsolescent_generic;
     2. package body obsolescent_instance1 is
     3.    package Instance1 is new obsolescent_generic;
     4.    procedure Call is
     5.    begin
     6.       Instance1.Initialize;
     7.    end Call;
     8. end obsolescent_instance1;

Prior to this patch, the compilation of the instance
resulted in a diagnostic on line 3 of the body (the
instantiation).

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

2012-02-17  Robert Dewar  <dewar@adacore.com>

	* restrict.adb (Check_Restriction): Add special handling for
	No_Obsolescent_Features.

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]